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.83
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(...)
67
68 Instead we get to type:
69
70 $self->valid_params(...);
71 __PACKAGE__->valid_params(...);
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 <https://github.com/houseabsolute/DateTime-Format-Builder/issues>.
89
90 I am also usually active on IRC as 'autarch' on "irc://irc.perl.org".
91
93 The source code repository for DateTime-Format-Builder can be found at
94 <https://github.com/houseabsolute/DateTime-Format-Builder>.
95
97 · Dave Rolsky <autarch@urth.org>
98
99 · Iain Truskett <spoon@cpan.org>
100
102 This software is Copyright (c) 2020 by Dave Rolsky.
103
104 This is free software, licensed under:
105
106 The Artistic License 2.0 (GPL Compatible)
107
108 The full text of the license can be found in the LICENSE file included
109 with this distribution.
110
111
112
113perl v5.32.0 D2a0t2e0T-i0m8e-:1:0Format::Builder::Parser::generic(3)