File Coverage

blib/lib/DateTime/Format/Strptime/Types.pm
Criterion Covered Total %
statement 33 33 100.0
branch n/a
condition n/a
subroutine 11 11 100.0
pod n/a
total 44 44 100.0


line stmt bran cond sub pod time code
1             package DateTime::Format::Strptime::Types;
2              
3 12     12   99 use strict;
  12         38  
  12         525  
4 12     12   79 use warnings;
  12         20  
  12         1148  
5              
6             our $VERSION = '1.80';
7              
8 12     12   75 use parent 'Specio::Exporter';
  12         52  
  12         98  
9              
10 12     12   1012 use DateTime;
  12         21  
  12         239  
11 12     12   7059 use DateTime::Locale::Base;
  12         119903  
  12         642  
12 12     12   114 use DateTime::Locale::FromData;
  12         24  
  12         391  
13 12     12   94 use DateTime::TimeZone;
  12         23  
  12         440  
14 12     12   98 use Specio 0.33;
  12         279  
  12         830  
15 12     12   72 use Specio::Declare;
  12         20  
  12         117  
16 12     12   2796 use Specio::Library::Builtins -reexport;
  12         27  
  12         125  
17 12     12   168569 use Specio::Library::String -reexport;
  12         37  
  12         167  
18              
19             union(
20             'Locale',
21             of => [
22             object_isa_type('DateTime::Locale::Base'),
23             object_isa_type('DateTime::Locale::FromData'),
24             ],
25             );
26              
27             coerce(
28             t('Locale'),
29             from => t('NonEmptyStr'),
30             inline => sub {"DateTime::Locale->load( $_[1] )"},
31             );
32              
33             object_isa_type('DateTime');
34              
35             my $time_zone_object = object_can_type(
36             'TZObject',
37             methods => [
38             qw(
39             is_floating
40             is_utc
41             name
42             offset_for_datetime
43             short_name_for_datetime
44             )
45             ],
46             );
47              
48             declare(
49             'TimeZone',
50             of => [ t('NonEmptySimpleStr'), $time_zone_object ],
51             );
52              
53             coerce(
54             t('TimeZone'),
55             from => t('NonEmptyStr'),
56             inline => sub {"DateTime::TimeZone->new( name => $_[1] )"},
57             );
58              
59             union(
60             'OnError',
61             of => [
62             enum( values => [ 'croak', 'undef' ] ),
63             t('CodeRef'),
64             ],
65             );
66              
67             1;
68              
69             # ABSTRACT: Types used for parameter checking in DateTime::Format::Strptime
70              
71             __END__
72              
73             =pod
74              
75             =encoding UTF-8
76              
77             =head1 NAME
78              
79             DateTime::Format::Strptime::Types - Types used for parameter checking in DateTime::Format::Strptime
80              
81             =head1 VERSION
82              
83             version 1.80
84              
85             =head1 DESCRIPTION
86              
87             This module has no user-facing parts.
88              
89             =for Pod::Coverage .*
90              
91             =head1 SUPPORT
92              
93             Bugs may be submitted at L<https://github.com/houseabsolute/DateTime-Format-Strptime/issues>.
94              
95             There is a mailing list available for users of this distribution,
96             L<mailto:datetime@perl.org>.
97              
98             =head1 SOURCE
99              
100             The source code repository for DateTime-Format-Strptime can be found at L<https://github.com/houseabsolute/DateTime-Format-Strptime>.
101              
102             =head1 AUTHORS
103              
104             =over 4
105              
106             =item *
107              
108             Dave Rolsky <autarch@urth.org>
109              
110             =item *
111              
112             Rick Measham <rickm@cpan.org>
113              
114             =back
115              
116             =head1 COPYRIGHT AND LICENSE
117              
118             This software is Copyright (c) 2015 - 2025 by Dave Rolsky.
119              
120             This is free software, licensed under:
121              
122             The Artistic License 2.0 (GPL Compatible)
123              
124             The full text of the license can be found in the
125             F<LICENSE> file included with this distribution.
126              
127             =cut