1MooseX::Role::Cmd::MetaU:s:eArttCroinbturtieb:uM:toTeordsaeiPXte:(r:3lR)oDloec:u:mCemndt:a:tMieotna::Attribute::Trait(3)
2
3
4

NAME

6       MooseX::Role::Cmd::Meta::Attribute::Trait - Optional meta attribute
7       trait for custom option names
8

SYNOPSIS

10           package MyApp::Cmd::SomeScript;
11
12           with 'MooseX::Role::Cmd';
13
14           has 'basic'   => (
15               isa             => 'Str',
16               is              => 'rw',
17           );
18
19           has 'prefix'   => (
20               traits          => [ 'CmdOpt' ],
21               isa             => 'Str',
22               is              => 'rw',
23               cmdopt_prefix   => '-',
24           );
25
26           has 'rename'   => (
27               traits          => [ 'CmdOpt' ],
28               isa             => 'Str',
29               is              => 'rw',
30               cmdopt_name     => '+alt_name',
31           );
32
33
34           $cmd = MyApp::Cmd::SomeScript->new( basic => 'foo', prefix => 'bar', rename => 'foobar' );
35
36           $cmd->run();
37
38           # somescript --basic foo -prefix bar +alt_name foobar
39

DESCRIPTION

41       Provides some extra markup to help MooseX::Role::Cmd decide how to use
42       command line parameters.
43

ATTRIBUTES

45   cmdopt_prefix
46       Forces the command prefix to be a certain character. This was
47       introduced to allow parameters to be specified as "-param" or "--param"
48
49   has_cmdopt_prefix
50       Test for attribute above
51
52   cmdopt_name
53       Forces the command options name to be the passed string. This was
54       introduced to allow parameters to have a different name to the
55       attribute.
56
57       This option will override the cmdopt_prefix attribute.
58
59   has_cmdopt_name
60       Test for attribute above
61
62   cmdopt_env
63       This attribute trait can be used to specify an environment variable
64       rather than a command line option.
65
66           has 'home_dir' => (
67               traits => [ 'CmdOpt' ],
68               is => 'rw',
69               isa => 'Str',
70               cmdopt_env => 'APP_HOME',
71               default => '/my/app/home'
72           );
73
74           # $ENV{APP_HOME} = /my/app/home
75
76   has_cmdopt_env
77       Test for attribute above
78

BUGS

80       All complex software has bugs lurking in it, and this module is no
81       exception. If you find a bug please either email me, or add the bug to
82       cpan-RT.
83

AUTHOR

85       Ian Sillitoe <ian.sillitoe@gmail.com>
86

SEE ALSO

88       The idea for this code was ripped kicking and screaming from
89       MooseX::Getopt::Meta::Attribute::Trait
90
92       This library is free software; you can redistribute it and/or modify it
93       under the same terms as Perl itself.
94
95
96
97perl v5.30.1                      2M0o2o0s-e0X1:-:3R0ole::Cmd::Meta::Attribute::Trait(3)
Impressum