line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
1523724
|
use v5.10; |
|
1
|
|
|
|
|
2
|
|
2
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
16
|
|
3
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
43
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Meerkat::DateTime; |
6
|
|
|
|
|
|
|
# ABSTRACT: DateTime proxy for lazy inflation from an epoch value |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.014'; |
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
4
|
use Moose 2; |
|
1
|
|
|
|
|
10
|
|
|
1
|
|
|
|
|
5
|
|
11
|
1
|
|
|
1
|
|
4441
|
use MooseX::AttributeShortcuts; |
|
1
|
|
|
|
|
217503
|
|
|
1
|
|
|
|
|
4
|
|
12
|
1
|
|
|
1
|
|
24377
|
use MooseX::Storage; |
|
1
|
|
|
|
|
16952
|
|
|
1
|
|
|
|
|
3
|
|
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
1
|
|
167
|
use DateTime; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
18
|
|
15
|
1
|
|
|
1
|
|
3
|
use namespace::autoclean; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
4
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
with Storage; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
#pod =attr epoch (required) |
20
|
|
|
|
|
|
|
#pod |
21
|
|
|
|
|
|
|
#pod Floating point epoch seconds |
22
|
|
|
|
|
|
|
#pod |
23
|
|
|
|
|
|
|
#pod =cut |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
has epoch => ( |
26
|
|
|
|
|
|
|
is => 'ro', |
27
|
|
|
|
|
|
|
isa => 'Num', |
28
|
|
|
|
|
|
|
required => 1, |
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
#pod =attr DateTime |
32
|
|
|
|
|
|
|
#pod |
33
|
|
|
|
|
|
|
#pod A lazily-inflated DateTime object. It will not be serialized by MooseX::Storage. |
34
|
|
|
|
|
|
|
#pod |
35
|
|
|
|
|
|
|
#pod =cut |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
has DateTime => ( |
38
|
|
|
|
|
|
|
is => 'lazy', |
39
|
|
|
|
|
|
|
isa => 'DateTime', |
40
|
|
|
|
|
|
|
traits => ['DoNotSerialize'], |
41
|
|
|
|
|
|
|
); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub _build_DateTime { |
44
|
0
|
|
|
0
|
|
|
my ($self) = @_; |
45
|
0
|
|
|
|
|
|
return DateTime->from_epoch( epoch => $self->epoch ); |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
1; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
# vim: ts=4 sts=4 sw=4 et: |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
__END__ |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=pod |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=encoding UTF-8 |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 NAME |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
Meerkat::DateTime - DateTime proxy for lazy inflation from an epoch value |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 VERSION |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
version 0.014 |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 SYNOPSIS |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
use Time::HiRes; |
72
|
|
|
|
|
|
|
use Meerkat::DateTime; |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
my $mkdt = Meerkat::DateTime->new( epoch = time ); |
75
|
|
|
|
|
|
|
my $datetime = $mkdt->DateTime; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 DESCRIPTION |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
This module provides a way to lazily inflate floating point epoch seconds into |
80
|
|
|
|
|
|
|
a L<DateTime object>. It's conceptually similar to L<DateTime::Tiny>, but |
81
|
|
|
|
|
|
|
without all the year, month, day, etc. fields. |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
The L<Meerkat::Types> module provides Moose type support and coercions and |
84
|
|
|
|
|
|
|
L<MooseX::Storage> type handling to simplify having Meerkat::DateTime |
85
|
|
|
|
|
|
|
attributes. |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
See the L<Meerkat::Cookbook> for more on handling dates and times. |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head2 epoch (required) |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Floating point epoch seconds |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head2 DateTime |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
A lazily-inflated DateTime object. It will not be serialized by MooseX::Storage. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=for Pod::Coverage method_names_here |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 AUTHOR |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
David Golden <dagolden@cpan.org> |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
This software is Copyright (c) 2013 by David Golden. |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
This is free software, licensed under: |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
The Apache License, Version 2.0, January 2004 |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=cut |