Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: DESTROY and AUTOLOAD in 5.20.1

by Anonymous Monk
on Apr 24, 2015 at 18:05 UTC ( [id://1124591]=note: print w/replies, xml ) Need Help??


in reply to DESTROY and AUTOLOAD in 5.20.1

"Fascinating," as Mr. Spock would say.

I do not understand it either, but I can say from experimentation that DESTROY() stopped getting dispatched through AUTOLOAD() starting with Perl 5.18.0. Perl 5.16.3 shows the behavior we both expect. I no longer have 5.17.* available for testing.

Now, perl5180delta does not contain the word "DESTROY". But perl5200delta notes a bug fix to a change in DESTROY() dispatching that was introduced in 5.18. I wonder if this behavior was introduced at the same time. I also wonder whether this is a bug or a feature. My vote is for the former, based on the principal of least surprise.

A separate surprising thing (at least to me) is that your code declares DESTROY as though it were a scheduled block, not a subroutine. Well, that in itself does not surprise me, the surprising thing to me is that it works when declared this way. The perlsub documentation refers me to perloo for DESTROY(), and perloo declares it as a subroutine. But the "scheduled block" syntax (i.e. no "sub" keyword) works for every Perl I tried, all the way back to 5.6.2.

-- Tom Wyant

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1124591]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (9)
As of 2024-04-18 17:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found