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 package SampleDispatch;
10 use DateTime::Format::Builder
11 (
12 parsers => {
13 parse_datetime => [
14 {
15 Dispatch => sub {
16 return 'fnerk';
17 }
18 }
19 ]
20 },
21 groups => {
22 fnerk => [
23 {
24 regex => qr/^(\d{4})(\d\d)(\d\d)$/,
25 params => [qw( year month day )],
26 },
27 ]
28 }
29 );
30
32 "Dispatch" adds another parser type to "Builder" permitting dispatch of
33 parsing according to group names.
34
36 "Dispatch" has just one key: "Dispatch". The value should be a
37 reference to a subroutine that returns one of:
38
39 · "undef", meaning no groups could be found.
40
41 · An empty list, meaning no groups could be found.
42
43 · A single string, meaning: use this group
44
45 · A list of strings, meaning: use these groups in this order.
46
47 Groups are specified much like the example in the SYNOPSIS. They
48 follow the same format as when you specify them for methods.
49
51 Your group parser can also be a Dispatch parser. Thus you could
52 potentially end up with an infinitely recursive parser.
53
55 See the main module's section.
56
58 Support for this module is provided via the datetime@perl.org email
59 list. See http://lists.perl.org/ for more details.
60
61 Alternatively, log them via the CPAN RT system via the web or email:
62
63 http://perl.dellah.org/rt/dtbuilder
64 bug-datetime-format-builder@rt.cpan.org
65
66 This makes it much easier for me to track things and thus means your
67 problem is less likely to be neglected.
68
70 Copyright (C) Iain Truskett, 2003. All rights reserved.
71
72 This library is free software; you can redistribute it and/or modify it
73 under the same terms as Perl itself, either Perl version 5.000 or, at
74 your option, any later version of Perl 5 you may have available.
75
76 The full text of the licences can be found in the Artistic and COPYING
77 files included with this module, or in perlartistic and perlgpl as
78 supplied with Perl 5.8.1 and later.
79
81 Iain Truskett <spoon@cpan.org>
82
84 "datetime@perl.org" mailing list.
85
86 http://datetime.perl.org/
87
88 perl, DateTime, DateTime::Format::Builder
89
90
91
92perl v5.12.0 Da2t0e1T0i-m0e5:-:1F4ormat::Builder::Parser::Dispatch(3)