1DateTime::Format::BuildUesre:r:PCaornsterri:b:uQtDueaidtcekPT(ei3rm)le:D:oFcourmmeantt:a:tBiuoinlder::Parser::Quick(3)
2
3
4
6 DateTime::Format::Builder::Parser::Quick - Use another formatter,
7 simply
8
10 version 0.83
11
13 use DateTime::Format::Builder (
14 parsers => {
15 parse_datetime => [
16 { Quick => 'DateTime::Format::HTTP' },
17 { Quick => 'DateTime::Format::Mail' },
18 { Quick => 'DateTime::Format::IBeat' },
19 ]
20 }
21 );
22
23 # is the same as
24
25 use DateTime::Format::HTTP;
26 use DateTime::Format::Mail;
27 use DateTime::Format::IBeat;
28
29 use DateTime::Format::Builder (
30 parsers => {
31 parse_datetime => [
32 sub {
33 eval { DateTime::Format::HTTP->parse_datetime( $_[1] ) }
34 },
35 sub {
36 eval { DateTime::Format::Mail->parse_datetime( $_[1] ) }
37 },
38 sub {
39 eval { DateTime::Format::IBeat->parse_datetime( $_[1] ) }
40 },
41 ]
42 }
43 );
44
45 (These two pieces of code can both be found in the test suite; one as
46 quick.t, the other as fall.t.)
47
49 "Quick" adds a parser that allows some shortcuts when writing fairly
50 standard and mundane calls to other formatting modules.
51
53 "Quick" has two keys, one optional.
54
55 The "Quick" keyword should have an argument of either an object or a
56 class name. If it's a class name then the class is "use"d.
57
58 The "method" keyword is optional with a default of "parse_datetime".
59 It's either name of the method to invoke on the object, or a reference
60 to a piece of code.
61
62 In any case, the resultant code ends up looking like:
63
64 my $rv = $Quick->$method($date);
65
67 "datetime@perl.org" mailing list.
68
69 http://datetime.perl.org/
70
71 perl, DateTime, DateTime::Format::Builder
72
74 Bugs may be submitted at
75 <https://github.com/houseabsolute/DateTime-Format-Builder/issues>.
76
77 I am also usually active on IRC as 'autarch' on "irc://irc.perl.org".
78
80 The source code repository for DateTime-Format-Builder can be found at
81 <https://github.com/houseabsolute/DateTime-Format-Builder>.
82
84 • Dave Rolsky <autarch@urth.org>
85
86 • Iain Truskett <spoon@cpan.org>
87
89 This software is Copyright (c) 2020 by Dave Rolsky.
90
91 This is free software, licensed under:
92
93 The Artistic License 2.0 (GPL Compatible)
94
95 The full text of the license can be found in the LICENSE file included
96 with this distribution.
97
98
99
100perl v5.38.0 20D2a3t-e0T7i-m2e0::Format::Builder::Parser::Quick(3)