r46794 - in /trunk/libdatetime-format-w3cdtf-perl: Build.PL Changes MANIFEST META.yml Makefile.PL README SIGNATURE debian/changelog debian/compat debian/control debian/rules 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:29:24 UTC 2009
Author: jawnsy-guest
Date: Thu Nov 5 15:29:17 2009
New Revision: 46794
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=46794
Log:
TODO: refresh copyright info
* New upstream release
* Standards-Version 3.8.3 (drop perl version dep)
* Rewrite control description
* Use new short debhelper rules file
* Bump to debhelper 7
* Add myself to Uploaders and Copyright
* Change my email address.
Added:
trunk/libdatetime-format-w3cdtf-perl/Build.PL
- copied unchanged from r46793, branches/upstream/libdatetime-format-w3cdtf-perl/current/Build.PL
trunk/libdatetime-format-w3cdtf-perl/META.yml
- copied unchanged from r46793, branches/upstream/libdatetime-format-w3cdtf-perl/current/META.yml
trunk/libdatetime-format-w3cdtf-perl/SIGNATURE
- copied unchanged from r46793, branches/upstream/libdatetime-format-w3cdtf-perl/current/SIGNATURE
Modified:
trunk/libdatetime-format-w3cdtf-perl/Changes
trunk/libdatetime-format-w3cdtf-perl/MANIFEST
trunk/libdatetime-format-w3cdtf-perl/Makefile.PL
trunk/libdatetime-format-w3cdtf-perl/README
trunk/libdatetime-format-w3cdtf-perl/debian/changelog
trunk/libdatetime-format-w3cdtf-perl/debian/compat
trunk/libdatetime-format-w3cdtf-perl/debian/control
trunk/libdatetime-format-w3cdtf-perl/debian/rules
trunk/libdatetime-format-w3cdtf-perl/lib/DateTime/Format/W3CDTF.pm
trunk/libdatetime-format-w3cdtf-perl/t/01parse.t
trunk/libdatetime-format-w3cdtf-perl/t/02bugs.t
Modified: trunk/libdatetime-format-w3cdtf-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdatetime-format-w3cdtf-perl/Changes?rev=46794&op=diff
==============================================================================
--- trunk/libdatetime-format-w3cdtf-perl/Changes (original)
+++ trunk/libdatetime-format-w3cdtf-perl/Changes Thu Nov 5 15:29:17 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: trunk/libdatetime-format-w3cdtf-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdatetime-format-w3cdtf-perl/MANIFEST?rev=46794&op=diff
==============================================================================
--- trunk/libdatetime-format-w3cdtf-perl/MANIFEST (original)
+++ trunk/libdatetime-format-w3cdtf-perl/MANIFEST Thu Nov 5 15:29:17 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
Modified: trunk/libdatetime-format-w3cdtf-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdatetime-format-w3cdtf-perl/Makefile.PL?rev=46794&op=diff
==============================================================================
--- trunk/libdatetime-format-w3cdtf-perl/Makefile.PL (original)
+++ trunk/libdatetime-format-w3cdtf-perl/Makefile.PL Thu Nov 5 15:29:17 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: trunk/libdatetime-format-w3cdtf-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdatetime-format-w3cdtf-perl/README?rev=46794&op=diff
==============================================================================
--- trunk/libdatetime-format-w3cdtf-perl/README (original)
+++ trunk/libdatetime-format-w3cdtf-perl/README Thu Nov 5 15:29:17 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/
+
Modified: trunk/libdatetime-format-w3cdtf-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdatetime-format-w3cdtf-perl/debian/changelog?rev=46794&op=diff
==============================================================================
--- trunk/libdatetime-format-w3cdtf-perl/debian/changelog (original)
+++ trunk/libdatetime-format-w3cdtf-perl/debian/changelog Thu Nov 5 15:29:17 2009
@@ -1,16 +1,24 @@
-libdatetime-format-w3cdtf-perl (0.04-4) UNRELEASED; urgency=low
+libdatetime-format-w3cdtf-perl (0.05-1) UNRELEASED; urgency=low
+
+ TODO: refresh copyright info
+
+ [ Jonathan Yu ]
+ * New upstream release
+ * Standards-Version 3.8.3 (drop perl version dep)
+ * Rewrite control description
+ * Use new short debhelper rules file
+ * Bump to debhelper 7
+ * Add myself to Uploaders and Copyright
[ gregor herrmann ]
* debian/control: Changed: Switched Vcs-Browser field to ViewSVN
(source stanza).
+ * Change my email address.
[ Nathan Handler ]
* debian/watch: Update to ignore development releases.
- [ gregor herrmann ]
- * Change my email address.
-
- -- gregor herrmann <gregoa at debian.org> Sun, 16 Nov 2008 20:41:35 +0100
+ -- Jonathan Yu <jawnsy at cpan.org> Thu, 05 Nov 2009 06:56:11 -0500
libdatetime-format-w3cdtf-perl (0.04-3) unstable; urgency=low
Modified: trunk/libdatetime-format-w3cdtf-perl/debian/compat
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdatetime-format-w3cdtf-perl/debian/compat?rev=46794&op=diff
==============================================================================
--- trunk/libdatetime-format-w3cdtf-perl/debian/compat (original)
+++ trunk/libdatetime-format-w3cdtf-perl/debian/compat Thu Nov 5 15:29:17 2009
@@ -1,1 +1,1 @@
-6
+7
Modified: trunk/libdatetime-format-w3cdtf-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdatetime-format-w3cdtf-perl/debian/control?rev=46794&op=diff
==============================================================================
--- trunk/libdatetime-format-w3cdtf-perl/debian/control (original)
+++ trunk/libdatetime-format-w3cdtf-perl/debian/control Thu Nov 5 15:29:17 2009
@@ -1,11 +1,12 @@
Source: libdatetime-format-w3cdtf-perl
Section: perl
Priority: optional
-Build-Depends: debhelper (>= 6)
-Build-Depends-Indep: perl (>= 5.8.0-7), libdatetime-perl
+Build-Depends: debhelper (>= 7)
+Build-Depends-Indep: perl, libdatetime-perl
Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
-Uploaders: Jaldhar H. Vyas <jaldhar at debian.org>, gregor herrmann <gregoa at debian.org>
-Standards-Version: 3.7.3
+Uploaders: Jaldhar H. Vyas <jaldhar at debian.org>, gregor herrmann <gregoa at debian.org>,
+ Jonathan Yu <jawnsy at cpan.org>
+Standards-Version: 3.8.3
Homepage: http://search.cpan.org/dist/DateTime-Format-W3CDTF/
Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libdatetime-format-w3cdtf-perl/
Vcs-Browser: http://svn.debian.org/viewsvn/pkg-perl/trunk/libdatetime-format-w3cdtf-perl/
@@ -13,7 +14,8 @@
Package: libdatetime-format-w3cdtf-perl
Architecture: all
Depends: ${perl:Depends}, ${misc:Depends}, libdatetime-perl
-Description: Parse and format W3CDTF datetime strings
- This module understands the W3CDTF date/time format, an ISO 8601
- profile, defined at http://www.w3.org/TR/NOTE-datetime. This format
- is the native date format of RSS 1.0.
+Description: module to parse and format W3CDTF datetime strings
+ DateTime::Format::W3CDTF is a Perl module that understands the W3CDTF date
+ and time format, an ISO 8601 profile. It has a full specification online at:
+ <URL:http://www.w3.org/TR/NOTE-datetime>. This is the native date format for
+ RSS 1.0.
Modified: trunk/libdatetime-format-w3cdtf-perl/debian/rules
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdatetime-format-w3cdtf-perl/debian/rules?rev=46794&op=diff
==============================================================================
--- trunk/libdatetime-format-w3cdtf-perl/debian/rules (original)
+++ trunk/libdatetime-format-w3cdtf-perl/debian/rules Thu Nov 5 15:29:17 2009
@@ -1,70 +1,4 @@
#!/usr/bin/make -f
-# This debian/rules file is provided as a template for normal perl
-# packages. It was created by Marc Brockschmidt <marc at dch-faq.de> for
-# the Debian Perl Group (http://pkg-perl.alioth.debian.org/) but may
-# be used freely wherever it is useful.
-# Uncomment this to turn on verbose mode.
-#export DH_VERBOSE=1
-
-# If set to a true value then MakeMaker's prompt function will
-# always return the default without waiting for user input.
-export PERL_MM_USE_DEFAULT=1
-
-PACKAGE=$(shell dh_listpackages)
-
-ifndef PERL
-PERL = /usr/bin/perl
-endif
-
-TMP =$(CURDIR)/debian/$(PACKAGE)
-
-build: build-stamp
-build-stamp:
- dh_testdir
-
- $(PERL) Makefile.PL INSTALLDIRS=vendor
- $(MAKE)
- $(MAKE) test
-
- touch build-stamp
-
-clean:
- dh_testdir
- dh_testroot
-
- dh_clean build-stamp install-stamp
- [ ! -f Makefile ] || $(MAKE) distclean
-
-install: install-stamp
-install-stamp: build-stamp
- dh_testdir
- dh_testroot
- dh_clean -k
-
- $(MAKE) install DESTDIR=$(TMP) PREFIX=/usr
- [ ! -d $(TMP)/usr/lib/perl5 ] || rmdir --ignore-fail-on-non-empty --parents --verbose $(TMP)/usr/lib/perl5
-
- touch install-stamp
-
-binary-arch:
-# We have nothing to do by default.
-
-binary-indep: build install
- dh_testdir
- dh_testroot
- dh_installdocs
- dh_installchangelogs Changes
- dh_perl
- dh_compress
- dh_fixperms
- dh_installdeb
- dh_gencontrol
- dh_md5sums
- dh_builddeb
-
-source diff:
- @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
-
-binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary
+%:
+ dh $@
Modified: trunk/libdatetime-format-w3cdtf-perl/lib/DateTime/Format/W3CDTF.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdatetime-format-w3cdtf-perl/lib/DateTime/Format/W3CDTF.pm?rev=46794&op=diff
==============================================================================
--- trunk/libdatetime-format-w3cdtf-perl/lib/DateTime/Format/W3CDTF.pm (original)
+++ trunk/libdatetime-format-w3cdtf-perl/lib/DateTime/Format/W3CDTF.pm Thu Nov 5 15:29:17 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: trunk/libdatetime-format-w3cdtf-perl/t/01parse.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdatetime-format-w3cdtf-perl/t/01parse.t?rev=46794&op=diff
==============================================================================
--- trunk/libdatetime-format-w3cdtf-perl/t/01parse.t (original)
+++ trunk/libdatetime-format-w3cdtf-perl/t/01parse.t Thu Nov 5 15:29:17 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: trunk/libdatetime-format-w3cdtf-perl/t/02bugs.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdatetime-format-w3cdtf-perl/t/02bugs.t?rev=46794&op=diff
==============================================================================
--- trunk/libdatetime-format-w3cdtf-perl/t/02bugs.t (original)
+++ trunk/libdatetime-format-w3cdtf-perl/t/02bugs.t Thu Nov 5 15:29:17 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