Skip Menu |

This queue is for tickets about the DateTime-Format-Builder CPAN distribution.

Report information
The Basics
Id: 4477
Status: resolved
Worked: 10 min
Priority: 0/
Queue: DateTime-Format-Builder

People
Owner: spoon [...] cpan.org
Requestors: jhoblitt [...] ifa.hawaii.edu
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Date: Mon, 24 Nov 2003 18:57:22 -1000 (HST)
From: Joshua Hoblitt <jhoblitt [...] ifa.hawaii.edu>
To: "Iain 'Spoon' Truskett" <spoon [...] cpan.org>
Subject: DT::F::Builder Dispatch bug?
Hi Iain, Did I miss something or is this a bug? -J -- #!/usr/bin/perl use strict; use warnings; package testDispatch; use DateTime::Format::Builder; DateTime::Format::Builder->create_class( parsers => { parse_datetime => [ { Dispatch => sub { return( 8, 6 ); } }, ], }, groups => { 8 => [ { regex => qr/^ (\d{4}) (\d\d) (\d\d) $/x, params => [ qw( year month day ) ], }, ], 6 => [ { regex => qr/^ (\d{4}) (\d\d) $/x, params => [ qw( year month ) ], }, ], } ); package main; my $dt = testDispatch->parse_datetime( 200311 ); print $dt->iso8601;
Subject: Re: DT::F::Builder Dispatch bug?
[jhoblitt@ifa.hawaii.edu - Tue Nov 25 01:08:49 2003]: Show quoted text
> Hi Iain, > > Did I miss something or is this a bug?
*I* missed something. A decent test suite. Fixed. cheers, -- Iain.
[jhoblitt@ifa.hawaii.edu - Tue Nov 25 02:08:53 2003]: Show quoted text
> On Tue, 25 Nov 2003, Iain Truskett via RT wrote:
> > *I* missed something. A decent test suite.
> > The next release of ISO8601 might count. :)
Good, good =) Show quoted text
> Is it possible to call non-group parsers from a Dispatch sub? > I want to define some parsers in terms of other parsers but > have all of them externally visible.
Remember that all the data structures are reference based. Thus you can happily refer to other bits of the structure at any point. You might want to call import explicitly at runtime rather than compile time (with the use) or put the data structure in BEGIN { .. } blocks while fiddling with it. And there's no memory penalty from doing this either. cheers, Iain.