This file is indexed.

/usr/share/perl5/MooseX/Types/DateTime.pm is in libmoosex-types-datetime-perl 0.13-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
package MooseX::Types::DateTime; # git description: v0.12-2-g35c46dd
# ABSTRACT: L<DateTime> related constraints and coercions for Moose

use strict;
use warnings;

our $VERSION = '0.13';

use 5.008003;
use Moose 0.41 ();
use DateTime 0.4302 ();
use DateTime::Duration 0.4302 ();
use DateTime::Locale 0.4001 ();
use DateTime::TimeZone 0.95 ();

use MooseX::Types::Moose 0.30 qw/Num HashRef Object Str/;

use namespace::clean 0.19;

use MooseX::Types 0.30 -declare => [qw( DateTime Duration TimeZone Locale Now )];
use if MooseX::Types->VERSION >= 0.42, 'namespace::autoclean';

class_type "DateTime";
class_type "DateTime::Duration";
class_type "DateTime::TimeZone";

subtype DateTime, as 'DateTime';
subtype Duration, as 'DateTime::Duration';
subtype TimeZone, as 'DateTime::TimeZone';

subtype 'DateTime::Locale', as Object,
    where { $_->isa('DateTime::Locale::root') || $_->isa('DateTime::Locale::FromData') };
subtype Locale, as 'DateTime::Locale';

subtype( Now,
    as Str,
    where { $_ eq 'now' },
    ($Moose::VERSION >= 2.0100
        ? Moose::Util::TypeConstraints::inline_as {
           'no warnings "uninitialized";'.
           '!ref(' . $_[1] . ') and '. $_[1] .' eq "now"';
        }
        : Moose::Util::TypeConstraints::optimize_as {
            no warnings 'uninitialized';
            !ref($_[0]) and $_[0] eq 'now';
        }
    ),
);

our %coercions = (
    DateTime => [
        from Num, via { 'DateTime'->from_epoch( epoch => $_ ) },
        from HashRef, via { 'DateTime'->new( %$_ ) },
        from Now, via { 'DateTime'->now },
    ],
    "DateTime::Duration" => [
        from Num, via { DateTime::Duration->new( seconds => $_ ) },
        from HashRef, via { DateTime::Duration->new( %$_ ) },
    ],
    "DateTime::TimeZone" => [
        from Str, via { DateTime::TimeZone->new( name => $_ ) },
    ],
    "DateTime::Locale" => [
        from Moose::Util::TypeConstraints::find_or_create_isa_type_constraint("Locale::Maketext"),
        via { DateTime::Locale->load($_->language_tag) },
        from Str, via { DateTime::Locale->load($_) },
    ],
);

for my $type ( "DateTime", DateTime ) {
    coerce $type => @{ $coercions{DateTime} };
}

for my $type ( "DateTime::Duration", Duration ) {
    coerce $type => @{ $coercions{"DateTime::Duration"} };
}

for my $type ( "DateTime::TimeZone", TimeZone ) {
    coerce $type => @{ $coercions{"DateTime::TimeZone"} };
}

for my $type ( "DateTime::Locale", Locale ) {
    coerce $type => @{ $coercions{"DateTime::Locale"} };
}

__PACKAGE__

__END__

=pod

=encoding UTF-8

=head1 NAME

MooseX::Types::DateTime - L<DateTime> related constraints and coercions for Moose

=head1 VERSION

version 0.13

=head1 SYNOPSIS

Export Example:

    use MooseX::Types::DateTime qw(TimeZone);

    has time_zone => (
        isa => TimeZone,
        is => "rw",
        coerce => 1,
    );

    Class->new( time_zone => "Africa/Timbuktu" );

=head1 DESCRIPTION

This module packages several L<Moose::Util::TypeConstraints> with coercions,
designed to work with the L<DateTime> suite of objects.

=for stopwords Namespaced

Namespaced Example:

    use MooseX::Types::DateTime;

    has time_zone => (
        isa => 'DateTime::TimeZone',
        is => "rw",
        coerce => 1,
    );

    Class->new( time_zone => "Africa/Timbuktu" );

=head1 CONSTRAINTS

=over 4

=item L<DateTime>

A class type for L<DateTime>.

=over 4

=item from C<Num>

Uses L<DateTime/from_epoch>. Floating values will be used for sub-second
precision, see L<DateTime> for details.

=item from C<HashRef>

Calls L<DateTime/new> with the hash entries as arguments.

=back

=item L<Duration>

A class type for L<DateTime::Duration>

=over 4

=item from C<Num>

Uses L<DateTime::Duration/new> and passes the number as the C<seconds> argument.

Note that due to leap seconds, DST changes etc this may not do what you expect.
For instance passing in C<86400> is not always equivalent to one day, although
there are that many seconds in a day. See L<DateTime/"How Date Math is Done">
for more details.

=item from C<HashRef>

Calls L<DateTime::Duration/new> with the hash entries as arguments.

=back

=item L<DateTime::Locale>

A class type for L<DateTime::Locale::root> with the name L<DateTime::Locale>.

=over 4

=item from C<Str>

The string is treated as a language tag (e.g. C<en> or C<he_IL>) and given to
L<DateTime::Locale/load>.

=item from L<Locale::Maktext>

The C<Locale::Maketext/language_tag> attribute will be used with L<DateTime::Locale/load>.

=item L<DateTime::TimeZone>

A class type for L<DateTime::TimeZone>.

=over 4

=item from C<Str>

Treated as a time zone name or offset. See L<DateTime::TimeZone/USAGE> for more
details on the allowed values.

Delegates to L<DateTime::TimeZone/new> with the string as the C<name> argument.

=back

=back

=back

=head1 SEE ALSO

L<MooseX::Types::DateTime::MoreCoercions>

L<DateTime>, L<DateTimeX::Easy>

=head1 SUPPORT

Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=MooseX-Types-DateTime>
(or L<bug-MooseX-Types-DateTime@rt.cpan.org|mailto:bug-MooseX-Types-DateTime@rt.cpan.org>).

There is also a mailing list available for users of this distribution, at
L<http://lists.perl.org/list/moose.html>.

There is also an irc channel available for users of this distribution, at
irc://irc.perl.org/#moose.

=head1 AUTHOR

יובל קוג'מן (Yuval Kogman) <nothingmuch@woobling.org>

=head1 CONTRIBUTORS

=for stopwords Karen Etheridge Dagfinn Ilmari Mannsåker Florian Ragwitz John Napiorkowski Shawn M Moore Dave Rolsky

=over 4

=item *

Karen Etheridge <ether@cpan.org>

=item *

Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>

=item *

Florian Ragwitz <rafl@debian.org>

=item *

John Napiorkowski <jjnapiork@cpan.org>

=item *

Shawn M Moore <sartak@gmail.com>

=item *

Dave Rolsky <autarch@urth.org>

=back

=head1 COPYRIGHT AND LICENCE

This software is copyright (c) 2008 by יובל קוג'מן (Yuval Kogman).

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.

=cut