On 07/20/10 02:19, Peter Rabbitson wrote:
On Mon, Jul 19, 2010 at 05:08:50PM +0400, Alex Povolotsky wrote:
Hello!
How do I explicitly specify parser for
DBIx::Class::InflateColumn::DateTime explicitly?
I'd like to parse incoming dates with DateTime::Format::ISO8601
What do you mean by this? You have an existing database with
ISO8601 in a varchar column? Or something completely different?
Please describe your scenario so you can be pointed to the most
fitting solution.
I'm receiving some XML data from external source, with DD.MM.YYYY
formatting.
Here is the code
my $data = $c->req->param('data');
my $model: Stashed;
my $parser = XML::Simple->new();
eval {
if ($data gt '') {
my $ref = $parser->XMLin($data);
$model->txn_do(sub {
my $recs = wrap_array($ref->{RECORD});
foreach my $rec (@$recs) {
my $table = lc($rec->{table});
my $rsname = "\u$table";
my $field = $rec->{FIELD};
my $cooked = { map { lc($_) =>
$field->{$_}->{value}} keys %$field };
$model->resultset($rsname)->update_or_create($cooked);
}
});
$xg->status(200);
$xg->add('dbsn', undef, $model->resultset('Dbsn')->id_max());
} else {
$xg->error(400, 'Нет данных');
}
};
DD.MM.YYYY gets parsed, by default, as YY.MM.DD, which is quite wrong. I
need to use more controllable parser...
Alex.
_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[email protected]