Commit | Line | Data |
a7474a4d |
1 | package WithOptionsAndSimpleConfig; |
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 | has configfile => ( |
15 | traits => [qw(NoGetopt)], |
16 | isa => 'Str', |
17 | coerce => 1, |
18 | is => 'ro', |
19 | ); |
20 | |
21 | with 'MooseX::SimpleConfig'; |
22 | |
23 | sub run { |
24 | my ($self) = @_; |
25 | |
26 | if ($self->print_version) { |
27 | print "SUCCESS\n"; |
28 | exit; |
29 | } |
30 | } |
31 | |
32 | package main; |
33 | WithOptionsAndSimpleConfig->new_with_options; |