line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Egg::Plugin::Tools; |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# Masatoshi Mizuno E<lt>lusheE<64>cpan.orgE<gt> |
4
|
|
|
|
|
|
|
# |
5
|
|
|
|
|
|
|
# $Id: Tools.pm 340 2008-05-19 11:50:24Z lushe $ |
6
|
|
|
|
|
|
|
# |
7
|
1
|
|
|
1
|
|
584
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
61
|
|
8
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
45
|
|
9
|
1
|
|
|
1
|
|
8
|
use Carp qw/croak/; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
124
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '3.03'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
{ |
14
|
|
|
|
|
|
|
require URI::Escape; |
15
|
|
|
|
|
|
|
require HTML::Entities; |
16
|
1
|
|
|
1
|
|
7
|
no warnings 'redefine'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
366
|
|
17
|
|
|
|
|
|
|
sub encode_entities { |
18
|
0
|
|
0
|
0
|
1
|
|
shift; my $args= $_[1] || q{'"&<>@}; |
|
0
|
|
|
|
|
|
|
19
|
0
|
|
|
|
|
|
&HTML::Entities::encode_entities($_[0], $args); |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
sub encode_entities_numeric { |
22
|
0
|
|
|
0
|
1
|
|
shift; &HTML::Entities::encode_entities_numeric(@_); |
|
0
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
sub decode_entities { |
25
|
0
|
|
|
0
|
1
|
|
shift; &HTML::Entities::decode_entities(@_); |
|
0
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
sub uri_escape { |
28
|
0
|
|
|
0
|
1
|
|
shift; &URI::Escape::uri_escape(@_); |
|
0
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
sub uri_escape_utf8 { |
31
|
0
|
|
|
0
|
1
|
|
shift; &URI::Escape::uri_escape_utf8(@_); |
|
0
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
sub uri_unescape { |
34
|
0
|
|
|
0
|
1
|
|
shift; &URI::Escape::uri_unescape(@_); |
|
0
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
*escape_html = \&encode_entities; |
37
|
|
|
|
|
|
|
*eHTML = \&encode_entities; |
38
|
|
|
|
|
|
|
*unescape_html = \&decode_entities; |
39
|
|
|
|
|
|
|
*ueHTML = \&decode_entities; |
40
|
|
|
|
|
|
|
*escape_uri = \&uri_escape; |
41
|
|
|
|
|
|
|
*eURI = \&uri_escape; |
42
|
|
|
|
|
|
|
*unescape_uri = \&uri_unescape; |
43
|
|
|
|
|
|
|
*ueURI = \&uri_unescape; |
44
|
|
|
|
|
|
|
}; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
{ |
47
|
1
|
|
|
1
|
|
7
|
no strict 'refs'; ## no critic. |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
48
|
1
|
|
|
1
|
|
6
|
no warnings 'redefine'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
1447
|
|
49
|
|
|
|
|
|
|
for my $accessor (qw/sha1 md5/) { |
50
|
|
|
|
|
|
|
my $pkg= "Digest::". uc($accessor); |
51
|
|
|
|
|
|
|
*{__PACKAGE__."::${accessor}_hex"}= sub { |
52
|
0
|
|
|
0
|
|
|
$pkg->require; |
53
|
0
|
|
|
|
|
|
shift; |
54
|
0
|
0
|
|
|
|
|
&{"${pkg}::${accessor}_hex"}(ref($_[0]) ? ${$_[0]}: @_); |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
}; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
}; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub create_id { |
60
|
0
|
|
|
0
|
1
|
|
my $e= shift; |
61
|
0
|
|
0
|
|
|
|
my $len= shift || 32; |
62
|
0
|
|
0
|
|
|
|
my $method= (lc(shift) || 'sha1'). '_hex'; |
63
|
0
|
|
|
|
|
|
substr( $e->$method( |
64
|
|
|
|
|
|
|
$e->$method( $$. $e->gettimeofday. rand(1000) ) ), 0, $len ); |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
sub comma { |
67
|
0
|
|
0
|
0
|
1
|
|
my $num= $_[1] || return 0; |
68
|
0
|
|
|
|
|
|
my($a, $b, $c)= $num=~/^([\+\-])?(\d+)(\.\d+)?/; |
69
|
0
|
0
|
|
|
|
|
$b || return 0; |
70
|
0
|
|
|
|
|
|
1 while $b=~s{(.*\d)(\d{3})} [$1,$2]; |
71
|
0
|
|
0
|
|
|
|
($a || ""). $b. ($c || ""); |
|
|
|
0
|
|
|
|
|
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
sub shuffle_array { |
74
|
|
|
|
|
|
|
# Quotation from perlfaq. |
75
|
0
|
|
|
0
|
1
|
|
my $surf= shift; |
76
|
0
|
0
|
|
|
|
|
my $deck= $_[0] ? (ref($_[0]) eq 'ARRAY' ? $_[0]: [@_]) |
|
|
0
|
|
|
|
|
|
77
|
|
|
|
|
|
|
: croak q{ I want array. }; |
78
|
0
|
|
|
|
|
|
my $i = @$deck; |
79
|
0
|
|
|
|
|
|
while ($i--) { |
80
|
0
|
|
|
|
|
|
my $j = int rand ($i+1); |
81
|
0
|
|
|
|
|
|
@$deck[$i,$j] = @$deck[$j,$i]; |
82
|
|
|
|
|
|
|
} |
83
|
0
|
0
|
|
|
|
|
wantarray ? @$deck: $deck; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
sub filefind { |
86
|
0
|
|
|
0
|
1
|
|
require File::Find; |
87
|
0
|
|
|
|
|
|
my $e= shift; |
88
|
0
|
|
0
|
|
|
|
my $regex= shift || croak q{ I want File Regexp }; |
89
|
0
|
0
|
|
|
|
|
@_ || croak q{ I want Find PATH. }; |
90
|
0
|
|
|
|
|
|
my @files; |
91
|
|
|
|
|
|
|
my $wanted= sub { |
92
|
0
|
0
|
|
0
|
|
|
push @files, $File::Find::name if $File::Find::name=~m{$regex}; |
93
|
0
|
|
|
|
|
|
}; |
94
|
0
|
0
|
|
|
|
|
File::Find::find($wanted, ref($_[0]) eq 'ARRAY' ? @{$_[0]}: @_ ); |
|
0
|
|
|
|
|
|
|
95
|
0
|
0
|
|
|
|
|
@files ? \@files: (undef); |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
sub referer_check { |
98
|
0
|
|
|
0
|
1
|
|
my $e= shift; |
99
|
0
|
0
|
|
|
|
|
if ($_[0]) { $e->req->is_post || return 0 } |
|
0
|
0
|
|
|
|
|
|
100
|
0
|
|
0
|
|
|
|
my $refer= $e->req->referer || return 1; |
101
|
0
|
|
0
|
|
|
|
my $regex= $e->global->{referer_check_regexp} ||= do { |
102
|
0
|
0
|
|
|
|
|
$e->config->{allow_referer_regex} || do { |
103
|
0
|
0
|
|
|
|
|
$e->req->host_name |
104
|
0
|
|
|
|
|
|
? "^https?\://@{[ quotemeta($e->req->host_name) ]}" |
105
|
|
|
|
|
|
|
: die '$e->request->host_name is empty.'; |
106
|
|
|
|
|
|
|
}; |
107
|
|
|
|
|
|
|
}; |
108
|
0
|
0
|
|
|
|
|
$refer=~m{$regex} ? 1: 0; |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
sub gettimeofday { |
111
|
0
|
|
|
0
|
1
|
|
require Time::HiRes; |
112
|
0
|
|
|
|
|
|
Time::HiRes::gettimeofday(); |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
sub mkpath { |
115
|
0
|
|
|
0
|
1
|
|
require File::Path; |
116
|
0
|
|
|
|
|
|
shift; File::Path::mkpath(@_); |
|
0
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
sub rmtree { |
119
|
0
|
|
|
0
|
1
|
|
require File::Path; |
120
|
0
|
|
|
|
|
|
shift; File::Path::rmtree(@_); |
|
0
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
sub jfold { |
123
|
0
|
|
|
0
|
1
|
|
require Jcode; |
124
|
0
|
|
|
|
|
|
my $e = shift; |
125
|
0
|
|
0
|
|
|
|
my $str = shift || croak q{ I want string. }; |
126
|
0
|
|
|
|
|
|
[ Jcode->new($str)->jfold(@_) ]; |
127
|
|
|
|
|
|
|
} |
128
|
|
|
|
|
|
|
sub timelocal { |
129
|
0
|
|
|
0
|
1
|
|
my $e = shift; |
130
|
0
|
|
0
|
|
|
|
my $arg= shift || croak q{ I want argument. }; |
131
|
0
|
|
|
|
|
|
require Time::Local; |
132
|
0
|
|
|
|
|
|
my($yer, $mon, $day, $hou, $min, $sec); |
133
|
0
|
0
|
|
|
|
|
if ($arg=~m{^(\d{4})[/\-](\d{1,2})[/\-](\d{1,2})(.*)}) { |
134
|
0
|
|
|
|
|
|
($arg, $yer, $mon, $day)= ($4, $1, $2, $3); |
135
|
0
|
0
|
0
|
|
|
|
if ($arg and $arg=~m{^.+?(\d{1,2})\:(\d{1,2})(.*)}) { |
136
|
0
|
|
|
|
|
|
($arg, $hou, $min)= ($3, $1, $2); |
137
|
0
|
0
|
0
|
|
|
|
if ($arg and $arg=~m{^\:(\d{1,2})}) { $sec= $1 } |
|
0
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
} |
139
|
0
|
|
0
|
|
|
|
$hou ||= 0; $min ||= 0; $sec ||= 0; |
|
0
|
|
0
|
|
|
|
|
|
0
|
|
0
|
|
|
|
|
140
|
|
|
|
|
|
|
} else { |
141
|
0
|
0
|
|
|
|
|
$arg= [$arg, @_] if defined($_[0]); |
142
|
0
|
0
|
|
|
|
|
$yer= $arg->[0]; $yer=~m{\D} and croak q{ Bad argument. }; |
|
0
|
|
|
|
|
|
|
143
|
0
|
|
0
|
|
|
|
$mon= $arg->[1] || 0; |
144
|
0
|
|
0
|
|
|
|
$day= $arg->[2] || croak q{ I want Day. }; |
145
|
0
|
|
0
|
|
|
|
$hou= $arg->[3] || 0; $min= $arg->[4] || 0; $sec= $arg->[5] || 0; |
|
0
|
|
0
|
|
|
|
|
|
0
|
|
0
|
|
|
|
|
146
|
|
|
|
|
|
|
} |
147
|
0
|
0
|
|
|
|
|
if (length($yer)== 4) { $yer-= 1900; --$mon } |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
148
|
0
|
|
|
|
|
|
Time::Local::timelocal($sec, $min, $hou, $day, $mon, $yer); |
149
|
|
|
|
|
|
|
} |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
1; |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
__END__ |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=head1 NAME |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
Egg::Plugin::Tools - Convenient method collection for Egg. |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=head1 SYNOPSIS |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
use Egg qw/ Tools /; |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
$e->escape_html($html); |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
$e->unescape_html($plain); |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
$e->sha1_hex('abcdefg'); |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
$e->comma('12345.123'); |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
my @array= (1..100); |
172
|
|
|
|
|
|
|
$e->shuffle_array(\@array); |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=head1 DESCRIPTION |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
It is a plugin that collects convenient methods. |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=head1 METHODS |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=head2 encode_entities ([HTML_STR], [ARG]) |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
encode_entities of L<HTML::Entities> is done. |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
my $plain = $e->encode_entities($html); |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=over 4 |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=item * Alias = escape_html, eHTML |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=back |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=head2 encode_entities_numeric ([HTML_STR], [ARG]) |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
encode_entities_numeric of HTML::Entities is done. |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=head2 decode_entities ([HTML_STR], [ARG]) |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
decode_entities of L<HTML::Entities> is done. |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
my $html = $e->decode_entities($plain); |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
=over 4 |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
=item * Alias = unescape_html, ueHTML |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
=back |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
=head2 uri_escape ([URI_STR]) |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
uri_escape of L<URI::Escape> is done. |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
my $escape= $e->uri_escape($uri); |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
=over 4 |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
=item * Alias = escape_uri, eURI |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
=back |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
=head2 uri_escape_utf8 ([URI_STR]) |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
uri_escape_utf8 of L<URI::Escape> is done. |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
=head2 uri_unescape ([URI_STR]) |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
uri_unescape of L<URI::Escape> is done. |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
=over 4 |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
=item * Alias = unescape_uri, ueURI |
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
=back |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
=head2 sha1_hex ([TEXT]) |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
sha1_hex of L<Digest::SHA1> is done. |
237
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
my $hex= $e->sha1_hex($text); |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
=head2 md5_hex ([TEXT]) |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
md5_hex of L<Digest::MD5> is done. |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
my $hex= $e->md5_hex($text); |
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
=head2 create_id ([LENGTH], [METHOD]) |
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
A unique HEX value to use it as general ID is returned. |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
LENGTH is length of the returned HEX value. It disappears when it is too short |
251
|
|
|
|
|
|
|
in unique. Default is 32. |
252
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
METHOD is a method for the generation of the HEX value. Sha1 or md5 can be |
254
|
|
|
|
|
|
|
specified. Default is sha1. |
255
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
my $id= $e->create_id; |
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
=head2 comma ([NUMBER]) |
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
The comma is put in NUMBER in each treble. |
261
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
my $price= $e->comma($number); |
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
=head2 shuffle_array ([ARRAY]) |
265
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
The result of mixing ARRAY is returned. |
267
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
my $shuffle= $e->shuffle_array($array); |
269
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
=head2 filefind ([REGEXP], [PATH_LIST]) |
271
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
The result of L<File::Find> is returned. |
273
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
The regular expression of the retrieved file is passed to REGEXP. |
275
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
The retrieved passing is passed to PATH_LIST. |
277
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
When anything doesn't become a hit to the retrieval, undefined is returned. |
279
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
if (my $files= $e->filefind(qr{\.pm$}, '/path/to/find')) { |
281
|
|
|
|
|
|
|
............ |
282
|
|
|
|
|
|
|
..... |
283
|
|
|
|
|
|
|
} |
284
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
=head2 referer_check ([BOOL]) |
286
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
If environment variable 'HTTP_REFERER' is the one of the site, true is returned. |
288
|
|
|
|
|
|
|
|
289
|
|
|
|
|
|
|
If REQUEST_METHOD is POST and doesn't exist, it becomes false if BOOL is given. |
290
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
True is returned when there is no value in HTTP_REFERER. |
292
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
$e-E<gt>request-E<gt>host_name is used for the site judgment. |
294
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
if ($e->referer_check(1)) { |
296
|
|
|
|
|
|
|
.............. |
297
|
|
|
|
|
|
|
...... |
298
|
|
|
|
|
|
|
} |
299
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
=head2 gettimeofday |
301
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
Gettimeofday of L<Time::HiRes> is returned. |
303
|
|
|
|
|
|
|
|
304
|
|
|
|
|
|
|
my $elabor = $e->gettimeofday; |
305
|
|
|
|
|
|
|
|
306
|
|
|
|
|
|
|
=head2 mkpath ([PATH_LIST]) |
307
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
mkpath of L<File::Path> is done. |
309
|
|
|
|
|
|
|
|
310
|
|
|
|
|
|
|
$e->mkpath(qw{ /path/to/create }); |
311
|
|
|
|
|
|
|
|
312
|
|
|
|
|
|
|
=head2 rmtree ([PATH_LIST]) |
313
|
|
|
|
|
|
|
|
314
|
|
|
|
|
|
|
rmtree of File::Path is done. |
315
|
|
|
|
|
|
|
|
316
|
|
|
|
|
|
|
$e->rmtree(qw{ /path/to/create }); |
317
|
|
|
|
|
|
|
|
318
|
|
|
|
|
|
|
=head2 jfold ([STRING]) |
319
|
|
|
|
|
|
|
|
320
|
|
|
|
|
|
|
jfold of L<Jcode> is done. |
321
|
|
|
|
|
|
|
|
322
|
|
|
|
|
|
|
The return value is ARRAY reference. |
323
|
|
|
|
|
|
|
|
324
|
|
|
|
|
|
|
my $cutstr= $e->jfold($string); |
325
|
|
|
|
|
|
|
|
326
|
|
|
|
|
|
|
=head2 timelocal ([DATE_STRING or TIME_ARRAY]) |
327
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
L<Time::Local> is done. |
329
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
If it is DATE_STRING, the character string of the form such as '2008/01/01 01:01:01' |
331
|
|
|
|
|
|
|
and '2008-01-01 01:01:01' can be passed. |
332
|
|
|
|
|
|
|
|
333
|
|
|
|
|
|
|
When TIME_ARRAY is passed, ARRAY with the value that starts from the age is passed. |
334
|
|
|
|
|
|
|
Please note reversing completely with the argument passed to L<Time::Local>. |
335
|
|
|
|
|
|
|
|
336
|
|
|
|
|
|
|
my $time_var= $e->timelocal('2008/01/01 01:01:01'); |
337
|
|
|
|
|
|
|
or |
338
|
|
|
|
|
|
|
my $time_var= $e->timelocal(qw/ 2008 01 01 01 01 01 /); |
339
|
|
|
|
|
|
|
|
340
|
|
|
|
|
|
|
=head1 SEE ALSO |
341
|
|
|
|
|
|
|
|
342
|
|
|
|
|
|
|
L<Egg::Release>, |
343
|
|
|
|
|
|
|
L<URI::Escape>, |
344
|
|
|
|
|
|
|
L<HTML::Entities>, |
345
|
|
|
|
|
|
|
L<Digest::SHA1>, |
346
|
|
|
|
|
|
|
L<Digest::MD5>, |
347
|
|
|
|
|
|
|
L<File::Find>, |
348
|
|
|
|
|
|
|
L<Time::HiRes>, |
349
|
|
|
|
|
|
|
L<File::Path>, |
350
|
|
|
|
|
|
|
L<Jcode>, |
351
|
|
|
|
|
|
|
L<Time::Local>, |
352
|
|
|
|
|
|
|
|
353
|
|
|
|
|
|
|
=head1 AUTHOR |
354
|
|
|
|
|
|
|
|
355
|
|
|
|
|
|
|
Masatoshi Mizuno E<lt>lusheE<64>cpan.orgE<gt> |
356
|
|
|
|
|
|
|
|
357
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
358
|
|
|
|
|
|
|
|
359
|
|
|
|
|
|
|
Copyright (C) 2008 Bee Flag, Corp. E<lt>L<http://egg.bomcity.com/>E<gt>. |
360
|
|
|
|
|
|
|
|
361
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
362
|
|
|
|
|
|
|
it under the same terms as Perl itself, either Perl version 5.8.6 or, |
363
|
|
|
|
|
|
|
at your option, any later version of Perl 5 you may have available. |
364
|
|
|
|
|
|
|
|
365
|
|
|
|
|
|
|
=cut |
366
|
|
|
|
|
|
|
|