lib/oEdtk/DateField.pm

filter: Statementstmt 100% 14 / 14 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod 100% 1 / 1 totaltotal 100% 19 / 19 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« lib/oEdtk/AddrField.pm ↑ Summary lib/oEdtk/Field.pm »
1 package oEdtk::DateField;
2  
3 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 3 ▶use base 'oEdtk::Field';
Subroutine BEGIN: called CC=1 SCAR=0.0
7 3 our $VERSION = 2.1131;
8  
9 3 ▶sub process {
Subroutine process: called CC=1 SCAR=0.0
Pod documented
10 3 my ( $self, $data ) = @_;
11  
12 3 $data =~ s/^(\d{4})(\d{2})(\d{2}).*$/$3\/$2\/$1/;
13 3 return $data;
14 }
15  
16 3 1;
17  
18 =head1 NAME
19  
20 oEdtk::DateField - date field: YYYYMMDD to DD/MM/YYYY
21  
22 =head1 SYNOPSIS
23  
24 use oEdtk::DateField;
25  
26 my $field = oEdtk::DateField->new('DATNAI', 8);
27 print $field->process('19700131'), "\n"; # '31/01/1970'
28  
29 =head1 DESCRIPTION
30  
31 An C<oEdtk::Field> subclass that rewrites a coded date C<YYYYMMDD> into the
32 display form C<DD/MM/YYYY>. Anything after the eight leading digits is dropped.
33  
34 =head1 METHODS
35  
36 =head2 process
37  
38 my $value = $field->process($data);
39  
40 Rewrite the leading eight digits of C<$data> as C<DD/MM/YYYY>.
41  
42 =head1 AUTHOR
43  
44 The oEdtk team.
45  
46 =cut
« lib/oEdtk/AddrField.pm ↑ Summary lib/oEdtk/Field.pm »