Devel-Leak-Cb
view release on metacpan or search on metacpan
Revision history for Devel-Leak-Cb
0.04 2010-06-21
Fix tests, fix named callbacks with lexical vars
0.03 2009-11-09
Fix COUNT for requre but not use
0.02 2009-10-27
Support for named callbacks
0.01 2009-10-24
First version
---
abstract: 'Detect leaked callbacks'
author:
- 'Mons Anderson, C<< <mons at cpan.org> >>'
- 'Mons Anderson <mons@cpan.org>'
build_requires:
ExtUtils::MakeMaker: 6.42
Test::More: 0
lib::abs: 0.90
configure_requires:
ExtUtils::MakeMaker: 6.42
distribution_type: module
NAME
Devel::Leak::Cb - Detect leaked callbacks
VERSION
Version 0.04
SYNOPSIS
use Devel::Leak::Cb;
AnyEvent->timer( after => 1, cb => cb {
...
});
When $ENV{DEBUG_CB} will be set, then all cb {} declarations will be
counted, and if some of them will not be destroyed till the END stage,
you'll be warned
EXPORT
Exports a single function: cb {}, which would be rewritten as sub {}
when $ENV{DEBUG_CB} is not in effect
If "DEBUG_CB" > 1 and Devel::FindRef is installed, then output will
include reference tree of leaked callbacks
FUNCTIONS
cb {}
Create anonymous callback
my $cb = cb {};
cb name {}
Create named callback with static name (Have no effect without
$ENV{DEBUG_CB})
cb 'name' {}
Create named callback with dynamic name (Have no effect without
$ENV{DEBUG_CB}) Currently supported only ' and ". Quote-like operators
support will be later
my $cb = cb 'name' {};
my $cb = cb "name.$val" {};
COUNT
You may call C<Devel::Leak::Cb::COUNT()> Manually to check state. All leaked callbacks will be warned. Noop without C<$ENV{DEBUG_CB}>
AUTHOR
Mons Anderson, "<mons at cpan.org>"
BUGS
Please report any bugs or feature requests to "bug-devel-leak-cb at
rt.cpan.org", or through the web interface at
<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Devel-Leak-Cb>. I will
be notified, and then you'll automatically be notified of progress on
your bug as I make changes.
lib/Devel/Leak/Cb.pm view on Meta::CPAN
package Devel::Leak::Cb;
use 5.008008;
use common::sense;
m{
use strict;
use warnings;
}x;
=head1 NAME
Devel::Leak::Cb - Detect leaked callbacks
=head1 VERSION
Version 0.04
=cut
our $VERSION = '0.04';
=head1 SYNOPSIS
lib/Devel/Leak/Cb.pm view on Meta::CPAN
=head1 DESCRIPTION
By default, cb { .. } will be rewritten as sub { .. } using L<Devel::Declare> and will give no additional cost at runtime
When C<$ENV{DEBUG_CB}> will be set, then all cb {} declarations will be counted, and if some of them will not be destroyed till the END stage, you'll be warned
=head1 EXPORT
Exports a single function: cb {}, which would be rewritten as sub {} when C<$ENV{DEBUG_CB}> is not in effect
If C<DEBUG_CB> > 1 and L<Devel::FindRef> is installed, then output will include reference tree of leaked callbacks
=head1 FUNCTIONS
=head2 cb {}
Create anonymous callback
my $cb = cb {};
=head2 cb name {}
lib/Devel/Leak/Cb.pm view on Meta::CPAN
=head2 cb 'name' {}
Create named callback with dynamic name (Have no effect without C<$ENV{DEBUG_CB}>)
Currently supported only ' and ". Quote-like operators support will be later
my $cb = cb 'name' {};
my $cb = cb "name.$val" {};
=head2 COUNT
You may call C<Devel::Leak::Cb::COUNT()> Manually to check state. All leaked callbacks will be warned. Noop without C<$ENV{DEBUG_CB}>
=cut
use Devel::Declare ();
use Scalar::Util 'weaken';
our @CARP_NOT = qw(Devel::Declare);
our %DEF;
BEGIN {
( run in 3.387 seconds using v1.01-cache-2.11-cpan-9b1e4054eb1 )