You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use MooseX::Declare;
role X (Str :$role) {
has "x_$role" => (
is => 'ro',
isa => 'Str',
lazy => 1,
default => sub { 'junk' },
init_arg => undef,
);
method "print_x_$role" () {
my $c = $role;
print $c, "\n";
}
}
1;
main:
use MooseX::Declare;
use Method::Signatures::Modifiers;
class Z {
with 'X' => {role => 'test'};
method roller { '' }
}
my $a = Z->new;
$a->print_x_test;
If you comment out "use Method::Signatures::Modifiers" and run "perl main", it works fine. If you run as is, you get:
"my" variable $role masks earlier declaration in same scope at X.pm line 13.
"my" variable $c masks earlier declaration in same statement at X.pm line 14.
Type of arg 1 to X::method must be block or sub {} (not string) at X.pm line 12, near ""print_x_$role" ("
syntax error at X.pm line 12, near ""print_x_$role" ("
The text was updated successfully, but these errors were encountered:
METHOD_SIGNATURES_DEBUG=1 perl test.plx
DEBUG: attributes:
DEBUG: inject: BEGIN { Method::Signatures::Modifiers->inject_scope('') }; my $self = shift; Method::Signatures::Modifiers->too_many_args_error(0) if @_ > 0;
DEBUG: before: sub
DEBUG: linestr before: method { '' }
DEBUG: linestr after: method sub { BEGIN { Method::Signatures::Modifiers->inject_scope('') }; my $self = shift; Method::Signatures::Modifiers->too_many_args_error(0) if @_ > 0; '' }
DEBUG: attributes:
DEBUG: inject: my $self = shift; Method::Signatures::Modifiers->too_many_args_error(0) if @_ > 0;
DEBUG: before: sub
DEBUG: linestr before: method "print_x_$role" () {
DEBUG: linestr after: method "print_x_$role" () {
"my" variable $role masks earlier declaration in same scope at X.pm line 13.
"my" variable $c masks earlier declaration in same statement at X.pm line 14.
Type of arg 1 to X::method must be block or sub {} (not string) at X.pm line 12, near ""print_x_$role" ("
syntax error at X.pm line 12, near ""print_x_$role" ("
BEGIN not safe after errors--compilation aborted at X.pm line 15.
Compilation failed in require at test.plx line 5.
Somehow Method::Signatures::Modifiers is getting involved with the compilation of method "print_x_$role". Seems like that should be out of its scope!
X.pm:
main:
If you comment out "use Method::Signatures::Modifiers" and run "perl main", it works fine. If you run as is, you get:
"my" variable $role masks earlier declaration in same scope at X.pm line 13.
"my" variable $c masks earlier declaration in same statement at X.pm line 14.
Type of arg 1 to X::method must be block or sub {} (not string) at X.pm line 12, near ""print_x_$role" ("
syntax error at X.pm line 12, near ""print_x_$role" ("
The text was updated successfully, but these errors were encountered: