Subject: | Can't use new keyword as a method name |
If you create a new keyword with Devel::Declare you can no longer call a
method with the same name.
The following examples croak with the error:
Couldn't find declarator 'try' at
/Library/Perl/5.8.8/darwin-thread-multi-2level/Devel/Declare/Context/Simple.pm
line 39
(replace "try" with "method" in the second example)
# Example 1
use TryCatch;
sub foo {
my $bar = shift;
return $bar->try();
}
# Example 2
use MooseX::Declare;
class Foo {
has "method" => (is => ro, isa => Str, default => "foobar");
method bar {
print $self->method, "\n";
}
}
1;