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.82
11
13 use DateTime::Format::Builder (
14 parsers => { parse_datetime => [
15 { Quick => 'DateTime::Format::HTTP' },
16 { Quick => 'DateTime::Format::Mail' },
17 { Quick => 'DateTime::Format::IBeat' },
18 ]});
19
20 is the same as:
21
22 use DateTime::Format::HTTP;
23 use DateTime::Format::Mail;
24 use DateTime::Format::IBeat;
25
26 use DateTime::Format::Builder (
27 parsers => { parse_datetime => [
28 sub { eval { DateTime::Format::HTTP->parse_datetime( $_[1] ) } },
29 sub { eval { DateTime::Format::Mail->parse_datetime( $_[1] ) } },
30 sub { eval { DateTime::Format::IBeat->parse_datetime( $_[1] ) } },
31 ]});
32
33 (These two pieces of code can both be found in the test suite; one as
34 quick.t, the other as fall.t.)
35
37 "Quick" adds a parser that allows some shortcuts when writing fairly
38 standard and mundane calls to other formatting modules.
39
41 "Quick" has two keys, one optional.
42
43 The "Quick" keyword should have an argument of either an object or a
44 class name. If it's a class name then the class is "use"d.
45
46 The "method" keyword is optional with a default of "parse_datetime".
47 It's either name of the method to invoke on the object, or a reference
48 to a piece of code.
49
50 In any case, the resultant code ends up looking like:
51
52 my $rv = $Quick->$method( $date );
53
55 "datetime@perl.org" mailing list.
56
57 http://datetime.perl.org/
58
59 perl, DateTime, DateTime::Format::Builder
60
62 Bugs may be submitted at
63 <http://rt.cpan.org/Public/Dist/Display.html?Name=DateTime-Format-Builder>
64 or via email to bug-datetime-format-builder@rt.cpan.org <mailto:bug-
65 datetime-format-builder@rt.cpan.org>.
66
67 I am also usually active on IRC as 'autarch' on "irc://irc.perl.org".
68
70 The source code repository for DateTime-Format-Builder can be found at
71 <https://github.com/houseabsolute/DateTime-Format-Builder>.
72
74 · Dave Rolsky <autarch@urth.org>
75
76 · Iain Truskett
77
79 This software is Copyright (c) 2019 by Dave Rolsky.
80
81 This is free software, licensed under:
82
83 The Artistic License 2.0 (GPL Compatible)
84
85 The full text of the license can be found in the LICENSE file included
86 with this distribution.
87
88
89
90perl v5.30.1 20D2a0t-e0T1i-m2e9::Format::Builder::Parser::Quick(3)