File tree Expand file tree Collapse file tree 3 files changed +8
-10
lines changed Expand file tree Collapse file tree 3 files changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -78,6 +78,8 @@ sub DEMOLISHALL {
7878
7979 foreach my $class (@isa ) {
8080 no strict ' refs' ;
81+ # If a child module implements DEMOLISH and its parent does not
82+ # then the access below can be the only reference to that parent's sub
8183 my $demolish = do {
8284 no warnings ' once' ;
8385 *{" ${class} ::DEMOLISH" }{CODE };
Original file line number Diff line number Diff line change @@ -2,14 +2,8 @@ use strict;
22use warnings;
33
44use lib ' t/lib' ;
5- use Test::More tests => 1;
6-
7- my @warnings ;
8- BEGIN {
9- $SIG {__WARN__ } = sub { push @warnings , @_ };
10- }
5+ use Test::More tests => 2; # Test::Warnings re-tests had_no_warnings implicitly
6+ use Test::Requires qw( Test::Warnings) ;
117
128use Demolition::OnceRemoved;
13-
14- is scalar @warnings , 0, " No warnings"
15- or diag explain \@warnings ;
9+ Test::Warnings::had_no_warnings(" No DEMOLISH warnings" );
Original file line number Diff line number Diff line change @@ -3,7 +3,9 @@ use strict;
33use warnings;
44use Demolition::Demolisher;
55
6+ # This variable is only in scope during the initial `use`
7+ # As it leaves scope, Perl will call DESTROY on it
8+ # (and Moose::Object will then go through its DEMOLISHALL method)
69my $d = Demolition::Demolisher-> new;
7- $d -> DEMOLISH;
810
9111;
You can’t perform that action at this time.
0 commit comments