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

VERSION

9       version 0.83
10

SYNOPSIS

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

SPECIFICATION

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

SEE ALSO

58       "datetime@perl.org" mailing list.
59
60       http://datetime.perl.org/
61
62       perl, DateTime, DateTime::Format::Builder
63

SUPPORT

65       Bugs may be submitted at
66       <https://github.com/houseabsolute/DateTime-Format-Builder/issues>.
67
68       I am also usually active on IRC as 'autarch' on "irc://irc.perl.org".
69

SOURCE

71       The source code repository for DateTime-Format-Builder can be found at
72       <https://github.com/houseabsolute/DateTime-Format-Builder>.
73

AUTHORS

75       •   Dave Rolsky <autarch@urth.org>
76
77       •   Iain Truskett <spoon@cpan.org>
78
80       This software is Copyright (c) 2020 by Dave Rolsky.
81
82       This is free software, licensed under:
83
84         The Artistic License 2.0 (GPL Compatible)
85
86       The full text of the license can be found in the LICENSE file included
87       with this distribution.
88
89
90
91perl v5.36.0                      20D2a3t-e0T1i-m2e0::Format::Builder::Parser::Regex(3)
Impressum