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
|
|
5
|
use Data::Dumper; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
65
|
|
22
|
1
|
|
|
1
|
|
553
|
use Time::Local; |
|
1
|
|
|
|
|
1494
|
|
|
1
|
|
|
|
|
78
|
|
23
|
1
|
|
|
1
|
|
472
|
use Template; |
|
1
|
|
|
|
|
27335
|
|
|
1
|
|
|
|
|
55
|
|
24
|
1
|
|
|
1
|
|
584
|
use Template::Plugin::Date; |
|
1
|
|
|
|
|
9646
|
|
|
1
|
|
|
|
|
30
|
|
25
|
1
|
|
|
1
|
|
271
|
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__ |