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 Useful
10 new
11
12 Standard constructor. Returns a blessed hash; any arguments are placed
13 in the hash. This is useful for storing information between methods.
14
15 generic_parser
16
17 This is a method provided solely for the benefit of "Parser"
18 implementations. It semi-neatly abstracts a lot of the work involved.
19
20 Basically, it takes parameters matching the assorted callbacks from the
21 parser declarations and makes a coderef out of it all.
22
23 Currently recognized callbacks are:
24
25 · on_match
26
27 · on_fail
28
29 · preprocess
30
31 · postprocess
32
33 Methods for subclassing
34 These are methods you should define when writing your own subclass.
35
36 Note: these methods do not exist in this class. There is no point
37 trying to call "$self->SUPER::do_match( ... )".
38
39 do_match
40
41 "do_match" is the first phase. Arguments are the date and @args.
42 "self", "label", "args". Return value must be defined if you match
43 successfully.
44
45 post_match
46
47 "post_match" is called after the appropriate callback out of
48 "on_match"/"on_fail" is done. It's passed the date, the return value
49 from "do_match" and the parsing hash.
50
51 Its return value is used as the "post" argument to the "postprocess"
52 callback, and as the second argument to "make".
53
54 make
55
56 "make" takes the original input, the return value from "post_match" and
57 the parsing hash and should return a "DateTime" object or undefined.
58
59 Delegations
60 For use of "Parser", this module also delegates "valid_params" and
61 "params". This is just convenience to save typing the following:
62
63 DateTime::Format::Builder::Parser->valid_params( blah )
64
65 Instead we get to type:
66
67 $self->valid_params( blah );
68 __PACKAGE__->valid_params( blah );
69
71 Rather than attempt to explain how it all works, I think it's best if
72 you take a look at Regex.pm and Strptime.pm as examples and work from
73 there.
74
76 See DateTime::Format::Builder.
77
79 Support for this module is provided via the datetime@perl.org email
80 list. See http://lists.perl.org/ for more details.
81
82 Alternatively, log them via the CPAN RT system via the web or email:
83
84 http://perl.dellah.org/rt/dtbuilder
85 bug-datetime-format-builder@rt.cpan.org
86
87 This makes it much easier for me to track things and thus means your
88 problem is less likely to be neglected.
89
91 Copyright (C) Iain Truskett, 2003. All rights reserved.
92
93 This library is free software; you can redistribute it and/or modify it
94 under the same terms as Perl itself, either Perl version 5.000 or, at
95 your option, any later version of Perl 5 you may have available.
96
97 The full text of the licences can be found in the Artistic and COPYING
98 files included with this module, or in perlartistic and perlgpl as
99 supplied with Perl 5.8.1 and later.
100
102 Iain Truskett <spoon@cpan.org>
103
105 "datetime@perl.org" mailing list.
106
107 http://datetime.perl.org/
108
109 perl, DateTime, DateTime::Format::Builder,
110 DateTime::Format::Builder::Parser.
111
112
113
114perl v5.12.0 D2a0t1e0T-i0m5e-:1:4Format::Builder::Parser::generic(3)