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

SEE ALSO

52       "datetime@perl.org" mailing list.
53
54       http://datetime.perl.org/
55
56       perl, DateTime, DateTime::Format::Builder
57

SUPPORT

59       Bugs may be submitted at
60       <http://rt.cpan.org/Public/Dist/Display.html?Name=DateTime-Format-Builder>
61       or via email to bug-datetime-format-builder@rt.cpan.org <mailto:bug-
62       datetime-format-builder@rt.cpan.org>.
63
64       I am also usually active on IRC as 'autarch' on "irc://irc.perl.org".
65

SOURCE

67       The source code repository for DateTime-Format-Builder can be found at
68       <https://github.com/houseabsolute/DateTime-Format-Builder>.
69

AUTHORS

71       ·   Dave Rolsky <autarch@urth.org>
72
73       ·   Iain Truskett
74
76       This software is Copyright (c) 2019 by Dave Rolsky.
77
78       This is free software, licensed under:
79
80         The Artistic License 2.0 (GPL Compatible)
81
82       The full text of the license can be found in the LICENSE file included
83       with this distribution.
84
85
86
87perl v5.28.1                      20D1a9t-e0T3i-m0e4::Format::Builder::Parser::Regex(3)
Impressum