Commit | Line | Data |
---|---|---|
a7474a4d | 1 | package WithOptions; |
2 | use Moose; | |
3 | ||
4 | with 'MooseX::Getopt'; | |
5 | ||
6 | has print_version => ( | |
7 | traits => [qw(Getopt)], | |
8 | isa => 'Bool', | |
9 | is => 'ro', | |
10 | cmd_flag => 'version', | |
11 | cmd_aliases => 'v', | |
12 | ); | |
13 | ||
14 | sub run { | |
15 | my ($self) = @_; | |
16 | ||
17 | if ($self->print_version) { | |
18 | print "SUCCESS\n"; | |
19 | exit; | |
20 | } | |
21 | } | |
22 | ||
23 | package main; | |
24 | WithOptions->new_with_options; |