On Tue Oct 30 18:42:32 2012, MAUKE wrote:
Show quoted text> $ cat bug/sub-declaration
> #!perl
> use Method::Signatures::Simple;
> func id_1($x) { $x }
> id_1 42;
> __END__
> $ perl bug/sub-declaration
> Number found where operator expected at bug/sub-declaration line 4,
near
Show quoted text> "id_1 42"
> (Do you need to predeclare id_1?)
> syntax error at bug/sub-declaration line 4, near "id_1 42"
> Execution of bug/sub-declaration aborted due to compilation errors.
>
> Method::Signatures::Simple doesn't let you omit parentheses in calls
to
Show quoted text> subs declared with it.
> It works if you add parens to the call: id_1(42);
This is a consequence of MMS (and Devel::Declare) installing the subs at
runtime. You see the same in regular Perl:
perl -E 'x 3; sub x { }'
Number found where operator expected at -e line 1, near "x 3"
(Do you need to predeclare x?)
syntax error at -e line 1, near "x 3"
Execution of -e aborted due to compilation errors.
I'd have to use something like Devel::BeginLift to install the func's at
compile time. I'm not even sure MMS is the right spot to do that. It
might have to happen in Devel::Declare.
If you have a (working) patch, I'd be willing to incorporate it. The
repo is over at Github, in case you're interested.
rhesa