File Coverage

blib/lib/DateTime/Format/XSD.pm
Criterion Covered Total %
statement 13 13 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod 0 1 0.0
total 17 18 94.4


line stmt bran cond sub pod time code
1             { package DateTime::Format::XSD;
2              
3 1     1   683 use strict;
  1         2  
  1         31  
4 1     1   5 use warnings;
  1         2  
  1         33  
5 1     1   13 use base qw(DateTime::Format::ISO8601);
  1         1  
  1         974  
6             our $VERSION = '0.2';
7              
8             sub format_datetime {
9 1     1 0 853 my ($format, $date) = @_;
10 1         7 my $out = $date->strftime('%FT%T%z');
11 1         12 $out =~ s/(\d\d)$/:$1/;
12 1         5 return $out;
13             }
14             };
15             1;
16              
17             =head1 NAME
18              
19             DateTime::Format::XSD - Format DateTime according to xsd:dateTime
20              
21             =head1 SYNOPSIS
22              
23             my $str = DateTime::Format::XSD->format_datetime($dt);
24              
25             =head1 DESCRIPTION
26              
27             XML Schema defines a usage profile which is a subset of the ISO8601
28             profile. This profile defines that the following is the only possible
29             representation for a dateTime, despite all other options ISO provides.
30              
31             YYYY-MM-DD"T"HH:MI:SS(Z|[+-]zh:zm)
32              
33             This module is a subclass of DateTime::Format::ISO8601, therefore it
34             will be able to parse all other ISO options, but will only format it
35             in this exact spec.
36              
37             =head1 SEE ALSO
38              
39             L, L, The XML Schema speficitation.
40              
41             =head1 AUTHORS
42              
43             Daniel Ruoso C
44              
45             =head1 BUG REPORTS
46              
47             Please submit all bugs regarding C to
48             C
49              
50             =head1 LICENSE
51              
52             This library is free software, you can redistribute it and/or modify
53             it under the same terms as Perl itself.
54              
55             =cut
56