line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mail::SNCF::Remind; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
24493
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
59
|
|
4
|
2
|
|
|
2
|
|
14
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
66
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
11
|
use base qw/Mail::SNCF/; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
1156
|
|
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
2808
|
use DateTime; |
|
2
|
|
|
|
|
390862
|
|
|
2
|
|
|
|
|
655
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 NAME |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Mail::SNCF::Remind - Remind 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 an output suitable for remind |
26
|
|
|
|
|
|
|
(L) |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
use Mail::SNCF; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
my $foo = Mail::SNCF::Text->parse("Mail/sncf"); |
31
|
|
|
|
|
|
|
my $s = $foo->as_string; |
32
|
|
|
|
|
|
|
$foo->print; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 FUNCTIONS |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head2 print |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=cut |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub print { |
41
|
0
|
|
|
0
|
1
|
0
|
my ($self) = @_; |
42
|
0
|
|
|
|
|
0
|
print $self->as_string; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head2 as_string |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=cut |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub as_string { |
50
|
1
|
|
|
1
|
1
|
9
|
my ($self) = @_; |
51
|
|
|
|
|
|
|
|
52
|
1
|
|
|
|
|
36
|
my $string = ""; |
53
|
1
|
|
|
|
|
3
|
for my $trip (@{$self}) { |
|
1
|
|
|
|
|
3
|
|
54
|
1
|
|
|
|
|
2
|
my @date = @{$trip->{date}}; |
|
1
|
|
|
|
|
6
|
|
55
|
1
|
|
|
|
|
3
|
my @start = @{$trip->{start}}; |
|
1
|
|
|
|
|
5
|
|
56
|
1
|
|
|
|
|
2
|
my @end = @{$trip->{end}}; |
|
1
|
|
|
|
|
5
|
|
57
|
|
|
|
|
|
|
|
58
|
1
|
|
|
|
|
12
|
my $start = DateTime->new(year => $date[2], |
59
|
|
|
|
|
|
|
month => $date[1], |
60
|
|
|
|
|
|
|
day => $date[0], |
61
|
|
|
|
|
|
|
hour => $start[0], |
62
|
|
|
|
|
|
|
minute => $start[1], |
63
|
|
|
|
|
|
|
); |
64
|
1
|
|
|
|
|
443
|
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
|
|
|
|
|
|
my $duration = $end->subtract_datetime($start); |
73
|
|
|
|
|
|
|
|
74
|
0
|
|
|
|
|
|
$string .= "REM " . $start->strftime("%b %d %Y") . |
75
|
|
|
|
|
|
|
" AT " . $start->strftime("%k:%M") . |
76
|
|
|
|
|
|
|
" DURATION " . $duration->hours . ":" . $duration->minutes . |
77
|
|
|
|
|
|
|
" MSG %\"" . $trip->{from} . " -> " . $trip->{to} . "%\"\n"; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
0
|
|
|
|
|
|
return $string; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 AUTHOR |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Olivier Schwander, C<< >> |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 BUGS |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, or through |
90
|
|
|
|
|
|
|
the web interface at |
91
|
|
|
|
|
|
|
L. I will be notified, and then you'll |
92
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head1 SUPPORT |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
perldoc Mail::SNCF::Remind |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
You can also look for information at: |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=over 4 |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
L |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
L |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=item * CPAN Ratings |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
L |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=item * Search CPAN |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
L |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=back |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
Copyright 2009 Olivier Schwander, all rights reserved. |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
131
|
|
|
|
|
|
|
under the same terms as Perl itself. |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=cut |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
1; # End of Mail::SNCF::Remind |