line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MetaStore::Base; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
MetaStore::Base - base class. |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 SYNOPSIS |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use MetaStore::Base; |
10
|
|
|
|
|
|
|
use base qw/MetaStore::Base/ |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 DESCRIPTION |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
Base class. |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 METHODS |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=cut |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
1
|
|
|
1
|
|
4
|
use Data::Dumper; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
66
|
|
22
|
1
|
|
|
1
|
|
593
|
use Time::Local; |
|
1
|
|
|
|
|
1663
|
|
|
1
|
|
|
|
|
64
|
|
23
|
1
|
|
|
1
|
|
518
|
use Template; |
|
1
|
|
|
|
|
40002
|
|
|
1
|
|
|
|
|
33
|
|
24
|
1
|
|
|
1
|
|
2807
|
use Template::Plugin::Date; |
|
1
|
|
|
|
|
10143
|
|
|
1
|
|
|
|
|
28
|
|
25
|
1
|
|
|
1
|
|
224
|
use WebDAO::Base; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
use strict; |
27
|
|
|
|
|
|
|
use warnings; |
28
|
|
|
|
|
|
|
use base qw/WebDAO::Base/; |
29
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub new { |
32
|
|
|
|
|
|
|
my $class = shift; |
33
|
|
|
|
|
|
|
my $self = {}; |
34
|
|
|
|
|
|
|
my $stat; |
35
|
|
|
|
|
|
|
bless( $self, $class ); |
36
|
|
|
|
|
|
|
return ( $stat = $self->_init(@_) ) ? $self : $stat; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub _init { |
41
|
|
|
|
|
|
|
my $self = shift; |
42
|
|
|
|
|
|
|
return $self->init(@_); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub init{ 1 }; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub time2mysql { |
48
|
|
|
|
|
|
|
my ( $self, $time ) = @_; |
49
|
|
|
|
|
|
|
$time = time() unless defined($time); |
50
|
|
|
|
|
|
|
my ( $sec, $min, $hour, $day, $month, $year ) = ( localtime($time) )[ 0, 1, 2, 3, 4, 5 ]; |
51
|
|
|
|
|
|
|
$year += 1900; |
52
|
|
|
|
|
|
|
$month += 1; |
53
|
|
|
|
|
|
|
$time = sprintf( '%.4d-%.2d-%.2d %.2d:%.2d:%.2d', $year, $month, $day, $hour, $min, $sec ); |
54
|
|
|
|
|
|
|
return $time; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub mysql2time { |
58
|
|
|
|
|
|
|
my ( $self, $time ) = @_; |
59
|
|
|
|
|
|
|
return time() unless $time; |
60
|
|
|
|
|
|
|
my ( $year, $month, $day, $hour, $min, $sec ) = $time =~ m/(\d+)-(\d+)-(\d+) (\d+):(\d+):(\d+)/; |
61
|
|
|
|
|
|
|
return '0' unless ( $year + $month + $day + $hour + $min + $sec ); |
62
|
|
|
|
|
|
|
$year -= 1900; |
63
|
|
|
|
|
|
|
$month -= 1; |
64
|
|
|
|
|
|
|
$time = timelocal( $sec, $min, $hour, $day, $month, $year ); |
65
|
|
|
|
|
|
|
return $time; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
1; |
69
|
|
|
|
|
|
|
__END__ |