#!/usr/bin/perl use MyClass; my $obj = MyClass->new(); #### package MyClass; use Class::Std; # As in Config::Std::Hash my $hash_ref = {}; bless $hash_ref, 'MyClass'; 1; #### Name "MyClass::DEMOLISH" used only once: possible typo at /usr/share/perl5/Class/Std.pm line 523. #### sub DESTROY { my ($self) = @_; my $id = ID($self); push @_, $id; DEMOLISH: for my $base_class (_hierarchy_of(ref $_[0])) { no strict 'refs'; if (my $demolish_ref = *{$base_class.'::DEMOLISH'}{CODE}) { &{$demolish_ref}; } for my $attr_ref ( @{$attribute{$base_class}} ) { delete $attr_ref->{ref}{$id}; } } } #### package MyClass; use Class::Std; my $hash_ref = {}; bless $hash_ref, 'MyClass'; sub DEMOLISH { print "demolishing...\n"; } 1; #### #!/usr/bin/perl use warnings; sub foo { my $name = shift; if(my $ref = *{$name}{CODE}) { print "ref = $ref\n"; } } BEGIN { foo('bar'); } #### Name "main::bar" used only once: possible typo at ./test2.pl line 6. #### #!/usr/bin/perl use warnings; sub foo { my $name = shift; if(my $ref = *{$name}{CODE}) { print "ref = $ref\n"; } } foo('bar'); #### #!/usr/bin/perl use warnings; sub foo { my $name = shift; if(my $ref = *{$name}{CODE}) { print "ref = $ref\n"; } } BEGIN { foo('bar'); foo('bar'); } #### #!/usr/bin/perl use warnings; sub foo { my $name = shift; if(my $ref = *{$name}{CODE}) { print "ref = $ref\n"; } } BEGIN { foo('bar'); foo('baz'); } #### Name "main::bar" used only once: possible typo at ./test2.pl line 6. Name "main::baz" used only once: possible typo at ./test2.pl line 6. #### #!/usr/local/bin/perl # { use warnings; $foo = 1; $bar = 1; } { no warnings; $foo = 1; $baz = 1; } #### Name "main::bar" used only once: possible typo at ./test3.pl line 7.