1DateTime::Format::BuildUesre:r:PCaornsterri:bD:uagtteeendTeirPmieecr:(l:3F)Doorcmuamte:n:tBautiilodner::Parser::generic(3)
2
3
4

NAME

6       DateTime::Format::Builder::Parser::generic - Useful routines
7

METHODS

9       Useful
10
11       new
12
13       Standard constructor. Returns a blessed hash; any arguments are placed
14       in the hash. This is useful for storing information between methods.
15
16       generic_parser
17
18       This is a method provided solely for the benefit of "Parser" implemen‐
19       tations. It semi-neatly abstracts a lot of the work involved.
20
21       Basically, it takes parameters matching the assorted callbacks from the
22       parser declarations and makes a coderef out of it all.
23
24       Currently recognized callbacks are:
25
26       ·   on_match
27
28       ·   on_fail
29
30       ·   preprocess
31
32       ·   postprocess
33
34       Methods for subclassing
35
36       These are methods you should define when writing your own subclass.
37
38       Note: these methods do not exist in this class. There is no point try‐
39       ing to call "$self->SUPER::do_match( ... )".
40
41       do_match
42
43       "do_match" is the first phase. Arguments are the date and @args.
44       "self", "label", "args". Return value must be defined if you match suc‐
45       cessfully.
46
47       post_match
48
49       "post_match" is called after the appropriate callback out of
50       "on_match"/"on_fail" is done. It's passed the date, the return value
51       from "do_match" and the parsing hash.
52
53       Its return value is used as the "post" argument to the "postprocess"
54       callback, and as the second argument to "make".
55
56       make
57
58       "make" takes the original input, the return value from "post_match" and
59       the parsing hash and should return a "DateTime" object or undefined.
60
61       Delegations
62
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

WRITING A SUBCLASS

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

THANKS

79       See DateTime::Format::Builder.
80

SUPPORT

82       Support for this module is provided via the datetime@perl.org email
83       list. See http://lists.perl.org/ for more details.
84
85       Alternatively, log them via the CPAN RT system via the web or email:
86
87           http://perl.dellah.org/rt/dtbuilder
88           bug-datetime-format-builder@rt.cpan.org
89
90       This makes it much easier for me to track things and thus means your
91       problem is less likely to be neglected.
92
94       Copyright (C) Iain Truskett, 2003. All rights reserved.
95
96       This library is free software; you can redistribute it and/or modify it
97       under the same terms as Perl itself, either Perl version 5.000 or, at
98       your option, any later version of Perl 5 you may have available.
99
100       The full text of the licences can be found in the Artistic and COPYING
101       files included with this module, or in perlartistic and perlgpl as sup‐
102       plied with Perl 5.8.1 and later.
103

AUTHOR

105       Iain Truskett <spoon@cpan.org>
106

SEE ALSO

108       "datetime@perl.org" mailing list.
109
110       http://datetime.perl.org/
111
112       perl, DateTime, DateTime::Format::Builder, DateTime::For‐
113       mat::Builder::Parser.
114
115
116
117perl v5.8.8                      D2a0t0e8T-i0m2e-:0:1Format::Builder::Parser::generic(3)
Impressum