1DateTime::Format::BuildUesre:r:PCaornsterriD:ba:utDteieTsdipmaPete:cr:hlF(o3Dr)omcautm:e:nBtuaitlidoenr::Parser::Dispatch(3)
2
3
4
6 DateTime::Format::Builder::Parser::Dispatch - Dispatch parsers by group
7
9 version 0.82
10
12 package SampleDispatch;
13 use DateTime::Format::Builder
14 (
15 parsers => {
16 parse_datetime => [
17 {
18 Dispatch => sub {
19 return 'fnerk';
20 }
21 }
22 ]
23 },
24 groups => {
25 fnerk => [
26 {
27 regex => qr/^(\d{4})(\d\d)(\d\d)$/,
28 params => [qw( year month day )],
29 },
30 ]
31 }
32 );
33
35 "Dispatch" adds another parser type to "Builder" permitting dispatch of
36 parsing according to group names.
37
39 "Dispatch" has just one key: "Dispatch". The value should be a
40 reference to a subroutine that returns one of:
41
42 · "undef", meaning no groups could be found.
43
44 · An empty list, meaning no groups could be found.
45
46 · A single string, meaning: use this group
47
48 · A list of strings, meaning: use these groups in this order.
49
50 Groups are specified much like the example in the SYNOPSIS. They
51 follow the same format as when you specify them for methods.
52
54 Your group parser can also be a Dispatch parser. Thus you could
55 potentially end up with an infinitely recursive parser.
56
58 "datetime@perl.org" mailing list.
59
60 http://datetime.perl.org/
61
62 perl, DateTime, DateTime::Format::Builder
63
65 Bugs may be submitted at
66 <http://rt.cpan.org/Public/Dist/Display.html?Name=DateTime-Format-Builder>
67 or via email to bug-datetime-format-builder@rt.cpan.org <mailto:bug-
68 datetime-format-builder@rt.cpan.org>.
69
70 I am also usually active on IRC as 'autarch' on "irc://irc.perl.org".
71
73 The source code repository for DateTime-Format-Builder can be found at
74 <https://github.com/houseabsolute/DateTime-Format-Builder>.
75
77 · Dave Rolsky <autarch@urth.org>
78
79 · Iain Truskett
80
82 This software is Copyright (c) 2019 by Dave Rolsky.
83
84 This is free software, licensed under:
85
86 The Artistic License 2.0 (GPL Compatible)
87
88 The full text of the license can be found in the LICENSE file included
89 with this distribution.
90
91
92
93perl v5.30.1 Da2t0e2T0i-m0e1:-:2F9ormat::Builder::Parser::Dispatch(3)