File Coverage

blib/lib/Class/Scaffold/Context.pm
Criterion Covered Total %
statement 19 22 86.3
branch 1 6 16.6
condition n/a
subroutine 6 7 85.7
pod 2 2 100.0
total 28 37 75.6


line stmt bran cond sub pod time code
1 2     2   1446 use 5.008;
  2         9  
  2         95  
2 2     2   13 use warnings;
  2         5  
  2         87  
3 2     2   12 use strict;
  2         4  
  2         131  
4              
5             package Class::Scaffold::Context;
6             BEGIN {
7 2     2   44 $Class::Scaffold::Context::VERSION = '1.102280';
8             }
9             # ABSTRACT: Holds execution and job context
10 2     2   12 use parent 'Class::Scaffold::Base';
  2         13  
  2         17  
11             __PACKAGE__->mk_scalar_accessors(qw(execution job));
12              
13             # types of execution context: cron, apache, shell, soap
14             # types of job context: mail, sif, epp
15             # takes something like 'run/epp' and sets execution and job context
16             sub parse_context {
17 2     2 1 36 my ($self, $spec) = @_;
18 2 50       15 if ($spec =~ m!^(\w+)/(\w+)$!) {
19 2         11 my ($job, $execution) = ($1, $2);
20 2         10 $self->execution($execution);
21 2         20 $self->job($job);
22             } else {
23 0         0 throw Error::Hierarchy::Internal::CustomMessage(
24             custom_message => "Invalid context specification [$spec]",);
25             }
26 2         23 $self;
27             }
28              
29             sub as_string {
30 0     0 1   my $self = shift;
31 0 0         sprintf '%s/%s',
    0          
32             (defined $self->job ? $self->job : 'none'),
33             (defined $self->execution ? $self->execution : 'none');
34             }
35             1;
36              
37              
38             __END__