It helps to read the core modules whenever one does something contained therein in a different way. The source of AutoLoader gives a clue: The DESTROY symbol is handled specially...
AUTOLOAD { my $sub = $AUTOLOAD; my $filename = AutoLoader::find_filename( $sub ); my $save = $@; local $!; # Do not munge the value. eval { local $SIG{__DIE__}; require $filename }; if ($@) { if (substr($sub,-9) eq '::DESTROY') { no strict 'refs'; *$sub = sub {}; $@ = undef; } elsif ($@ =~ /^Can't locate/) { # The load might just have failed because the filename was + too # long for some old SVR3 systems which treat long names as + errors. # If we can successfully truncate a long name then it's wo +rth a go. # There is a slight risk that we could pick up the wrong f +ile here # but autosplit should have warned about that when splitti +ng. if ($filename =~ s/(\w{12,})\.al$/substr($1,0,11).".al"/e) +{ eval { local $SIG{__DIE__}; require $filename }; } } if ($@){ $@ =~ s/ at .*\n//; my $error = $@; require Carp; Carp::croak($error); } } $@ = $save; goto &$sub; }
Reading that, one might conclude that object destruction could be an issue with AUTOLOAD blocks, not just dealing with composition ;-)
In reply to Re: Beware of object composition!
by shmem
in thread Beware of object composition!
by Jenda
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |