in reply to MooseX::GetOpt disable in role
You haven't posted the code for your disable_getopt_attribute function, but I guess it looks a little like this:
package My::App; use Moose::Role; # ... etc sub disable_getopt_attribute { has("+$_", traits => ['NoGetopt']) for @_; }
And you're calling it like this from classes:
package My::Script; use Moose; with "My::App"; My::App::disable_getopt_attribute(qw/ foo bar /);
Try changing the definition to this:
package My::App; use Moose::Role; # ... etc sub disable_getopt_attribute { my $class = shift; my $has = $class->can("has"); $has->("+$_", traits => ['NoGetopt']) for @_; }
And calling it like this:
package My::Script; use Moose; with "My::App"; __PACKAGE__->disable_getopt_attribute(qw/ foo bar /);
This way, the has function that gets called, is My::Script's copy of has; not My::App's copy of it.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: MooseX::GetOpt disable in role
by Boldra (Curate) on Jun 21, 2013 at 11:54 UTC | |
Re^2: MooseX::GetOpt disable in role
by markjugg (Curate) on Aug 06, 2013 at 19:25 UTC |