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.81
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 See DateTime::Format::Builder for details.
59
61 "datetime@perl.org" mailing list.
62
63 http://datetime.perl.org/
64
65 perl, DateTime, DateTime::Format::Builder
66
68 · Dave Rolsky <autarch@urth.org>
69
70 · Iain Truskett
71
73 This software is Copyright (c) 2013 by Dave Rolsky.
74
75 This is free software, licensed under:
76
77 The Artistic License 2.0 (GPL Compatible)
78
79
80
81perl v5.28.0 Da2t0e1T8i-m0e7:-:1F4ormat::Builder::Parser::Dispatch(3)