line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ABSTRACT: Base class for HiD commands |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package HiD::App::Command; |
5
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:GENEHACK'; |
6
|
|
|
|
|
|
|
$HiD::App::Command::VERSION = '1.991'; |
7
|
4
|
|
|
4
|
|
2526
|
use Moose; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
27
|
|
8
|
|
|
|
|
|
|
extends 'MooseX::App::Cmd::Command'; |
9
|
4
|
|
|
4
|
|
25687
|
use namespace::autoclean; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
33
|
|
10
|
|
|
|
|
|
|
|
11
|
4
|
|
|
4
|
|
355
|
use 5.014; # strict, unicode_strings |
|
4
|
|
|
|
|
12
|
|
12
|
4
|
|
|
4
|
|
18
|
use utf8; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
25
|
|
13
|
4
|
|
|
4
|
|
79
|
use autodie; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
26
|
|
14
|
4
|
|
|
4
|
|
19276
|
use warnings qw/ FATAL utf8 /; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
175
|
|
15
|
4
|
|
|
4
|
|
21
|
use open qw/ :std :utf8 /; |
|
4
|
|
|
|
|
12
|
|
|
4
|
|
|
|
|
26
|
|
16
|
4
|
|
|
4
|
|
608
|
use charnames qw/ :full /; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
30
|
|
17
|
|
|
|
|
|
|
|
18
|
4
|
|
|
4
|
|
1808
|
use HiD; |
|
4
|
|
|
|
|
12
|
|
|
4
|
|
|
|
|
1828
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
has config_file => ( |
22
|
|
|
|
|
|
|
is => 'ro' , |
23
|
|
|
|
|
|
|
isa => 'Str' , |
24
|
|
|
|
|
|
|
cmd_aliases => 'f' , |
25
|
|
|
|
|
|
|
traits => [ qw/ Getopt / ] , |
26
|
|
|
|
|
|
|
default => '_config.yml' , |
27
|
|
|
|
|
|
|
); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
has hid => ( |
30
|
|
|
|
|
|
|
is => 'ro' , |
31
|
|
|
|
|
|
|
isa => 'HiD' , |
32
|
|
|
|
|
|
|
lazy => 1 , |
33
|
|
|
|
|
|
|
traits => [ qw/ NoGetopt/ ] , |
34
|
|
|
|
|
|
|
init_arg => undef , |
35
|
|
|
|
|
|
|
clearer => '_clear_hid' , |
36
|
|
|
|
|
|
|
predicate => '_has_hid' , |
37
|
|
|
|
|
|
|
builder => '_build_hid' , |
38
|
|
|
|
|
|
|
handles => [ |
39
|
|
|
|
|
|
|
'all_objects' , |
40
|
|
|
|
|
|
|
'config' , |
41
|
|
|
|
|
|
|
'destination' , |
42
|
|
|
|
|
|
|
'publish' , |
43
|
|
|
|
|
|
|
] , |
44
|
|
|
|
|
|
|
); |
45
|
|
|
|
|
|
|
|
46
|
19
|
|
|
19
|
|
471
|
sub _build_hid { HiD->new( shift->hid_config ) } |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
has hid_config => ( |
49
|
|
|
|
|
|
|
is => 'ro' , |
50
|
|
|
|
|
|
|
isa => 'HashRef' , |
51
|
|
|
|
|
|
|
traits => [ qw/ NoGetopt / ] , |
52
|
|
|
|
|
|
|
init_arg => undef , |
53
|
|
|
|
|
|
|
writer => '_set_hid_config' , |
54
|
|
|
|
|
|
|
); |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub execute { |
57
|
22
|
|
|
22
|
1
|
477
|
my( $self , $opts , $args ) = @_; |
58
|
|
|
|
|
|
|
|
59
|
22
|
50
|
|
|
|
82
|
if ( $opts->{help_flag} ) { |
60
|
0
|
|
|
|
|
0
|
print $self->usage->text; |
61
|
0
|
|
|
|
|
0
|
exit; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
22
|
|
|
|
|
79
|
my $hid_config = { cli_opts => $opts }; |
65
|
22
|
100
|
|
|
|
193
|
if ( $self->isa( 'HiD::App::Command::init')) { |
66
|
|
|
|
|
|
|
$hid_config->{config} = {}, |
67
|
3
|
|
|
|
|
8
|
} |
68
|
|
|
|
|
|
|
else { |
69
|
19
|
|
|
|
|
566
|
$hid_config->{config_file} = $self->config_file |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
22
|
|
|
|
|
631
|
$self->_set_hid_config( $hid_config ); |
73
|
|
|
|
|
|
|
|
74
|
22
|
|
|
|
|
125
|
$self->_run( $opts , $args ); |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub reset_hid { |
79
|
0
|
|
|
0
|
1
|
|
my( $self ) = @_; |
80
|
|
|
|
|
|
|
|
81
|
0
|
0
|
|
|
|
|
$self->_clear_hid() if $self->_has_hid(); |
82
|
|
|
|
|
|
|
|
83
|
0
|
|
|
|
|
|
return $self->hid(); |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
87
|
|
|
|
|
|
|
1; |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
__END__ |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=pod |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=encoding UTF-8 |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 NAME |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
HiD::App::Command - Base class for HiD commands |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 SYNOPSIS |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
package HiD::App::Command::my_awesome_command; |
102
|
|
|
|
|
|
|
use Moose; |
103
|
|
|
|
|
|
|
extends 'HiD::App::Command'; |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
sub _run { |
106
|
|
|
|
|
|
|
my( $self , $opts , $args ) = @_; |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
# do whatcha like |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
1; |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 DESCRIPTION |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
Base class for implementing subcommands for L<hid>. Provides basic attributes |
116
|
|
|
|
|
|
|
like C<--config_file>. If you're going to write a sub-command, you want to |
117
|
|
|
|
|
|
|
base it on this class. |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head2 config_file |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
Path to config file. |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
Defaults to './_config.yml' |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head1 METHODS |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=head2 reset_hid |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
Clear out the existing L<HiD> object attribute, generate a fresh one with the |
132
|
|
|
|
|
|
|
stored configuration information, and return it. |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head1 VERSION |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
version 1.991 |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head1 AUTHOR |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
John SJ Anderson <genehack@genehack.org> |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
This software is copyright (c) 2015 by John SJ Anderson. |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
147
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=cut |