I was re-adapting error_interruption.t from Method::Signatures and noticed Function::Parameters has the same problem MS did but only if the signature is using types. The existing adaptation of error_interruption.t removed the type.
# in BarfyDie.pm
package BarfyDie;
use strict;
use Function::Parameters;
$foo = 'hi!';
method foo (Str $bar) {}
1;
If you load this directly, it throws the correct error message, but then it has some bogus error about type constraints.
$ perl -w ~/tmp/BarfyDie.pm
Global symbol "$foo" requires explicit package name at /Users/schwern/tmp/BarfyDie.pm line 7.
BEGIN not safe after errors--compilation aborted at /Users/schwern/perl5/perlbrew/perls/perl-5.18.1-thread/lib/site_perl/5.18.1/darwin-thread-multi-2level/Moose/Util/TypeConstraints.pm line 5.
Compilation failed in require at /Users/schwern/devel/Function-Parameters/blib/lib/Function/Parameters.pm line 58.
But if you load it as a module, it gives you a bogus error message about type constraints obscuring the real error.
$ perl -Mblib -I ~/tmp/ -wle 'require BarfyDie'
BEGIN not safe after errors--compilation aborted at /Users/schwern/perl5/perlbrew/perls/perl-5.18.1-thread/lib/site_perl/5.18.1/darwin-thread-multi-2level/Moose/Util/TypeConstraints.pm line 5.
Compilation failed in require at /Users/schwern/devel/Function-Parameters/blib/lib/Function/Parameters.pm line 58.
Compilation failed in require at -e line 1.
I suspect either an $@ is leaking out, or something is plowing ahead after the compilation has already failed.
If you remove the type constraint it works as expected.
I was re-adapting
error_interruption.t
from Method::Signatures and noticed Function::Parameters has the same problem MS did but only if the signature is using types. The existing adaptation oferror_interruption.t
removed the type.If you load this directly, it throws the correct error message, but then it has some bogus error about type constraints.
But if you load it as a module, it gives you a bogus error message about type constraints obscuring the real error.
I suspect either an
$@
is leaking out, or something is plowing ahead after the compilation has already failed.If you remove the type constraint it works as expected.