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

Download:
MooseX-App-1.30.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  0
View/Report Bugs
Source  

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 ^

Enables the 'option' and 'parameter' keywords in your roles.

Alternatively you can also just use attribute traits:

 has 'testattr' => (
    isa             => 'rw',
    traits          => ['AppOption'],   # required
    cmd_type        => 'option',        # required
    cmd_tags        => [qw(Important! Nice))],
 );
syntax highlighting: