1DateTime::Format::BuildUesre:r:PCaornsterri:b:uRtDeeagdteexPT(ei3rm)le:D:oFcourmmeantt:a:tBiuoinlder::Parser::Regex(3)
2
3
4

NAME

6       DateTime::Format::Builder::Parser::Regex - Regex based date parsing
7

SYNOPSIS

9          my $parser = DateTime::Format::Builder->create_parser(
10               regex  => qr/^(\d\d\d\d)(\d\d)(\d\d)T(\d\d)(\d\d)(\d\d)$/,
11               params => [ qw( year month day hour minute second ) ],
12          );
13

SPECIFICATION

15       In addition to the common keys, "Regex" supports:
16
17       ·   regex is a regular expression that should capture elements of the
18           datetime string.  This is a required element. This is the key whose
19           presence indicates it's a specification that belongs to this class.
20
21       ·   params is an arrayref of key names. The captures from the regex are
22           mapped to these ($1 to the first element, $2 to the second, and so
23           on) and handed to "DateTime->new()".  This is a required element.
24
25       ·   extra is a hashref of extra arguments you wish to give to "Date‐
26           Time->new()". For example, you could set the "year" or "time_zone"
27           to defaults:
28
29               extra => { year => 2004, time_zone => "Australia/Sydney" },
30
31       ·   constructor is either an arrayref or a coderef. If an arrayref then
32           the first element is a class name or object, and the second element
33           is a method name (or coderef since Perl allows that sort of thing).
34           The arguments to the call are anything in $p and anything given in
35           the "extra" option above.
36
37           If only a coderef is supplied, then it is called with arguments of
38           $self, $p and "extra".
39
40           In short:
41
42                       $self->$coderef( %$p, %{ $self->{extra} } );
43
44           The method is expected to return a valid DateTime object, or undef
45           in event of failure, but can conceivably return anything it likes.
46           So long as it's 'true'.
47

THANKS

49       See the main module's section.
50

SUPPORT

52       Support for this module is provided via the datetime@perl.org email
53       list. See http://lists.perl.org/ for more details.
54
55       Alternatively, log them via the CPAN RT system via the web or email:
56
57           http://perl.dellah.org/rt/dtbuilder
58           bug-datetime-format-builder@rt.cpan.org
59
60       This makes it much easier for me to track things and thus means your
61       problem is less likely to be neglected.
62
64       Copyright (C) Iain Truskett, 2003. All rights reserved.
65
66       This library is free software; you can redistribute it and/or modify it
67       under the same terms as Perl itself, either Perl version 5.000 or, at
68       your option, any later version of Perl 5 you may have available.
69
70       The full text of the licences can be found in the Artistic and COPYING
71       files included with this module, or in perlartistic and perlgpl as sup‐
72       plied with Perl 5.8.1 and later.
73

AUTHOR

75       Iain Truskett <spoon@cpan.org>
76

SEE ALSO

78       "datetime@perl.org" mailing list.
79
80       http://datetime.perl.org/
81
82       perl, DateTime, DateTime::Format::Builder
83
84
85
86perl v5.8.8                       20D0a8t-e0T2i-m0e1::Format::Builder::Parser::Regex(3)
Impressum