I am trying to use Moose, MooseX::Declare, and MooseX::MethodAttributes to be able to use class
and method
keywords instead of package
and sub
and at the same time get the methods attributes, so I need this form of packages and methods:
class Moosey {
method connect ($user, $pass) : Action GET {...}
}
If I use sub
keyword it will work with attributes but of course no method signatures, If I use method
keyword, it will hang the script if I use method attributes.
Below is the code I am trying:
package Moosey;
use Moose;
use MooseX::Declare;
use MooseX::MethodAttributes;
class Moosey {
# this works fine
sub moosey : Action { print "moosey called"; }
# this line hangs the script
# Error: Can't locate object method "attributes" via package "MooseX::Method::Signatures::Meta::Method"
#method moosey : Action { print "moosey called"; }
# this also does not work
#method moosey : Get ($name, $email) { print "moosey called"; }
}
1;
my $class = Moosey->new;
my $attrs = $class->meta->get_method('moosey')->attributes;
print "@$attrs";
My question is does these Moose modules allows me to do this.