line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mail::SNCF::Text; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
22532
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
63
|
|
4
|
2
|
|
|
2
|
|
11
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
65
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
11
|
use base qw/Mail::SNCF/; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
586
|
|
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
1412
|
use DateTime; |
|
2
|
|
|
|
|
240722
|
|
|
2
|
|
|
|
|
712
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 NAME |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Mail::SNCF::Text - Text output for SNCF |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 VERSION |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
Version 0.01 |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=cut |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 SYNOPSIS |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
This backend produces a pretty text output. |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
use Mail::SNCF; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
my $foo = Mail::SNCF::Text->parse("Mail/sncf"); |
30
|
|
|
|
|
|
|
my $s = $foo->as_string; |
31
|
|
|
|
|
|
|
$foo->print; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 FUNCTIONS |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head2 print |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=cut |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub print { |
40
|
0
|
|
|
0
|
1
|
0
|
my ($self) = @_; |
41
|
0
|
|
|
|
|
0
|
print $self->as_string; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head2 as_string |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=cut |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub as_string { |
49
|
1
|
|
|
1
|
1
|
8
|
my ($self) = @_; |
50
|
|
|
|
|
|
|
|
51
|
1
|
|
|
|
|
34
|
my $string = ""; |
52
|
1
|
|
|
|
|
3
|
for my $trip (@{$self}) { |
|
1
|
|
|
|
|
4
|
|
53
|
1
|
|
|
|
|
1
|
my @date = @{$trip->{date}}; |
|
1
|
|
|
|
|
4
|
|
54
|
1
|
|
|
|
|
3
|
my @start = @{$trip->{start}}; |
|
1
|
|
|
|
|
35
|
|
55
|
1
|
|
|
|
|
3
|
my @end = @{$trip->{end}}; |
|
1
|
|
|
|
|
4
|
|
56
|
|
|
|
|
|
|
|
57
|
1
|
|
|
|
|
16
|
my $start = DateTime->new(year => $date[2], |
58
|
|
|
|
|
|
|
month => $date[1], |
59
|
|
|
|
|
|
|
day => $date[0], |
60
|
|
|
|
|
|
|
hour => $start[0], |
61
|
|
|
|
|
|
|
minute => $start[1], |
62
|
|
|
|
|
|
|
locale => $ENV{LANG}, |
63
|
|
|
|
|
|
|
); |
64
|
0
|
|
|
|
|
|
my $end = DateTime->new(year => $date[2], |
65
|
|
|
|
|
|
|
month => $date[1], |
66
|
|
|
|
|
|
|
day => $date[0], |
67
|
|
|
|
|
|
|
hour => $end[0], |
68
|
|
|
|
|
|
|
minute => $end[1], |
69
|
|
|
|
|
|
|
locale => $ENV{LANG}, |
70
|
|
|
|
|
|
|
); |
71
|
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
$string .= "* " . $start->strftime("%x") . " : " . |
73
|
|
|
|
|
|
|
$trip->{from} . " -> " . $trip->{to} . "\n"; |
74
|
0
|
|
|
|
|
|
$string .= " Départ : " . $start->strftime("%kh%M") . "\n"; |
75
|
0
|
|
|
|
|
|
$string .= " Arrivée : " . $end->strftime("%kh%M") . "\n"; |
76
|
0
|
|
|
|
|
|
$string .= "\n"; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
0
|
|
|
|
|
|
return $string; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 AUTHOR |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
Olivier Schwander, C<< >> |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 BUGS |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, or through |
89
|
|
|
|
|
|
|
the web interface at |
90
|
|
|
|
|
|
|
L. I will be notified, and then you'll |
91
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 SUPPORT |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
perldoc Mail::SNCF::Text |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
You can also look for information at: |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=over 4 |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
L |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
L |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=item * CPAN Ratings |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
L |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=item * Search CPAN |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
L |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=back |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
Copyright 2009 Olivier Schwander, all rights reserved. |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
130
|
|
|
|
|
|
|
under the same terms as Perl itself. |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=cut |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
1; # End of Mail::SNCF::Text |