File Coverage

blib/lib/SWIFT/Factory/Tag/Tag30.pm
Criterion Covered Total %
statement 17 29 58.6
branch 0 4 0.0
condition n/a
subroutine 6 10 60.0
pod 3 3 100.0
total 26 46 56.5


line stmt bran cond sub pod time code
1             package SWIFT::Factory::Tag::Tag30;
2 1     1   11168 use strict;
  1         2  
  1         40  
3 1     1   6 use warnings;
  1         2  
  1         38  
4              
5 1     1   18 use vars qw($VERSION);
  1         14  
  1         91  
6             $VERSION='0.01';
7              
8             # Two potentially overridden class methods.
9 1     1   6 use constant TAG_ID=>'';
  1         2  
  1         88  
10 1     1   5 use constant FIGURES_IN_YEAR=>2;
  1         2  
  1         80  
11              
12             BEGIN{
13 1     1   3 *provide=*string;
14 1         355 *borken=*invalid;
15             }
16              
17             ###########################################################################################################
18             # Class method, potentially overridden.
19             sub new {
20 0     0 1   my$self={};
21 0           bless($self,shift())->_init(@_);
22             }
23              
24             ###########################################################################################################
25             # Object method, potentially overridden.
26             # The class cannot guarantee that the TAG will be valid in the SWIFT network.
27             # It can point out that it's found some invalid data, though.
28             # Return number of problems detected.
29             sub invalid {
30 0     0 1   my$self=shift;
31              
32             # Implement verifications here!
33 0           0;
34             }
35              
36             ###########################################################################################################
37             # Object method, potentially overridden.
38             sub string {
39 0     0 1   my$self=shift;
40 0           ':30'.
41             $self->TAG_ID.
42             ':'.
43             sprintf("%0".$self->FIGURES_IN_YEAR."u",$self->{YEAR}).
44             sprintf("%02u",$self->{MONTH}).
45             sprintf("%02u",$self->{DAY}).
46             chr(13). # CR
47             chr(10); # LF
48             }
49              
50             ###########################################################################################################
51             ###########################################################################################################
52             #
53             # 'Internal' subs. Don't call these since they may, and will, change without notice.
54             #
55             ###########################################################################################################
56             ###########################################################################################################
57              
58             ###########################################################################################################
59             # Object method, potentially overridden.
60             sub _init {
61 0     0     my$self=shift();
62 0           my%args=(
63             YEAR=>0,
64             MONTH=>0,
65             DAY=>0,
66             DO_CLEANUP=>0,
67             @_);
68              
69 0 0         $self->{YEAR}=($args{DO_CLEANUP}?
    0          
70             (length($args{YEAR})>$self->FIGURES_IN_YEAR?
71             substr($args{YEAR},
72             length($args{YEAR})-$self->FIGURES_IN_YEAR,
73             $self->FIGURES_IN_YEAR):
74             $args{YEAR}):
75             $args{YEAR});
76 0           $self->{MONTH}=$args{MONTH};
77 0           $self->{DAY}=$args{DAY};
78 0           $self;
79             }
80              
81             ###########################################################################################################
82             'Choppers rule';
83             __END__