line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Class::Date::Const; |
2
|
7
|
|
|
7
|
|
41
|
use strict; |
|
7
|
|
|
|
|
10
|
|
|
7
|
|
|
|
|
356
|
|
3
|
|
|
|
|
|
|
|
4
|
7
|
|
|
7
|
|
35
|
use vars qw(@EXPORT @ISA @ERROR_MESSAGES %EXPORT_TAGS); |
|
7
|
|
|
|
|
14
|
|
|
7
|
|
|
|
|
1461
|
|
5
|
7
|
|
|
7
|
|
35
|
use Exporter; |
|
7
|
|
|
|
|
11
|
|
|
7
|
|
|
|
|
1986
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '1.1.15'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
my %FIELDS = ( |
10
|
|
|
|
|
|
|
# Class::Date fields |
11
|
|
|
|
|
|
|
c_year => 0, |
12
|
|
|
|
|
|
|
c_mon => 1, |
13
|
|
|
|
|
|
|
c_day => 2, |
14
|
|
|
|
|
|
|
c_hour => 3, |
15
|
|
|
|
|
|
|
c_min => 4, |
16
|
|
|
|
|
|
|
c_sec => 5, |
17
|
|
|
|
|
|
|
c_wday => 6, |
18
|
|
|
|
|
|
|
c_yday => 7, |
19
|
|
|
|
|
|
|
c_isdst => 8, |
20
|
|
|
|
|
|
|
c_epoch => 9, |
21
|
|
|
|
|
|
|
c_tz => 10, |
22
|
|
|
|
|
|
|
c_error => 11, |
23
|
|
|
|
|
|
|
c_errmsg => 12, |
24
|
|
|
|
|
|
|
# Class::Date::Rel fields |
25
|
|
|
|
|
|
|
cs_mon => 0, |
26
|
|
|
|
|
|
|
cs_sec => 1, |
27
|
|
|
|
|
|
|
# Class::Date::Invalid fields |
28
|
|
|
|
|
|
|
ci_error => 0, |
29
|
|
|
|
|
|
|
ci_errmsg => 1, |
30
|
|
|
|
|
|
|
); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
eval " sub $_ () { ".$FIELDS{$_}."}" foreach keys %FIELDS; |
33
|
|
|
|
|
|
|
@ISA = qw(Exporter); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
my @ERRORS = ( |
36
|
|
|
|
|
|
|
E_OK => '', |
37
|
|
|
|
|
|
|
E_INVALID => 'Invalid date or time', |
38
|
|
|
|
|
|
|
E_RANGE => 'Range check on date or time failed', |
39
|
|
|
|
|
|
|
E_UNPARSABLE => 'Unparsable date or time: %s', |
40
|
|
|
|
|
|
|
E_UNDEFINED => 'Undefined date object', |
41
|
|
|
|
|
|
|
); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
my @ERR; |
44
|
|
|
|
|
|
|
# predeclaring error constants |
45
|
|
|
|
|
|
|
my $c = 0; |
46
|
|
|
|
|
|
|
while (@ERRORS) { |
47
|
|
|
|
|
|
|
my $errorcode = shift @ERRORS; |
48
|
|
|
|
|
|
|
my $errorname = shift @ERRORS; |
49
|
|
|
|
|
|
|
eval "sub $errorcode () { $c }"; |
50
|
|
|
|
|
|
|
$ERROR_MESSAGES[$c] = $errorname; |
51
|
|
|
|
|
|
|
push @{$EXPORT_TAGS{errors}}, $errorcode; |
52
|
|
|
|
|
|
|
$c++; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
@EXPORT = (keys %FIELDS, qw(@ERROR_MESSAGES), @{$EXPORT_TAGS{errors}}); |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
1; |