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.81
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 See DateTime::Format::Builder for details.
56
58 "datetime@perl.org" mailing list.
59
60 http://datetime.perl.org/
61
62 perl, DateTime, DateTime::Format::Builder
63
65 · Dave Rolsky <autarch@urth.org>
66
67 · Iain Truskett
68
70 This software is Copyright (c) 2013 by Dave Rolsky.
71
72 This is free software, licensed under:
73
74 The Artistic License 2.0 (GPL Compatible)
75
76
77
78perl v5.28.0 20D1a8t-e0T7i-m1e4::Format::Builder::Parser::Quick(3)