r46792 - in /branches/upstream/libdatetime-format-w3cdtf-perl/current: Build.PL Changes MANIFEST META.yml Makefile.PL README SIGNATURE lib/DateTime/Format/W3CDTF.pm t/01parse.t t/02bugs.t

jawnsy-guest at users.alioth.debian.org jawnsy-guest at users.alioth.debian.org
Thu Nov 5 15:22:49 UTC 2009


Author: jawnsy-guest
Date: Thu Nov  5 15:22:35 2009
New Revision: 46792

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=46792
Log:
[svn-upgrade] Integrating new upstream version, libdatetime-format-w3cdtf-perl (0.05)

Added:
    branches/upstream/libdatetime-format-w3cdtf-perl/current/Build.PL
    branches/upstream/libdatetime-format-w3cdtf-perl/current/META.yml
    branches/upstream/libdatetime-format-w3cdtf-perl/current/SIGNATURE
Modified:
    branches/upstream/libdatetime-format-w3cdtf-perl/current/Changes
    branches/upstream/libdatetime-format-w3cdtf-perl/current/MANIFEST
    branches/upstream/libdatetime-format-w3cdtf-perl/current/Makefile.PL
    branches/upstream/libdatetime-format-w3cdtf-perl/current/README
    branches/upstream/libdatetime-format-w3cdtf-perl/current/lib/DateTime/Format/W3CDTF.pm
    branches/upstream/libdatetime-format-w3cdtf-perl/current/t/01parse.t
    branches/upstream/libdatetime-format-w3cdtf-perl/current/t/02bugs.t

Added: branches/upstream/libdatetime-format-w3cdtf-perl/current/Build.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdatetime-format-w3cdtf-perl/current/Build.PL?rev=46792&op=file
==============================================================================
--- branches/upstream/libdatetime-format-w3cdtf-perl/current/Build.PL (added)
+++ branches/upstream/libdatetime-format-w3cdtf-perl/current/Build.PL Thu Nov  5 15:22:35 2009
@@ -1,0 +1,29 @@
+use strict;
+use warnings;
+
+use Module::Build;
+
+my $builder = Module::Build->new(
+    module_name => 'DateTime::Format::W3CDTF',
+    license     => 'perl',
+    requires    => {
+        'DateTime' => '0',
+    },
+    build_requires => {
+        'Test::More' => '0',
+    },
+    create_readme      => 1,
+    sign               => 1,
+    create_makefile_pl => 'traditional',
+    meta_merge         => {
+        resources => {
+            homepage => 'http://datetime.perl.org/',
+            bugtracker =>
+                'http://rt.cpan.org/NoAuth/Bugs.html?Dist=DateTime-Format-W3CDTF',
+            repository =>
+                'https://perl-date-time.svn.sourceforge.net/svnroot/perl-date-time',
+        },
+    },
+);
+
+$builder->create_build_script();

Modified: branches/upstream/libdatetime-format-w3cdtf-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdatetime-format-w3cdtf-perl/current/Changes?rev=46792&op=diff
==============================================================================
--- branches/upstream/libdatetime-format-w3cdtf-perl/current/Changes (original)
+++ branches/upstream/libdatetime-format-w3cdtf-perl/current/Changes Thu Nov  5 15:22:35 2009
@@ -1,3 +1,10 @@
+0.05  2009-11-01
+
+- Fixed a long-standing bug where a time zone other than UTC that had an
+  offset of 0 caused the format_datetime method to return the string "0". RT
+  #22802.
+
+
 0.04  2003-11-23
 
 - Changed behaviour of format_datetime to always return a full timestamp

Modified: branches/upstream/libdatetime-format-w3cdtf-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdatetime-format-w3cdtf-perl/current/MANIFEST?rev=46792&op=diff
==============================================================================
--- branches/upstream/libdatetime-format-w3cdtf-perl/current/MANIFEST (original)
+++ branches/upstream/libdatetime-format-w3cdtf-perl/current/MANIFEST Thu Nov  5 15:22:35 2009
@@ -1,7 +1,12 @@
+Build.PL
 Changes
-MANIFEST
+lib/DateTime/Format/W3CDTF.pm
+LICENSE
 Makefile.PL
+MANIFEST			This list of files
+META.yml
 README
-lib/DateTime/Format/W3CDTF.pm
 t/00load.t
 t/01parse.t
+t/02bugs.t
+SIGNATURE    Added here by Module::Build

Added: branches/upstream/libdatetime-format-w3cdtf-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdatetime-format-w3cdtf-perl/current/META.yml?rev=46792&op=file
==============================================================================
--- branches/upstream/libdatetime-format-w3cdtf-perl/current/META.yml (added)
+++ branches/upstream/libdatetime-format-w3cdtf-perl/current/META.yml Thu Nov  5 15:22:35 2009
@@ -1,0 +1,26 @@
+---
+name: DateTime-Format-W3CDTF
+version: 0.05
+author:
+  - 'Dave Rolsky E<lt>autarch at urth.orgE<gt>'
+abstract: Parse and format W3CDTF datetime strings
+license: perl
+resources:
+  bugtracker: http://rt.cpan.org/NoAuth/Bugs.html?Dist=DateTime-Format-W3CDTF
+  homepage: http://datetime.perl.org/
+  license: http://dev.perl.org/licenses/
+  repository: https://perl-date-time.svn.sourceforge.net/svnroot/perl-date-time
+build_requires:
+  Test::More: 0
+requires:
+  DateTime: 0
+configure_requires:
+  Module::Build: 0.35
+provides:
+  DateTime::Format::W3CDTF:
+    file: lib/DateTime/Format/W3CDTF.pm
+    version: 0.05
+generated_by: Module::Build version 0.35
+meta-spec:
+  url: http://module-build.sourceforge.net/META-spec-v1.4.html
+  version: 1.4

Modified: branches/upstream/libdatetime-format-w3cdtf-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdatetime-format-w3cdtf-perl/current/Makefile.PL?rev=46792&op=diff
==============================================================================
--- branches/upstream/libdatetime-format-w3cdtf-perl/current/Makefile.PL (original)
+++ branches/upstream/libdatetime-format-w3cdtf-perl/current/Makefile.PL Thu Nov  5 15:22:35 2009
@@ -1,9 +1,15 @@
- use ExtUtils::MakeMaker;
-
-WriteMakefile(
-        'NAME'		=> 'DateTime::Format::W3CDTF',
-        'VERSION_FROM' 	=> 'lib/DateTime/Format/W3CDTF.pm',
-        'PREREQ_PM' 	=> { 'DateTime' => 0 },
-        'ABSTRACT'	=> 'Formatting and parsing of W3CDTF dates',
-        'AUTHOR' 	=> 'Kellan Elliott-McCrea <kellan at protest.net>'
- );
+# Note: this file was auto-generated by Module::Build::Compat version 0.35
+use ExtUtils::MakeMaker;
+WriteMakefile
+(
+          'NAME' => 'DateTime::Format::W3CDTF',
+          'VERSION_FROM' => 'lib/DateTime/Format/W3CDTF.pm',
+          'PREREQ_PM' => {
+                           'DateTime' => '0',
+                           'Test::More' => '0'
+                         },
+          'INSTALLDIRS' => 'site',
+          'EXE_FILES' => [],
+          'PL_FILES' => {}
+        )
+;

Modified: branches/upstream/libdatetime-format-w3cdtf-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdatetime-format-w3cdtf-perl/current/README?rev=46792&op=diff
==============================================================================
--- branches/upstream/libdatetime-format-w3cdtf-perl/current/README (original)
+++ branches/upstream/libdatetime-format-w3cdtf-perl/current/README Thu Nov  5 15:22:35 2009
@@ -1,19 +1,77 @@
-This module handles formatting and parsing of W3CDTF, a W3C sponsored, simplified
-profile of ISO 8601 for the Web.  See: http://www.w3.org/TR/NOTE-datetime
+NAME
+    DateTime::Format::W3CDTF - Parse and format W3CDTF datetime strings
 
-This is the native date/time format for Dublin Core, and RSS.
+SYNOPSIS
+      use DateTime::Format::W3CDTF;
 
-INSTALLATION
+      my $w3c = DateTime::Format::W3CDTF->new;
+      my $dt = $w3c->parse_datetime( '2003-02-15T13:50:05-05:00' );
 
-To install this module type the following in the distribution
-directory:
+      # 2003-02-15T13:50:05-05:00
+      $w3c->format_datetime($dt);
 
-   perl Makefile.PL
-   make
-   make test
-   make install
+DESCRIPTION
+    This module understands the W3CDTF date/time format, an ISO 8601
+    profile, defined at http://www.w3.org/TR/NOTE-datetime. This format as
+    the native date format of RSS 1.0.
 
-NOTE
+    It can be used to parse these formats in order to create the appropriate
+    objects.
 
-Currently fractional seconds aren't supported by DateTime.pm, and therefore this
-module does not support that part of W3CDTF.
+METHODS
+    This API is currently experimental and may change in the future.
+
+    * parse_datetime($string)
+        Given a W3CDTF datetime string, this method will return a new
+        `DateTime' object.
+
+        If given an improperly formatted string, this method may die.
+
+    * format_datetime($datetime)
+        Given a `DateTime' object, this methods returns a W3CDTF datetime
+        string.
+
+        NOTE: As of version 0.4, format_datetime no longer attempts to
+        truncate datetimes without a time component. This is due to the fact
+        that `DateTime' doesn't distinguish between a date with no time
+        component, and midnight.
+
+    * format_date($datetime)
+        Given a `DateTime' object, return a W3CDTF datetime string without
+        the time component.
+
+SUPPORT
+    Support for this module is provided via the datetime at perl.org email
+    list. See http://datetime.perl.org/?MailingList for details.
+
+    Please submit bugs to the CPAN RT system at
+    http://rt.cpan.org/NoAuth/ReportBug.html?Queue=datetime-format-w3cdtf or
+    via email at bug-datetime-format-w3cdtf at rt.cpan.org.
+
+AUTHOR
+    Dave Rolsky <autarch at urth.org>
+
+CREDITS
+    This module was originally created by Kellan Elliott-McCrea
+    <kellan at protest.net>.
+
+    This module was inspired by DateTime::Format::ICal
+
+COPYRIGHT
+    Copyright (c) 2009 David Rolsky. All rights reserved. This program is
+    free software; you can redistribute it and/or modify it under the same
+    terms as Perl itself.
+
+    Copyright (c) 2003 Kellan Elliott-McCrea
+
+    Portions of the code in this distribution are derived from other works.
+    Please see the CREDITS file for more details.
+
+    The full text of the license can be found in the LICENSE file included
+    with this module.
+
+SEE ALSO
+    datetime at perl.org mailing list
+
+    http://datetime.perl.org/
+

Added: branches/upstream/libdatetime-format-w3cdtf-perl/current/SIGNATURE
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdatetime-format-w3cdtf-perl/current/SIGNATURE?rev=46792&op=file
==============================================================================
--- branches/upstream/libdatetime-format-w3cdtf-perl/current/SIGNATURE (added)
+++ branches/upstream/libdatetime-format-w3cdtf-perl/current/SIGNATURE Thu Nov  5 15:22:35 2009
@@ -1,0 +1,34 @@
+This file contains message digests of all files listed in MANIFEST,
+signed via the Module::Signature module, version 0.55.
+
+To verify the content in this distribution, first make sure you have
+Module::Signature installed, then type:
+
+    % cpansign -v
+
+It will check each file's integrity, as well as the signature's
+validity.  If "==> Signature verified OK! <==" is not displayed,
+the distribution may already have been compromised, and you should
+not run its Makefile.PL or Build.PL.
+
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA1
+
+SHA1 ae4198042de9996dba6444776228388228e91eca Build.PL
+SHA1 702e98902eb6fe7224b9ece349f16f1629e0bd04 Changes
+SHA1 f235ba4160673bcb7c9d58c2f09dbc7fc0efadea LICENSE
+SHA1 b3c9f84f87eb0fb17c512fc07aef3f5936b02a75 MANIFEST
+SHA1 1369094d003ae4ccfb769c0a9aedfdcbc516e1b1 META.yml
+SHA1 bec7021434f2cd45163007cd51448891c13ff308 Makefile.PL
+SHA1 93db7b819544a166ed7f2e6b2ee21ad6236c644d README
+SHA1 045cbdf1dc0f15f863dae26f8a2961a146a46fe3 lib/DateTime/Format/W3CDTF.pm
+SHA1 71cbf0df8c25a43c7baf65877c60c852fae1f1c0 t/00load.t
+SHA1 78102b8a839dda3387e63cb7ed939ba696e1b42f t/01parse.t
+SHA1 374b4554a0a5ab940154dcfe9afc889e555ac4f3 t/02bugs.t
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1.4.9 (GNU/Linux)
+
+iEYEARECAAYFAkruBegACgkQIgMCsV8qvRKGYQCdHvu+G43YT6jrbYyP29YpKM5d
+lJgAniSETJm6dvjNuSX5gAb8BsC/NIk1
+=hlX4
+-----END PGP SIGNATURE-----

Modified: branches/upstream/libdatetime-format-w3cdtf-perl/current/lib/DateTime/Format/W3CDTF.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdatetime-format-w3cdtf-perl/current/lib/DateTime/Format/W3CDTF.pm?rev=46792&op=diff
==============================================================================
--- branches/upstream/libdatetime-format-w3cdtf-perl/current/lib/DateTime/Format/W3CDTF.pm (original)
+++ branches/upstream/libdatetime-format-w3cdtf-perl/current/lib/DateTime/Format/W3CDTF.pm Thu Nov  5 15:22:35 2009
@@ -4,65 +4,61 @@
 
 use vars qw ($VERSION);
 
-$VERSION = '0.04';
+$VERSION = '0.05';
 
 use DateTime;
 
-sub new
-{
+sub new {
     my $class = shift;
 
     return bless {}, $class;
 }
 
 # key is string length
-my %valid_formats =
-    ( 19 =>
-      { params => [ qw( year month day hour minute second) ],
+my %valid_formats = (
+    19 => {
+        params => [qw( year month day hour minute second)],
         regex  => qr/^(\d{4})-(\d\d)-(\d\d)T(\d\d):(\d\d):(\d\d)$/,
         zero   => {},
-      },
-      16 =>
-      { params => [ qw( year month day hour minute) ],
+    },
+    16 => {
+        params => [qw( year month day hour minute)],
         regex  => qr/^(\d{4})-(\d\d)-(\d\d)T(\d\d):(\d\d)$/,
         zero   => { second => 0 },
-      },
-      10 =>
-      { params => [ qw( year month day ) ],
+    },
+    10 => {
+        params => [qw( year month day )],
         regex  => qr/^(\d{4})-(\d\d)-(\d\d)$/,
         zero   => { hour => 0, minute => 0, second => 0 },
-      },
-      7 =>
-      { params => [ qw( year month ) ],
+    },
+    7 => {
+        params => [qw( year month )],
         regex  => qr/^(\d{4})-(\d\d)$/,
         zero   => { day => 1, hour => 0, minute => 0, second => 0 },
-      },
-	  4 =>
-      { params => [ qw( year ) ],
+    },
+    4 => {
+        params => [qw( year )],
         regex  => qr/^(\d\d\d\d)$/,
-        zero   => { month => 1, day => 1, hour => 0, minute => 0, second => 0 }
-      }
-    );
-
-sub parse_datetime
-{
+        zero => { month => 1, day => 1, hour => 0, minute => 0, second => 0 }
+    }
+);
+
+sub parse_datetime {
     my ( $self, $date ) = @_;
 
     # save for error messages
     my $original = $date;
 
-	my %p;
-    if ( $date =~ s/([+-]\d\d:\d\d)$// )
-    {
+    my %p;
+    if ( $date =~ s/([+-]\d\d:\d\d)$// ) {
         $p{time_zone} = $1;
     }
+
     # Z at end means UTC
-    elsif ( $date =~ s/Z$// )
-    {
+    elsif ( $date =~ s/Z$// ) {
         $p{time_zone} = 'UTC';
     }
-    else
-    {
+    else {
         $p{time_zone} = 'floating';
     }
 
@@ -74,8 +70,7 @@
     return DateTime->new( %p, %{ $format->{zero} } );
 }
 
-sub format_datetime
-{
+sub format_datetime {
     my ( $self, $dt ) = @_;
 
     # removed in 0.4 as it behaved improperly at midnight - kellan 2003/11/23
@@ -86,35 +81,36 @@
     #               $dt->hour, $dt->minute, $dt->second ) :
     #      sprintf( '%04d-%02d-%02d', $dt->year, $dt->month, $dt->day )
     #    );
-    
-	my $base = sprintf( '%04d-%02d-%02dT%02d:%02d:%02d',
-		$dt->year, $dt->month, $dt->day,
-        $dt->hour, $dt->minute, $dt->second );
-
+
+    my $base = sprintf(
+        '%04d-%02d-%02dT%02d:%02d:%02d',
+        $dt->year, $dt->month,  $dt->day,
+        $dt->hour, $dt->minute, $dt->second
+    );
 
     my $tz = $dt->time_zone;
 
     return $base if $tz->is_floating;
 
-	return $base . 'Z' if $tz->is_utc;
-
-	if (my $offset = $dt->offset()) {
-		return $base . offset_as_string($offset );
-	}
-}
-
-sub format_date
-{
+    return $base . 'Z' if $tz->is_utc;
+
+    my $offset = $dt->offset();
+
+    return $base unless defined $offset;
+
+    return $base . offset_as_string($offset)
+}
+
+sub format_date {
     my ( $self, $dt ) = @_;
 
     my $base = sprintf( '%04d-%02d-%02d', $dt->year, $dt->month, $dt->day );
-	return $base; 
+    return $base;
 }
 
 # minor offset_as_string variant w/ :
 #
-sub offset_as_string
-{
+sub offset_as_string {
     my $offset = shift;
 
     return undef unless defined $offset;
@@ -128,10 +124,11 @@
 
     my $secs = $offset % 60;
 
-    return ( $secs ?
-             sprintf( '%s%02d:%02d:%02d', $sign, $hours, $mins, $secs ) :
-             sprintf( '%s%02d:%02d', $sign, $hours, $mins )
-           );
+    return (
+        $secs
+        ? sprintf( '%s%02d:%02d:%02d', $sign, $hours, $mins, $secs )
+        : sprintf( '%s%02d:%02d',      $sign, $hours, $mins )
+    );
 }
 
 1;
@@ -146,11 +143,11 @@
 
   use DateTime::Format::W3CDTF;
 
-  my $f = DateTime::Format::W3CDTF->new;
-  my $dt = $f->parse_datetime( '2003-02-15T13:50:05-05:00' );
+  my $w3c = DateTime::Format::W3CDTF->new;
+  my $dt = $w3c->parse_datetime( '2003-02-15T13:50:05-05:00' );
 
   # 2003-02-15T13:50:05-05:00
-  $f->format_datetime($dt);
+  $w3c->format_datetime($dt);
 
 =head1 DESCRIPTION
 
@@ -192,19 +189,33 @@
 =head1 SUPPORT
 
 Support for this module is provided via the datetime at perl.org email
-list.  See http://lists.perl.org/ for more details.
+list. See http://datetime.perl.org/?MailingList for details.
+
+Please submit bugs to the CPAN RT system at
+http://rt.cpan.org/NoAuth/ReportBug.html?Queue=datetime-format-w3cdtf or via
+email at bug-datetime-format-w3cdtf at rt.cpan.org.
 
 =head1 AUTHOR
 
-Kellan Elliott-McCrea <kellan at protest.net>
-
-This module was inspired by C<DateTime::Format::ICal>
+Dave Rolsky E<lt>autarch at urth.orgE<gt>
+
+=head1 CREDITS
+
+This module was originally created by Kellan Elliott-McCrea
+E<lt>kellan at protest.netE<gt>.
+
+This module was inspired by L<DateTime::Format::ICal>
 
 =head1 COPYRIGHT
 
-Copyright (c) 2003 Kellan Elliott-McCrea.  All rights reserved.  This program
-is free software; you can redistribute it and/or modify it under the
-same terms as Perl itself.
+Copyright (c) 2009 David Rolsky.  All rights reserved.  This
+program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+Copyright (c) 2003 Kellan Elliott-McCrea
+
+Portions of the code in this distribution are derived from other
+works.  Please see the CREDITS file for more details.
 
 The full text of the license can be found in the LICENSE file included
 with this module.

Modified: branches/upstream/libdatetime-format-w3cdtf-perl/current/t/01parse.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdatetime-format-w3cdtf-perl/current/t/01parse.t?rev=46792&op=diff
==============================================================================
--- branches/upstream/libdatetime-format-w3cdtf-perl/current/t/01parse.t (original)
+++ branches/upstream/libdatetime-format-w3cdtf-perl/current/t/01parse.t Thu Nov  5 15:22:35 2009
@@ -9,21 +9,19 @@
 }
 
 my @tests = (
-    '2003-02-10T15:23:45'	=> '2003-02-10T15:23:45',
-    '1997-04-11T09:34'		=> '1997-04-11T09:34:00',
-    '2002-05-12'		=> '2002-05-12T00:00:00',
-    '1985-06'			=> '1985-06-01T00:00:00',
-    '1988'			=> '1988-01-01T00:00:00',
-  #  '2001-02-30'		=> '2001-03-02T00:00:00',
-    '2005-03-10T20:14:34+09:30'	=> '2005-03-10T10:44:34',
-    '2000-06-12T14:12:33Z'	=> '2000-06-12T14:12:33',
-    '1994-11-05T08:15:30-05:00'	=> '1994-11-05T13:15:30',
+    '2003-02-10T15:23:45'       => '2003-02-10T15:23:45',
+    '1997-04-11T09:34'          => '1997-04-11T09:34:00',
+    '2002-05-12'                => '2002-05-12T00:00:00',
+    '1985-06'                   => '1985-06-01T00:00:00',
+    '1988'                      => '1988-01-01T00:00:00',
+    '2005-03-10T20:14:34+09:30' => '2005-03-10T10:44:34',
+    '2000-06-12T14:12:33Z'      => '2000-06-12T14:12:33',
+    '1994-11-05T08:15:30-05:00' => '1994-11-05T13:15:30',
 );
 
-while (@tests)
-{
-    my ($given, $expected) = splice @tests, 0, 2;
-    my $dt = $class->parse_datetime( $given )->set_time_zone( 'UTC' );
+while (@tests) {
+    my ( $given, $expected ) = splice @tests, 0, 2;
+    my $dt   = $class->parse_datetime($given)->set_time_zone('UTC');
     my $form = $dt->iso8601;
     is( $form => $expected, "Parsing of $given => $expected." );
 }
@@ -39,8 +37,8 @@
     '06:34:18',
 );
 
-for (@noparse)
-{
-    my $dt = eval { $class->parse_datetime( $_ ) };
-    ok( $@ && !( defined $dt && $dt->isa('DateTime') ), "Correctly didn't parse '$_'" );
+for (@noparse) {
+    my $dt = eval { $class->parse_datetime($_) };
+    ok( $@ && !( defined $dt && $dt->isa('DateTime') ),
+        "Correctly didn't parse '$_'" );
 }

Modified: branches/upstream/libdatetime-format-w3cdtf-perl/current/t/02bugs.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdatetime-format-w3cdtf-perl/current/t/02bugs.t?rev=46792&op=diff
==============================================================================
--- branches/upstream/libdatetime-format-w3cdtf-perl/current/t/02bugs.t (original)
+++ branches/upstream/libdatetime-format-w3cdtf-perl/current/t/02bugs.t Thu Nov  5 15:22:35 2009
@@ -1,8 +1,8 @@
 #!/usr/bin/perl -w
 
-# test bug 3766 
+# test bug 3766
 #	http://rt.cpan.org/NoAuth/Bug.html?id=3766
-#   returns undef when you pass it a DateTime object 
+#   returns undef when you pass it a DateTime object
 #   whose timezone has been explicitly set.
 
 # test bug 3771
@@ -11,32 +11,51 @@
 #   explicitly as "00:00:00", the method will not print a timestamp or an offset.
 
 use strict;
-use Test::More tests => 4;
+use Test::More tests => 5;
 
 use DateTime;
 use DateTime::Format::W3CDTF;
 
 my @dates = (
-	{ date   => { year => 1977, month => 11, day => 11, hour => 1, minute => 12, time_zone => 'America/Los_Angeles' },
-	  w3cdtf => '1977-11-11T01:12:00-08:00',
-	  msg	 => 'formatter works with explicit timezone',
-	},
-	{ date   => { year => 1977, month => 4, day => 7, time_zone => 'America/Los_Angeles' },
-	  w3cdtf => '1977-04-07T00:00:00-08:00',
-	  msg	 => 'formatter works without timestamp',
-	},
-	{ date   => { year => 2003, month => 4, day => 7, hour => 2, time_zone => 'America/Los_Angeles' },
-	  w3cdtf => '2003-04-07T02:00:00-07:00',
-	  msg	 => 'formatter properly recognizing daylights saving'
-	},
-	{ date   => { year => 2003, month => 12, day => 25, hour => 0, minute => 00, second => 00, time_zone => 'America/Montreal' },
-	  w3cdtf => '2003-12-25T00:00:00-05:00',
-	  msg	 => 'formatter properly formats midnight'
-	}
+    {
+        date => {
+            year => 1977, month => 11, day => 11, hour => 1, minute => 12,
+            time_zone => 'America/Los_Angeles'
+        },
+        w3cdtf => '1977-11-11T01:12:00-08:00',
+        msg    => 'formatter works with explicit timezone',
+    }, {
+        date => {
+            year => 1977, month => 4, day => 7,
+            time_zone => 'America/Los_Angeles'
+        },
+        w3cdtf => '1977-04-07T00:00:00-08:00',
+        msg    => 'formatter works without timestamp',
+    }, {
+        date => {
+            year => 2003, month => 4, day => 7, hour => 2,
+            time_zone => 'America/Los_Angeles'
+        },
+        w3cdtf => '2003-04-07T02:00:00-07:00',
+        msg    => 'formatter properly recognizing daylights saving'
+    }, {
+        date => {
+            year => 2003, month => 12, day => 25, hour => 0, minute => 00,
+            second => 00, time_zone => 'America/Montreal'
+        },
+        w3cdtf => '2003-12-25T00:00:00-05:00',
+        msg    => 'formatter properly formats midnight'
+    }, {
+        date => {
+            year => 2009, month => 11, day => 25,, time_zone => 'Europe/London'
+        },
+        w3cdtf => '2009-11-25T00:00:00+00:00',
+        msg    => 'formatter handles tz offset of 0 properly'
+    }
 );
 my $f = DateTime::Format::W3CDTF->new();
 
-foreach my $d ( @dates ) {
-	my $dt = DateTime->new( %{ $d->{date} } );
-	is ( $f->format_datetime($dt), $d->{w3cdtf}, $d->{msg});
-}
+foreach my $d (@dates) {
+    my $dt = DateTime->new( %{ $d->{date} } );
+    is( $f->format_datetime($dt), $d->{w3cdtf}, $d->{msg} );
+}




More information about the Pkg-perl-cvs-commits mailing list