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.83
10
12 package SampleDispatch;
13 use DateTime::Format::Builder (
14 parsers => {
15 parse_datetime => [
16 {
17 Dispatch => sub {
18 return 'fnerk';
19 }
20 }
21 ]
22 },
23 groups => {
24 fnerk => [
25 {
26 regex => qr/^(\d{4})(\d\d)(\d\d)$/,
27 params => [qw( year month day )],
28 },
29 ]
30 }
31 );
32
34 "Dispatch" adds another parser type to "Builder" permitting dispatch of
35 parsing according to group names.
36
38 "Dispatch" has just one key: "Dispatch". The value should be a
39 reference to a subroutine that returns one of:
40
41 • "undef", meaning no groups could be found.
42
43 • An empty list, meaning no groups could be found.
44
45 • A single string, meaning: use this group
46
47 • A list of strings, meaning: use these groups in this order.
48
49 Groups are specified much like the example in the SYNOPSIS. They follow
50 the same format as when you specify them for methods.
51
53 Your group parser can also be a Dispatch parser. Thus you could
54 potentially end up with an infinitely recursive parser.
55
57 "datetime@perl.org" mailing list.
58
59 http://datetime.perl.org/
60
61 perl, DateTime, DateTime::Format::Builder
62
64 Bugs may be submitted at
65 <https://github.com/houseabsolute/DateTime-Format-Builder/issues>.
66
67 I am also usually active on IRC as 'autarch' on "irc://irc.perl.org".
68
70 The source code repository for DateTime-Format-Builder can be found at
71 <https://github.com/houseabsolute/DateTime-Format-Builder>.
72
74 • Dave Rolsky <autarch@urth.org>
75
76 • Iain Truskett <spoon@cpan.org>
77
79 This software is Copyright (c) 2020 by Dave Rolsky.
80
81 This is free software, licensed under:
82
83 The Artistic License 2.0 (GPL Compatible)
84
85 The full text of the license can be found in the LICENSE file included
86 with this distribution.
87
88
89
90perl v5.34.0 Da2t0e2T1i-m0e7:-:2F2ormat::Builder::Parser::Dispatch(3)