line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Games::Lacuna::Task::Action; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
989
|
use 5.010; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
60
|
|
4
|
|
|
|
|
|
|
our $VERSION = $Games::Lacuna::Task::VERSION; |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
452
|
use Moose; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
with qw(Games::Lacuna::Task::Role::Client |
9
|
|
|
|
|
|
|
Games::Lacuna::Task::Role::Logger |
10
|
|
|
|
|
|
|
Games::Lacuna::Task::Role::Helper |
11
|
|
|
|
|
|
|
MooseX::Getopt); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
use Games::Lacuna::Task::Utils qw(class_to_name); |
14
|
|
|
|
|
|
|
use Try::Tiny; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has '+configdir' => ( |
17
|
|
|
|
|
|
|
required => 1, |
18
|
|
|
|
|
|
|
); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub BUILD {} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub execute { |
23
|
|
|
|
|
|
|
my ($self) = @_; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
my $client = $self->client(); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# Call lazy builder |
28
|
|
|
|
|
|
|
$client->client; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
my $command_name = class_to_name($self); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
try { |
33
|
|
|
|
|
|
|
local $SIG{INT} = sub { |
34
|
|
|
|
|
|
|
$self->abort('Aborted by user'); |
35
|
|
|
|
|
|
|
}; |
36
|
|
|
|
|
|
|
local $SIG{__WARN__} = sub { |
37
|
|
|
|
|
|
|
my $warning = $_[0]; |
38
|
|
|
|
|
|
|
chomp($warning) |
39
|
|
|
|
|
|
|
unless ref ($warning); # perl 5.14 ready |
40
|
|
|
|
|
|
|
$self->log('warn',$warning); |
41
|
|
|
|
|
|
|
}; |
42
|
|
|
|
|
|
|
$self->run(); |
43
|
|
|
|
|
|
|
} catch { |
44
|
|
|
|
|
|
|
$self->log('error',"An error occured while processing action %s: %s",$command_name,$_); |
45
|
|
|
|
|
|
|
}; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
return; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub run { |
51
|
|
|
|
|
|
|
my ($self) = @_; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
$self->abort('Abstract method <run> called in %s',__PACKAGE__); |
54
|
|
|
|
|
|
|
return; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
58
|
|
|
|
|
|
|
no Moose; |
59
|
|
|
|
|
|
|
1; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=encoding utf8 |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 NAME |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Games::Lacuna::Task::Action -Â Abstract action base class |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 SYNOPSIS |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
package Games::Lacuna::Task::Action::MyAction; |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
use Moose; |
73
|
|
|
|
|
|
|
extends qw(Games::Lacuna::Task::Action); |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 DESCRIPTION |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
All actions need to inherit from this class an implement a C<run> method |
78
|
|
|
|
|
|
|
or cosume a role that implements this method (such as |
79
|
|
|
|
|
|
|
L<Games::Lacuna::Task::Role::PlanetRun>) |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=cut |