Maroš Kollár > MooseX-App-1.16 > MooseX::App::Role

Download:
MooseX-App-1.16.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Source   Latest Release: MooseX-App-1.28

NAME ^

MooseX::App::Role - Define attributes in a role

SYNOPSIS ^

 package MyApp::Role::SomeRole;
 
 use Moose::Role; # optional
 use MooseX::App::Role;
 
 option 'testattr' => (
    isa             => 'rw',
    cmd_tags        => [qw(Important! Nice))],
 );

DESCRIPTION ^

When loading this package in a role you can use the cmd_tags attribute to document an attribute and declare attributes with the 'option' keyword.

Alternatively you can also just use attribute traits:

 has 'testattr' => (
    isa             => 'rw',
    traits          => ['AppOption'],
    cmd_option      => 1,
    cmd_tags        => [qw(Important! Nice))],
 );
syntax highlighting: