Created
November 18, 2015 05:02
-
-
Save dr-kd/f820b2c53e792293206f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package Some::Object; | |
...; | |
use Devel::Cycle; | |
# Devel::Cycle assumes you're happy with things going to STDOUT. | |
no warnings 'redefine'; | |
sub Devel::Cycle::_do_report { | |
my $counter = shift; | |
my $path = shift; | |
warn "Cycle ($counter):\n"; | |
foreach (@$path) { | |
my ($type,$index,$ref,$value,$is_weak) = @$_; | |
printf( STDERR "\t%30s => %-30s\n",($is_weak ? 'w-> ' : '') | |
.Devel::Cycle::_format_reference($type,$index,$ref,0) | |
, Devel::Cycle::_format_reference(undef,undef,$value,1)); | |
} | |
} | |
sub DESTROY { | |
my ($self) = @_; | |
print STDERR "##### DESTROY #####\n\n"; | |
my $user = $self->_get_config->{current_user}; | |
return unless $user; | |
my $ref = tied %$user; | |
return unless $ref; | |
print STDERR "\n\n\n##### CYCLE #####\n\n"; | |
find_cycle($ref); | |
print STDERR "##### WEAK CYCLE #####\n\n\n"; | |
find_weakened_cycle($ref); | |
print STDERR "##### END #####\n\n\n"; | |
my $x = 0; | |
} | |
1; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment