Mercurial > pub > buggler
comparison lib/Benzin/Bugzilla/XmlRpcDeserializer.pm @ 10:14a966369278
working version of exporting bugs from bugzilla in tj3 format (without bookings)
| author | cin |
|---|---|
| date | Mon, 07 Sep 2015 01:37:11 +0300 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 9:cc7244ab1b9f | 10:14a966369278 |
|---|---|
| 1 package Benzin::Bugzilla::XmlRpcDeserializer; | |
| 2 use strict; | |
| 3 use mro; | |
| 4 use parent qw(-norequire XMLRPC::Deserializer); | |
| 5 use IMPL::require { Strptime => 'DateTime::Format::Strptime' }; | |
| 6 | |
| 7 my $xmlRpcDateFormat = Strptime->new( | |
| 8 pattern => '%Y%m%dT%H:%M:%S', | |
| 9 time_zone => 'UTC', | |
| 10 on_error => 'croak' | |
| 11 ); | |
| 12 | |
| 13 sub decode_value { | |
| 14 my $this = shift; | |
| 15 my ( $name, $attrs, $children, $value ) = @{ $_[0] }; | |
| 16 | |
| 17 if ( $name eq 'dateTime.iso8601' ) { | |
| 18 return $xmlRpcDateFormat->parse_datetime($value); | |
| 19 } | |
| 20 else { | |
| 21 $this->next::method(@_); | |
| 22 } | |
| 23 | |
| 24 } | |
| 25 | |
| 26 1; | |
| 27 | |
| 28 __END__ | |
| 29 | |
| 30 =pod | |
| 31 | |
| 32 =head1 NAME | |
| 33 | |
| 34 C<Benzin::Bugzilla::XmlRpcDeserializer> - data deserializer for L<XMLRPC::Lite>. | |
| 35 | |
| 36 =head1 SYNOPSIS | |
| 37 | |
| 38 =begin code perl | |
| 39 | |
| 40 # override the default deserializer | |
| 41 my $client = XMLRPC::Lite->new( | |
| 42 deserializer => Benzin::Bugzilla::XmlRpcDeserializer->new() | |
| 43 ); | |
| 44 | |
| 45 =end code perl | |
| 46 | |
| 47 =head1 DESCRIPTION | |
| 48 | |
| 49 Slightly tuned C<XMLRPC::Deserializer> to parse C<dateTime.iso8601> values to L<DateTime> objects. | |
| 50 | |
| 51 =cut |
