in reply to Parsing barewords as sub/method calls?
In the case of arguments for a undeclared bareword putting parens around them is mostly acceptable (syntactically sweet enough)
And without arguments prepending an ampersand helps.
This works w/o messing with strict.
use strict; use warnings; use feature 'say'; our $AUTOLOAD; sub AUTOLOAD { say "Autoload called as $AUTOLOAD(@_)" } BLA(1,2,3); &BLA; no strict 'refs'; #&BLA 1,2,3; __END__ Autoload called as main::BLA(1 2 3) Autoload called as main::BLA()
Cheers Rolf
( addicted to the Perl Programming Language)
thanks for pointing out the special meaning of &NAME;, I was aware of it and as Eily pointed out, it's not a problem in this special case.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Parsing barewords as sub/method calls? (workaround)
by Corion (Patriarch) on Nov 23, 2013 at 17:14 UTC | |
|
Re^2: Parsing barewords as sub/method calls? (workaround)
by Eily (Monsignor) on Nov 23, 2013 at 17:21 UTC |