File Coverage

blib/lib/Net/Async/Beanstalk/Constant.pm
Criterion Covered Total %
statement 27 27 100.0
branch n/a
condition n/a
subroutine 9 9 100.0
pod n/a
total 36 36 100.0


line stmt bran cond sub pod time code
1             package Net::Async::Beanstalk::Constant;
2              
3             our $VERSION = '0.001';
4             $VERSION = eval $VERSION;
5              
6 3     3   19 use Exporter ();
  3         7  
  3         860  
7             our @ISA = qw(Exporter);
8              
9             our @EXPORT_OK = qw(
10             $NL
11             %COMMAND
12             %RESPONSE
13             @GENERAL
14             @WITHDATA
15             %STATE_CAN
16             STATE_FUTURE
17             STATE_MOAR
18             STATE_RECEIVE
19             STATE_SEND
20             STATE_COMMAND
21             STATE_DATUM
22             ERROR_EVENT
23             ERROR_FAIL
24             );
25              
26             our %EXPORT_TAGS = (
27             all => \@EXPORT_OK,
28             receive => [qw($NL %RESPONSE @GENERAL @WITHDATA ERROR_EVENT ERROR_FAIL)],
29             send => [qw($NL %COMMAND)],
30             state => [qw(%STATE_CAN STATE_FUTURE STATE_MOAR STATE_RECEIVE
31             STATE_SEND STATE_COMMAND STATE_DATUM)],
32             );
33              
34             our $NL = "\x0d\x0a";
35              
36             our %COMMAND = (
37             bury => [qw(BURIED NOT_FOUND)],
38             delete => [qw(DELETED NOT_FOUND)],
39             ignore => [qw(NOT_IGNORED WATCHING)],
40             'kick-job' => [qw(KICKED NOT_FOUND)],
41             kick => [qw(KICKED)],
42             'list-tubes' => [qw(OK)],
43             'list-tubes-watched' => [qw(OK)],
44             'list-tube-used' => [qw(USING)],
45             'pause-tube' => [qw(NOT_FOUND PAUSED)],
46             peek => [qw(FOUND NOT_FOUND)],
47             'peek-buried' => [qw(FOUND NOT_FOUND)],
48             'peek-delayed' => [qw(FOUND NOT_FOUND)],
49             'peek-ready' => [qw(FOUND NOT_FOUND)],
50             put => [qw(BURIED DRAINING EXPECTED_CRLF INSERTED JOB_TOO_BIG)],
51             quit => [],
52             release => [qw(BURIED NOT_FOUND RELEASED)],
53             reserve => [qw(DEADLINE_SOON RESERVED)],
54             'reserve-with-timeout'=> [qw(DEADLINE_SOON RESERVED TIMED_OUT)],
55             stats => [qw(OK)],
56             'stats-job' => [qw(NOT_FOUND OK)],
57             'stats-tube' => [qw(NOT_FOUND OK)],
58             touch => [qw(NOT_FOUND TOUCHED)],
59             use => [qw(USING)],
60             watch => [qw(WATCHING)],
61             );
62              
63             my @GENERAL = qw(
64             BAD_FORMAT
65             INTERNAL_ERROR
66             OUT_OF_MEMORY
67             UNKNOWN_COMMAND
68             );
69              
70             our %RESPONSE = map {+($_=>1)} @GENERAL, map {@$_} values %COMMAND;
71              
72             our @WITHDATA = qw(FOUND OK RESERVED);
73              
74             our %STATE_CAN;
75             for my $command (keys %COMMAND) {
76             $STATE_CAN{$command}{$_} = 1 for @{ $COMMAND{$command} };
77             }
78              
79 3     3   21 use constant STATE_FUTURE => 0;
  3         6  
  3         157  
80 3     3   21 use constant STATE_MOAR => 1;
  3         5  
  3         149  
81 3     3   18 use constant STATE_RECEIVE => 2;
  3         6  
  3         157  
82 3     3   16 use constant STATE_SEND => 3;
  3         6  
  3         133  
83 3     3   17 use constant STATE_COMMAND => 4;
  3         6  
  3         120  
84 3     3   16 use constant STATE_DATUM => 5;
  3         11  
  3         128  
85              
86 3     3   16 use constant ERROR_EVENT => 0x1;
  3         7  
  3         144  
87 3     3   17 use constant ERROR_FAIL => 0x2;
  3         5  
  3         1041  
88              
89             1;