File Coverage

blib/lib/DateTime/Format/Docker.pm
Criterion Covered Total %
statement 11 11 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 15 15 100.0


line stmt bran cond sub pod time code
1             package DateTime::Format::Docker;
2              
3             =head1 NAME
4              
5             DateTime::Format::Docker - Parse and format Docker dates and times
6              
7             =head1 VERSION
8              
9             Version 0.010001
10              
11             =cut
12              
13             our $VERSION = '0.010001';
14              
15 2     2   99645 use 5.006;
  2         6  
16 2     2   5 use strict;
  2         2  
  2         37  
17 2     2   5 use warnings;
  2         6  
  2         177  
18              
19             use DateTime::Format::Builder (
20 2         47 parsers => {
21             parse_datetime => [
22             {
23             #2017-01-12T20:25:26.027337914Z
24             regex => qr/^(\d{4})-(\d\d)-(\d\d)T(\d\d):(\d\d):(\d\d)\.(\d+)(\w)$/,
25             params => [qw( year month day hour minute second nanosecond time_zone)],
26             },
27             {
28             #2017-01-12T20:25:26Z
29             regex => qr/^(\d{4})-(\d\d)-(\d\d)T(\d\d):(\d\d):(\d\d)(\w)$/,
30             params => [qw( year month day hour minute second time_zone)],
31             },
32             ],
33             }
34 2     2   1199 );
  2         746263  
35              
36             1;
37              
38             __END__
39              
40             =head1 SYNOPSIS
41              
42             require DateTime::Format::Docker;
43              
44             my $dt1 = DateTime::Format::Docker->parse_datetime( $state->finished_at );
45            
46             my $dt2 = DateTime::Format::Docker->parse_datetime( '2017-01-12T20:25:26.027337914Z' );
47            
48             my $dt3 = DateTime::Format::Docker->parse_datetime( '2017-01-12T20:25:26Z' );
49             ...
50              
51             =head1 AUTHOR
52              
53             Mario Zieschang, C<< <mziescha at cpan.org> >>
54              
55             =head1 BUGS
56              
57             Please report any bugs or feature requests to C<bug-datetime-format-docker at rt.cpan.org>, or through
58             the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=DateTime-Format-Docker>. I will be notified, and then you'll
59             automatically be notified of progress on your bug as I make changes.
60              
61              
62             =head1 SUPPORT
63              
64             You can find documentation for this module with the perldoc command.
65              
66             perldoc DateTime::Format::Docker
67              
68              
69             You can also look for information at:
70              
71             =over 4
72              
73             =item * RT: CPAN's request tracker (report bugs here)
74              
75             L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=DateTime-Format-Docker>
76              
77             =item * AnnoCPAN: Annotated CPAN documentation
78              
79             L<http://annocpan.org/dist/DateTime-Format-Docker>
80              
81             =item * CPAN Ratings
82              
83             L<http://cpanratings.perl.org/d/DateTime-Format-Docker>
84              
85             =item * Search CPAN
86              
87             L<http://search.cpan.org/dist/DateTime-Format-Docker/>
88              
89             =back
90            
91              
92             =head1 SEE ALSO
93              
94             =over 4
95              
96             datetime@perl.org mailing list
97            
98             http://datetime.perl.org/
99              
100             =back
101              
102             =head1 LICENSE AND COPYRIGHT
103              
104             =over 4
105              
106             Copyright 2017 Mario Zieschang.
107              
108             This program is free software; you can redistribute it and/or modify it
109             under the terms of the the Artistic License (2.0). You may obtain a
110             copy of the full license at:
111              
112             L<http://www.perlfoundation.org/artistic_license_2_0>
113              
114             Any use, modification, and distribution of the Standard or Modified
115             Versions is governed by this Artistic License. By using, modifying or
116             distributing the Package, you accept this license. Do not use, modify,
117             or distribute the Package, if you do not accept this license.
118              
119             If your Modified Version has been derived from a Modified Version made
120             by someone other than you, you are nevertheless required to ensure that
121             your Modified Version complies with the requirements of this license.
122              
123             This license does not grant you the right to use any trademark, service
124             mark, tradename, or logo of the Copyright Holder.
125              
126             This license includes the non-exclusive, worldwide, free-of-charge
127             patent license to make, have made, use, offer to sell, sell, import and
128             otherwise transfer the Package with respect to any patent claims
129             licensable by the Copyright Holder that are necessarily infringed by the
130             Package. If you institute patent litigation (including a cross-claim or
131             counterclaim) against any party alleging that the Package constitutes
132             direct or contributory patent infringement, then this Artistic License
133             to you shall terminate on the date that such litigation is filed.
134              
135             Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER
136             AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
137             THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
138             PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY
139             YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR
140             CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR
141             CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE,
142             EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
143              
144             =back
145              
146             =cut