blib/lib/Date/Simple/Fmt.pm

filter: Statementstmt 85.7% 18 / 21 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 62.5% 5 / 8 Podpod 100% 4 / 4 totaltotal 81.8% 27 / 33 CC 1 SCAR 3.2
CC
1
Cov
86%
d8
2.0
today
2.0
ymd
2.0
CRAP 1.4
« blib/lib/Date/Simple/D8.pm ↑ Summary Simple.xs »
1 package Date::Simple::Fmt;
2 3 ▶use Date::Simple 3;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 3 ▶use base qw/Date::Simple/;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use overload '""' => '_format';
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 3 *EXPORT = *Date::Simple::EXPORT;
7 3 *EXPORT_OK = *Date::Simple::EXPORT_OK;
8 3 *EXPORT_TAGS = *Date::Simple::EXPORT_TAGS;
9  
10 0 ▶sub d8 { shift->_d8(@_) }
Subroutine d8: not called CC=1 SCAR=6.9
Pod documented
11 0 ▶sub today { shift->_today(@_) }
Subroutine today: not called CC=1 SCAR=6.9
Pod documented
12 0 ▶sub ymd { shift->_ymd(@_) }
Subroutine ymd: not called CC=1 SCAR=6.9
Pod documented
13  
14 2 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
15 2 my ( $class, $fmt, @args ) = @_;
16 2 my $self = $class->SUPER::new(@args);
17 2 $self->default_format($fmt);
18 2 $self;
19 }
20  
21 2 ▶sub _format { shift->format() }
Subroutine _format: called CC=1 SCAR=0.0
22  
23 3 1;
24  
25 =head1 NAME
26  
27 Date::Simple::Fmt - Sub class of Date::Simple with per object level formatting for
28 overloaded stringification.
29  
30 =head1 SYNOPSIS
31  
32 use Date::Simple::Fmt;
33  
34 =head1 DESCRIPTION
35  
36 This module changes the default stringification behaviour of Date::Simple objects to
37 use the format() method instead. It also changes the behaviour of the constructor.
38  
39 =item Date::Simple::Fmt->new (FMT, [ARG, ...])
40  
41 =item date_fmt (FMT, [ARG, ...])
42  
43 Follows the same rules as for the equivelent method (new) and subroutine (date) in
44 Date::Simple except that the first argument is expected to be the default format for
45 the newly created object. It is this format that will be used when using overloaded
46 stringification or when not providing a format argument to the format() method.
47  
48 =head1 SEE ALSO
49  
50 L<Date::Simple> for full documentation.
51  
52 =cut
« blib/lib/Date/Simple/D8.pm ↑ Summary Simple.xs »