File Coverage

blib/lib/Data/Conveyor/Ticket/Payload/Common.pm
Criterion Covered Total %
statement 20 21 95.2
branch 2 4 50.0
condition n/a
subroutine 8 9 88.8
pod 4 4 100.0
total 34 38 89.4


line stmt bran cond sub pod time code
1 1     1   690 use 5.008;
  1         5  
  1         41  
2 1     1   9 use strict;
  1         2  
  1         40  
3 1     1   6 use warnings;
  1         3  
  1         60  
4              
5             package Data::Conveyor::Ticket::Payload::Common;
6             BEGIN {
7 1     1   24 $Data::Conveyor::Ticket::Payload::Common::VERSION = '1.103130';
8             }
9             # ABSTRACT: Stage-based conveyor-belt-like ticket handling system
10              
11 1     1   6 use parent 'Data::Conveyor::Ticket::Payload::Item';
  1         2  
  1         8  
12             __PACKAGE__->mk_scalar_accessors(qw(log_level))->mk_framework_object_accessors(
13             value_ticket_rc => 'default_rc',
14             value_ticket_status => 'default_status',
15             );
16              
17             sub DEFAULTS {
18 1     1 1 1053 ( default_rc => $_[0]->delegate->RC_OK,
19             default_status => $_[0]->delegate->TS_RUNNING,
20             );
21             }
22 0     0 1 0 sub check { }
23              
24             # A stage can set the default rc (barring any exceptions) in the common
25             # payload item's; it will be applied in rc(). Ditto for status().
26             sub rc {
27 5     5 1 11 my ($self, $ticket) = @_;
28 5         32 my $rc = $self->SUPER::rc($ticket);
29 5 50       18 $rc += $self->default_rc if defined $self->default_rc;
30             }
31              
32             sub status {
33 6     6 1 10 my ($self, $ticket) = @_;
34 6         33 my $status = $self->SUPER::status($ticket);
35 6 50       20 $status += $self->default_status if defined $self->default_status;
36             }
37             1;
38              
39              
40             __END__