NAME
MooseX-LeakCheck - Check for leaky attributes
DESCRIPTION
Define an attribute that you know should be the only remaining ref to an object when your instance is destroyed. On destruction verify the attribute is also destroyed.
SYNOPSIS
package Foo;
use MooseX::LeakCheck;
has bar => (
is => 'ro',
default => sub {[]},
leak_check => 1,
);
has baz => (
is => 'ro',
default => sub {[]},
leak_check => sub {
my $self = shift;
my ( $attr_name, $ref ) = @_;
...
}
);
has boo => (
is => 'ro',
default => sub {[]},
# Defaults to no
leak_check => 0,
);
1;
ATTRIBUTE PROPERTIES
- leak_check => $BOOL
- leak_check => sub { ... }
-
Turn on leak checking for the attribute when set to true. Generates a warning when a leak is detected. Alternatively you may provide a coderef callback to run when a leak is detected.
The coderef gets the following args: ( $self, $attr_name, \$self->{$attr_name})
AUTHORS
Chad Granum exodist7@gmail.com
COPYRIGHT
Copyright (C) 2012 Chad Granum
MooseX::LeakCheck is free software; Standard perl licence.
MooseX::LeakCheck is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.