File Coverage

blib/lib/Business/EDI/Segment/RFF.pm
Criterion Covered Total %
statement 26 32 81.2
branch 4 8 50.0
condition n/a
subroutine 5 6 83.3
pod 1 2 50.0
total 36 48 75.0


line stmt bran cond sub pod time code
1             package Business::EDI::Segment::RFF;
2              
3 2     2   3890 use strict;
  2         4  
  2         80  
4 2     2   11 use warnings;
  2         2  
  2         58  
5 2     2   10 use Carp;
  2         4  
  2         151  
6              
7 2     2   11 use base qw/Business::EDI::Segment/;
  2         17  
  2         881  
8              
9             our $VERSION = 0.02;
10              
11             our $debug = 0;
12             our $top = 'C506';
13             our @codes = (
14             'C506',
15             # 1153,
16             # 1154,
17             # 1156,
18             # 1060,
19             # 4000,
20             );
21             our @required_codes = (1153);
22              
23             sub carp_error {
24 0     0 0 0 carp __PACKAGE__ . ' : ' . shift;
25 0         0 return;
26             }
27              
28             sub new {
29 59     59 1 988 my $class = shift;
30 59         118 my $body = shift;
31 59 50       2918 unless ($body) {
32 0         0 return carp_error " new() called with EMPTY 1st argument";
33             }
34 59         416 my $obj = $class->SUPER::unblessed($body, \@codes, $debug);
35 59 50       203 unless ($obj) {
36 0         0 carp "Unblessed object creation failed";
37 0         0 return;
38             }
39 59         184 my $self = bless($obj, $class);
40 59 50       315 $self->spec or $self->spec('default');
41 59         216 $self->{code} = 'RFF';
42 59         226 $self->{label} = 'REFERENCE';
43 59         204 $self->{_permitted}->{label} = 1;
44 59         190 $self->{_permitted}->{code} = 1;
45             # print "blessed: " , Dumper($self); use Data::Dumper;
46 59         246 foreach (@required_codes) {
47 59 50       400 unless (defined $obj->part($top)->part($_)) {
48 0         0 return carp_error "Required field $top/$_ not populated";
49             }
50             }
51 59         301 return $self;
52             }
53              
54             1;
55             __END__