Skip Menu |

This queue is for tickets about the signatures CPAN distribution.

Report information
The Basics
Id: 47168
Status: open
Priority: 0/
Queue: signatures

People
Owner: Nobody in particular
Requestors: mschwern [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 0.05
Fixed in: (no value)



Subject: signatures before Test::More doesn't work
#!/usr/bin/perl -w use signatures; use Test::More; sub foo ($arg) { return $arg; } is foo(42), 43; done_testing(); __END__ Not enough arguments for main::foo at /Users/schwern/tmp/test.plx line 10, near "42)" Execution of /Users/schwern/tmp/test.plx aborted due to compilation errors. If I reverse the order of loading Test::More and signatures it works.
The problem appears to be that signatures is leaking into evals which happen at compile time. $ cat eval.pl eval q{ sub foo($arg) { return $arg + 1; } }; 1; $ cat test.plx #!/usr/bin/perl -w use signatures; BEGIN { require "./eval.pl"; } print foo(42), "\n"; $ perl test.plx 43 That should not work. Remove the BEGIN block and it fails as expected due to signature's lexical nature. $ perl test.plx Illegal character in prototype for main::foo : $arg at (eval 14) line 2. Use of uninitialized value $arg in addition (+) at (eval 14) line 3. 1