[html-formfu] HTML::FormFu::Inflator::DateTime
Carl Franks
fireartist at gmail.com
Fri Aug 1 11:50:02 BST 2008
2008/7/31 Will Hawes <wdhawes at gmail.com>:
> The docs for HTML::FormFu::Inflator::DateTime have the following
> (slightly boiled down) example:
>
> - type: Text
> name: end_time
> inflators:
> - type: DateTime
> parser:
> regex: '^ (\d{2}) - (\d{2}) - (\d{4}) $'
>
> On my machine, with HTML::FormFu 0.3001 and DateTime::Format::Builder
> 0.7901, this results in:
>
> Caught exception in ... "The 'regex' parameter ("^ (\d{2}) - (\d{2}) -
> (\d{4}) $") to DateTime::Format::Builder::Parser::create_single_parser
> was a 'scalar', which is not one of the allowed types: scalarref
> at /usr/local/share/perl/5.8.8/DateTime/Format/Builder/Parser.pm line 311
>
> DateTime::Format::Builder::Parser expects the "regex" parameter to be
> a scalar ref containing a compiled regex, so the string supplied in
> the example won't work. This patch fixes it:
I've made it a little more robust, by only making it a regex object
when it's not already one.
There was already a test - unfortunately, it didn't build the form
from a config file, so it was already using a regex object, which is
why it didn't trigger the bug.
> Any objections to me committing this? Anything I've missed?
Oops, sorry - I already committed it before I read down this far!
Thanks!
Carl
More information about the HTML-FormFu
mailing list