line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# -*- cperl -*- |
2
|
|
|
|
|
|
|
# copyright (C) 2005 Topia . all rights reserved. |
3
|
|
|
|
|
|
|
# This is free software; you can redistribute it and/or modify it |
4
|
|
|
|
|
|
|
# under the same terms as Perl itself. |
5
|
|
|
|
|
|
|
# $Id: EUCJP.pm 89 2005-02-04 04:23:12Z topia $ |
6
|
|
|
|
|
|
|
# $URL: file:///usr/minetools/svnroot/mixi/trunk/WWW-Mixi-OO/lib/WWW/Mixi/OO/I18N/EUCJP.pm $ |
7
|
|
|
|
|
|
|
package WWW::Mixi::OO::I18N::EUCJP; |
8
|
1
|
|
|
1
|
|
1353
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
39
|
|
9
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
27
|
|
10
|
1
|
|
|
1
|
|
6
|
use POSIX; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
11
|
|
11
|
1
|
|
|
1
|
|
2710
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
67
|
|
12
|
1
|
|
|
1
|
|
5
|
use base qw(WWW::Mixi::OO::I18N); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
709
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub convert_from_http_content { |
15
|
0
|
|
|
0
|
1
|
|
my ($this, $charset, $str) = @_; |
16
|
|
|
|
|
|
|
|
17
|
0
|
0
|
|
|
|
|
die "this module not implementated charset convertion yet!" |
18
|
|
|
|
|
|
|
unless $charset =~ /euc-jp/i; |
19
|
0
|
|
|
|
|
|
return $str; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub convert_to_http_content { |
23
|
0
|
|
|
0
|
1
|
|
my ($this, $charset, $str) = @_; |
24
|
|
|
|
|
|
|
|
25
|
0
|
0
|
|
|
|
|
die "this module not implementated charset convertion yet!" |
26
|
|
|
|
|
|
|
unless $charset =~ /euc-jp/i; |
27
|
0
|
|
|
|
|
|
return $str; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub convert_login_time { |
31
|
0
|
|
|
0
|
1
|
|
my ($this, $timestr) = @_; |
32
|
0
|
0
|
|
|
|
|
return undef unless defined $timestr; |
33
|
0
|
|
|
|
|
|
my $time = 0; |
34
|
0
|
|
|
0
|
|
|
my $add_time = sub { $time += $1; '' }; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
|
$timestr =~ s/(\d+)日/&$add_time/eg;$time *= 24; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
|
$timestr =~ s/(\d+)時間/&$add_time/eg;$time *= 60; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
37
|
0
|
|
|
|
|
|
$timestr =~ s/(\d+)分/&$add_time/eg;$time *= 60; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
$timestr =~ s/^(\d+)$/&$add_time/eg; |
|
0
|
|
|
|
|
|
|
39
|
0
|
0
|
|
|
|
|
if ($timestr) { |
40
|
0
|
|
|
|
|
|
croak "Couldn't parse login timestr. junk: $timestr, parsed: $time"; |
41
|
|
|
|
|
|
|
} |
42
|
0
|
|
|
|
|
|
$timestr = strftime('%Y/%m/%d %H:%M', localtime(time() - $time)); |
43
|
0
|
0
|
|
|
|
|
return wantarray ? ($timestr, $time) : $timestr; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub convert_time { |
47
|
0
|
|
|
0
|
1
|
|
my ($this, $timestr) = @_; |
48
|
0
|
0
|
|
|
|
|
return undef unless defined $timestr; |
49
|
0
|
|
|
|
|
|
$timestr =~ s|(\d+)年(\d+)月(\d+)日|$1/$2/$3|g; |
50
|
0
|
|
|
|
|
|
$timestr =~ s|(\d+)月(\d+)日|$1/$2|g; |
51
|
0
|
|
|
|
|
|
return $timestr; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
1; |