line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Toolforge::MixNMatch::Print::YearMonth; |
2
|
|
|
|
|
|
|
|
3
|
6
|
|
|
6
|
|
204310
|
use strict; |
|
6
|
|
|
|
|
29
|
|
|
6
|
|
|
|
|
143
|
|
4
|
6
|
|
|
6
|
|
25
|
use warnings; |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
131
|
|
5
|
|
|
|
|
|
|
|
6
|
6
|
|
|
6
|
|
770
|
use Error::Pure qw(err); |
|
6
|
|
|
|
|
18629
|
|
|
6
|
|
|
|
|
560
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = 0.03; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub print { |
11
|
7
|
|
|
7
|
1
|
15432
|
my $obj = shift; |
12
|
|
|
|
|
|
|
|
13
|
7
|
100
|
|
|
|
16
|
if (! defined $obj) { |
14
|
1
|
|
|
|
|
4
|
err "Object doesn't exist."; |
15
|
|
|
|
|
|
|
} |
16
|
6
|
100
|
|
|
|
27
|
if (! $obj->isa('Toolforge::MixNMatch::Object::YearMonth')) { |
17
|
1
|
|
|
|
|
3
|
err "Object isn't 'Toolforge::MixNMatch::Object::YearMonth'."; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
5
|
|
|
|
|
10
|
my $print = $obj->year.'/'.$obj->month.': '.$obj->count; |
21
|
|
|
|
|
|
|
|
22
|
5
|
|
|
|
|
72
|
return $print; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
1; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
__END__ |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=pod |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=encoding utf8 |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 NAME |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
Toolforge::MixNMatch::Print::YearMonth - Mix'n'match year/month structure print. |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 SYNOPSIS |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
use Toolforge::MixNMatch::Print::YearMonth qw(print); |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
my $print = print($obj); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 SUBROUTINES |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head2 C<print> |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
my $print = print($obj); |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
Print Toolforge::MixNMatch::Object::YearMonth instance to user output. |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Returns string. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 ERRORS |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
obj2struct(): |
56
|
|
|
|
|
|
|
Object doesn't exist. |
57
|
|
|
|
|
|
|
Object isn't 'Toolforge::MixNMatch::Object::YearMonth'. |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 EXAMPLE |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
use strict; |
62
|
|
|
|
|
|
|
use warnings; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
use Data::Printer; |
65
|
|
|
|
|
|
|
use Toolforge::MixNMatch::Object::YearMonth; |
66
|
|
|
|
|
|
|
use Toolforge::MixNMatch::Print::YearMonth; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
# Object. |
69
|
|
|
|
|
|
|
my $obj = Toolforge::MixNMatch::Object::YearMonth->new( |
70
|
|
|
|
|
|
|
'count' => 6, |
71
|
|
|
|
|
|
|
'month' => 9, |
72
|
|
|
|
|
|
|
'year' => 2020, |
73
|
|
|
|
|
|
|
); |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
# Print. |
76
|
|
|
|
|
|
|
print Toolforge::MixNMatch::Print::YearMonth::print($obj)."\n"; |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
# Output: |
79
|
|
|
|
|
|
|
# 2020/9: 6 |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 DEPENDENCIES |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
L<Error::Pure>. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 SEE ALSO |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=over |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=item L<Toolforge::MixNMatch::Print> |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
Toolforge Mix'n'match tool object print routines. |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=back |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 REPOSITORY |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
L<https://github.com/michal-josef-spacek/Toolforge-MixNMatch-Print> |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 AUTHOR |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Michal Josef Špaček L<mailto:skim@cpan.org> |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
L<http://skim.cz> |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
© Michal Josef Špaček 2020 |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
BSD 2-Clause License |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head1 VERSION |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
0.05 |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=cut |