[Chicago-talk] Moose attributes and forwarding

Doug Bell madcityzen at gmail.com
Tue Jul 17 11:16:43 PDT 2012

I have an app using App::Cmd and MooseX::Getopt (together as
MooseX::App::Cmd) to fill in attributes from command-line options
using traits to denote which attributes are available as options and
which are not.

use Moose;
with "MooseX::Getopt";

has log_level => (
    is => 'ro',
    isa => 'Str',
    traits => [qw( Getopt )],

Now I'd like to delegate the log_level attribute to a Run object that
stores all the invocation and runtime configuration used to run my
app. However, using normal Moose delegation would remove the Getopt
trait from my attribute, and then it wouldn't get picked up by

Is there a way to specify an attribute and forward it to another
method? Would this be a trigger? Or a custom accessor? Could I create
a general trait to do this for me?

More information about the Chicago-talk mailing list