line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MooX::Options::Actions::Builder; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
534
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
25
|
|
4
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
22
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
4
|
use base qw/ Exporter /; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
190
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our @EXPORT_OK = qw/ new_with_actions /; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 NAME |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
MooX::Options::Actions::Builder - Builder class for MooX::Options::Actions |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 SYNOPSIS |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
use Moo; |
17
|
|
|
|
|
|
|
use MooX::Options::Actions::Builder qw/ new_with_actions /; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 DESCRIPTION |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
Used for holding the main builder code for MooX::Options::Actions - can |
22
|
|
|
|
|
|
|
also be used to set up a simple commandline application using Moo classes. |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=cut |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub new_with_actions { |
27
|
3
|
|
|
3
|
0
|
14425
|
my $class = shift; |
28
|
|
|
|
|
|
|
|
29
|
3
|
|
|
|
|
12
|
my $self = $class->new_with_options(@_); |
30
|
|
|
|
|
|
|
|
31
|
3
|
|
|
|
|
5411
|
my ( $cmd, @extra ) = @ARGV; |
32
|
|
|
|
|
|
|
|
33
|
3
|
100
|
|
|
|
24
|
die "Must supply a command\n" unless $cmd; |
34
|
2
|
50
|
|
|
|
7
|
die "Extra commands found - Please provide only one!\n" if @extra; |
35
|
2
|
50
|
|
|
|
16
|
die "No such command ${cmd} \n" unless $self->can("cmd_${cmd}"); |
36
|
|
|
|
|
|
|
|
37
|
2
|
|
|
|
|
5
|
$self->${\"cmd_${cmd}"}; |
|
2
|
|
|
|
|
11
|
|
38
|
|
|
|
|
|
|
|
39
|
2
|
|
|
|
|
13
|
return $self; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 AUTHOR |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
Tom Bloor Et.bloor@shadowcat.co.ukE |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 COPYRIGHT |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Copyright 2017- Tom Bloor |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 LICENSE |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
53
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 SEE ALSO |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
L |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=cut |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
1; |