std3rr has asked for the wisdom of the Perl Monks concerning the following question:
Hi!
I used to use the Want module to check if Im in the middle or at the last of chain of autoloaded methods. Then I realized it did'nt work under threads.
Is there any other way to find out if Im on a tail-method?example:
With want() I used to test for "OBJECT", but as it fails under threads, I wonder if there are any neat and maybe simpler alternatives?use strict; package FOO { use Want; sub AUTOLOAD { print "@{[our $AUTOLOAD]}\n"; print " ..and Im a tail!\n" if not want "OBJECT"; return $_[0] || bless {}; } } FOO->funky->node->blaah;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Finding the end of a method-chain
by Eily (Monsignor) on Nov 06, 2013 at 13:43 UTC | |
by std3rr (Novice) on Nov 07, 2013 at 08:02 UTC | |
by Eily (Monsignor) on Nov 07, 2013 at 14:09 UTC | |
by std3rr (Novice) on Nov 08, 2013 at 14:05 UTC | |
Re: Finding the end of a method-chain
by DrHyde (Prior) on Nov 11, 2013 at 11:31 UTC |
Back to
Seekers of Perl Wisdom