szabgab has asked for the wisdom of the Perl Monks concerning the following question:
and this module:use strict; use warnings; use 5.010; use Greeting; say 'Hi'; { my $g = Greeting->new; } say 'Bye';
I can see the word "destroy" printed as I would expect. However, if I remove the DESTROY from the module I don't see AUTOLOAD being called instead of the missing DESTROY. I only checked it with 5.20.1 but I wonder what am I missing here?package Greeting; use strict; use warnings; use 5.010; use Data::Dumper; sub new { my ($class) = @_; return bless {}, $class; } sub AUTOLOAD { our $AUTOLOAD; say $AUTOLOAD; } DESTROY { say 'destroy'; } 1;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: DESTROY and AUTOLOAD in 5.20.1
by kcott (Archbishop) on Apr 24, 2015 at 10:37 UTC | |
by szabgab (Priest) on Apr 25, 2015 at 07:08 UTC | |
|
Re: DESTROY and AUTOLOAD in 5.20.1
by choroba (Cardinal) on Apr 24, 2015 at 10:02 UTC | |
|
Re: DESTROY and AUTOLOAD in 5.20.1 (fixed bug)
by tye (Sage) on Apr 24, 2015 at 19:26 UTC | |
by szabgab (Priest) on Apr 24, 2015 at 21:22 UTC | |
by jeffa (Bishop) on Apr 24, 2015 at 21:39 UTC | |
by Anonymous Monk on Apr 24, 2015 at 22:58 UTC | |
|
Re: DESTROY and AUTOLOAD in 5.20.1
by Anonymous Monk on Apr 24, 2015 at 18:05 UTC |