1DateTime::Format::BuildUesre:r:PCaornsterri:bD:uagtteeendTeirPmieecr:(l:3F)Doorcmuamte:n:tBautiilodner::Parser::generic(3)
2
3
4
6 DateTime::Format::Builder::Parser::generic - Useful routines
7
9 version 0.82
10
12 Useful
13 new
14
15 Standard constructor. Returns a blessed hash; any arguments are placed
16 in the hash. This is useful for storing information between methods.
17
18 generic_parser
19
20 This is a method provided solely for the benefit of "Parser"
21 implementations. It semi-neatly abstracts a lot of the work involved.
22
23 Basically, it takes parameters matching the assorted callbacks from the
24 parser declarations and makes a coderef out of it all.
25
26 Currently recognized callbacks are:
27
28 · on_match
29
30 · on_fail
31
32 · preprocess
33
34 · postprocess
35
36 Methods for subclassing
37 These are methods you should define when writing your own subclass.
38
39 Note: these methods do not exist in this class. There is no point
40 trying to call "$self->SUPER::do_match( ... )".
41
42 do_match
43
44 "do_match" is the first phase. Arguments are the date and @args.
45 "self", "label", "args". Return value must be defined if you match
46 successfully.
47
48 post_match
49
50 "post_match" is called after the appropriate callback out of
51 "on_match"/"on_fail" is done. It's passed the date, the return value
52 from "do_match" and the parsing hash.
53
54 Its return value is used as the "post" argument to the "postprocess"
55 callback, and as the second argument to "make".
56
57 make
58
59 "make" takes the original input, the return value from "post_match" and
60 the parsing hash and should return a "DateTime" object or undefined.
61
62 Delegations
63 For use of "Parser", this module also delegates "valid_params" and
64 "params". This is just convenience to save typing the following:
65
66 DateTime::Format::Builder::Parser->valid_params( blah )
67
68 Instead we get to type:
69
70 $self->valid_params( blah );
71 __PACKAGE__->valid_params( blah );
72
74 Rather than attempt to explain how it all works, I think it's best if
75 you take a look at Regex.pm and Strptime.pm as examples and work from
76 there.
77
79 "datetime@perl.org" mailing list.
80
81 http://datetime.perl.org/
82
83 perl, DateTime, DateTime::Format::Builder,
84 DateTime::Format::Builder::Parser.
85
87 Bugs may be submitted at
88 <http://rt.cpan.org/Public/Dist/Display.html?Name=DateTime-Format-Builder>
89 or via email to bug-datetime-format-builder@rt.cpan.org <mailto:bug-
90 datetime-format-builder@rt.cpan.org>.
91
92 I am also usually active on IRC as 'autarch' on "irc://irc.perl.org".
93
95 The source code repository for DateTime-Format-Builder can be found at
96 <https://github.com/houseabsolute/DateTime-Format-Builder>.
97
99 · Dave Rolsky <autarch@urth.org>
100
101 · Iain Truskett
102
104 This software is Copyright (c) 2019 by Dave Rolsky.
105
106 This is free software, licensed under:
107
108 The Artistic License 2.0 (GPL Compatible)
109
110 The full text of the license can be found in the LICENSE file included
111 with this distribution.
112
113
114
115perl v5.30.0 D2a0t1e9T-i0m7e-:2:6Format::Builder::Parser::generic(3)