r23886 - in /branches/upstream/libdatetime-format-strptime-perl/current: Changes META.yml Makefile.PL lib/DateTime/Format/Strptime.pm t/004_locale_defaults.t t/007_edge.t t/more/001_all_locales.t

emhn-guest at users.alioth.debian.org emhn-guest at users.alioth.debian.org
Thu Aug 7 14:06:16 UTC 2008


Author: emhn-guest
Date: Thu Aug  7 14:06:08 2008
New Revision: 23886

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

Modified:
    branches/upstream/libdatetime-format-strptime-perl/current/Changes
    branches/upstream/libdatetime-format-strptime-perl/current/META.yml
    branches/upstream/libdatetime-format-strptime-perl/current/Makefile.PL
    branches/upstream/libdatetime-format-strptime-perl/current/lib/DateTime/Format/Strptime.pm
    branches/upstream/libdatetime-format-strptime-perl/current/t/004_locale_defaults.t
    branches/upstream/libdatetime-format-strptime-perl/current/t/007_edge.t
    branches/upstream/libdatetime-format-strptime-perl/current/t/more/001_all_locales.t

Modified: branches/upstream/libdatetime-format-strptime-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdatetime-format-strptime-perl/current/Changes?rev=23886&op=diff
==============================================================================
--- branches/upstream/libdatetime-format-strptime-perl/current/Changes (original)
+++ branches/upstream/libdatetime-format-strptime-perl/current/Changes Thu Aug  7 14:06:08 2008
@@ -188,3 +188,9 @@
 		  same information in it for readers of POD.
 		- This version ONLY changes the documentation and so it not a
 		  required update.
+
+1.0800 2008-08-07
+	- Pile-o-bugs
+		- It seems that I wasn't getting notifications from Google
+		  when people had reported bugs, so there's a pile of fixes
+		  in this release. Hopefully that fixes everyone's issues.

Modified: branches/upstream/libdatetime-format-strptime-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdatetime-format-strptime-perl/current/META.yml?rev=23886&op=diff
==============================================================================
--- branches/upstream/libdatetime-format-strptime-perl/current/META.yml (original)
+++ branches/upstream/libdatetime-format-strptime-perl/current/META.yml Thu Aug  7 14:06:08 2008
@@ -3,7 +3,7 @@
         version: 1.3
         url: http://module-build.sourceforge.net/META-spec-v1.3.html
 name:           DateTime-Format-Strptime
-version:        1.0702
+version:        1.0800
 abstract:       Parse and format strp and strf time patterns
 author:
         - Rick Measham <rickm at cpan.org>
@@ -11,9 +11,9 @@
 distribution_type:      module
 requires:
         Params::Validate:              0.64
-        DateTime:                      0.1402
-        DateTime::Locale:              0.35
-        DateTime::TimeZone:            0.25
+        DateTime:                      0.4304
+        DateTime::Locale:              0.41
+        DateTime::TimeZone:            0.79
 resources:
         licence:        http://dev.perl.org/licenses/
         homepage:       http://datetime-format-strptime.googlecode.com/

Modified: branches/upstream/libdatetime-format-strptime-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdatetime-format-strptime-perl/current/Makefile.PL?rev=23886&op=diff
==============================================================================
--- branches/upstream/libdatetime-format-strptime-perl/current/Makefile.PL (original)
+++ branches/upstream/libdatetime-format-strptime-perl/current/Makefile.PL Thu Aug  7 14:06:08 2008
@@ -2,10 +2,12 @@
 
 print <<'EOF';
 -----------------------------------------
-  __                ___
- (_   _|_  ._  ._    |   o  ._ _    _
- __)   |_  |   |_)   |   |  | | |  (/_
-               |
+ __ _              _   _
+/ _\ |_ _ __ _ __ | |_(_)_ __ ___   ___
+\ \| __| '__| '_ \| __| | '_ ` _ \ / _ \
+_\ \ |_| |  | |_) | |_| | | | | | |  __/
+\__/\__|_|  | .__/ \__|_|_| |_| |_|\___|
+            |_|
 -----------------------------------------
 
 To run thousands of other tests (mainly
@@ -25,9 +27,9 @@
     AUTHOR       => 'Rick Measham (rickm at cpan.org)',
     ABSTRACT     => 'Parse and format strp and strf time patterns',
     PREREQ_PM    => {
-       'DateTime'           => '0.1402',
-       'DateTime::Locale'   => '0.35',
-       'DateTime::TimeZone' => '0.25',
+       'DateTime'           => '0.4304',
+       'DateTime::Locale'   => '0.41',
+       'DateTime::TimeZone' => '0.79',
        'Params::Validate'   => '0.64',
     },
 );

Modified: branches/upstream/libdatetime-format-strptime-perl/current/lib/DateTime/Format/Strptime.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdatetime-format-strptime-perl/current/lib/DateTime/Format/Strptime.pm?rev=23886&op=diff
==============================================================================
--- branches/upstream/libdatetime-format-strptime-perl/current/lib/DateTime/Format/Strptime.pm (original)
+++ branches/upstream/libdatetime-format-strptime-perl/current/lib/DateTime/Format/Strptime.pm Thu Aug  7 14:06:08 2008
@@ -11,7 +11,7 @@
 use vars qw( $VERSION @ISA @EXPORT @EXPORT_OK %ZONEMAP %FORMATS $CROAK $errmsg);
 
 @ISA = 'Exporter';
-$VERSION = '1.0702';
+$VERSION = '1.0800';
 @EXPORT_OK = qw( &strftime &strptime );
 @EXPORT = ();
 
@@ -391,6 +391,7 @@
 		my $month_number = 0;
 		foreach my $month (@{$self->{_locale}->month_names}) {
 			$month_count++;
+# 			use bytes;
 			if (lc $month eq lc $month_name) {
 				$month_number = $month_count;
 				last;
@@ -400,6 +401,9 @@
 			my $month_count = 0;
 			foreach my $month (@{$self->{_locale}->month_abbreviations}) {
 				$month_count++;
+# 				use bytes;
+				# When abbreviating, sometimes there's a period, sometimes not.
+				$month =~ s/\.$//; $month_name =~ s/\.$//;
 				if (lc $month eq lc $month_name) {
 					$month_number = $month_count;
 					last;
@@ -420,9 +424,10 @@
 	$self->local_croak("Your month value does not match your epoch.") and return undef if $epoch_dt and $Month and $Month != $epoch_dt->month;
 	if ($doy) {
 		$self->local_croak("There is no use providing a day of the year without providing a year.") and return undef unless $Year;
-		$doy_dt = ($DateTime::VERSION > 0.12)
-			? DateTime->from_day_of_year(year=>$Year, day_of_year=>$doy, time_zone => $use_timezone)
-			: DateTime->new(year=>$Year, day=>$doy, time_zone => $use_timezone);
+		$doy_dt = eval {
+			DateTime->from_day_of_year(year=>$Year, day_of_year=>$doy, time_zone => $use_timezone);
+		};
+		$self->local_croak("Day of year $Year-$doy is not valid") and return undef if $@;
 
 		my $month = $doy_dt->month;
 		$self->local_croak("Your day of the year ($doy - in ".$doy_dt->month_name.") is not in your month ($Month)") and return undef if $Month and $month != $Month;
@@ -441,7 +446,10 @@
 			: '';
 	if ($Day) {
 		$self->local_croak("There is no use providing a day without providing a month and year.") and return undef unless $Year and $Month;
-		my $dt = DateTime->new(year=>$Year, month=>$Month, day=>$Day, hour=>12, time_zone => $use_timezone);
+		my $dt = eval {
+			DateTime->new(year=>$Year, month=>$Month, day=>$Day, hour=>12, time_zone => $use_timezone);
+		};
+		$self->local_croak("Datetime $Year-$Month-$Day is not a valid date") and return undef if $@;
 		$self->local_croak("There is no day $Day in $dt->month_name, $Year") and return undef
 			unless $dt->month == $Month;
 	}
@@ -497,19 +505,22 @@
 #	croak "Your nanosecond does not match your epoch." if $epoch_dt and $Nanosecond and $Nanosecond != $epoch_dt->nanosecond;
 	print "Set nanosecond to $Nanosecond.\n" if $self->{diagnostic};
 
-    my $potential_return = DateTime->new(
-    	year		=> ($Year		|| 1),
-    	month		=> ($Month		|| 1),
-    	day			=> ($Day		|| 1),
-
-    	hour		=> ($Hour		|| 0),
-    	minute		=> ($Minute     || 0),
-    	second		=> ($Second     || 0),
-    	nanosecond	=> ($Nanosecond || 0),
-
-    	locale      =>	$self->{_locale},
-    	time_zone	=>	$use_timezone,
-	);
+    my $potential_return = eval {
+		DateTime->new(
+			year		=> ($Year		|| 1),
+			month		=> ($Month		|| 1),
+			day			=> ($Day		|| 1),
+
+			hour		=> ($Hour		|| 0),
+			minute		=> ($Minute     || 0),
+			second		=> ($Second     || 0),
+			nanosecond	=> ($Nanosecond || 0),
+
+			locale      =>	$self->{_locale},
+			time_zone	=>	$use_timezone,
+		);
+	};
+	$self->local_croak("Datetime is not a valid date") and return undef if $@;
 
 	$self->local_croak("Your day of the week ($dow_mon_1) does not match the date supplied: ".$potential_return->ymd) and return undef if $dow_mon_1 and $potential_return->dow != $dow_mon_1;
 
@@ -520,6 +531,7 @@
 		my $dow_number = 0;
 		foreach my $dow (@{$self->{_locale}->day_names}) {
 			$dow_count++;
+			use bytes;
 			if (lc $dow eq lc $dow_name) {
 				$dow_number = $dow_count;
 				last;
@@ -529,6 +541,7 @@
 			my $dow_count = 0;
 			foreach my $dow (@{$self->{_locale}->day_abbreviations}) {
 				$dow_count++;
+				use bytes;
 				if (lc $dow eq lc $dow_name) {
 					$dow_number = $dow_count;
 					last;
@@ -618,7 +631,10 @@
 	# %x id the locale's default time format.
 
 	# I'm absolutely certain there's a better way to do this:
-	$regex=~s|([\/\.\-])|\\$1|g;
+	#$regex=~s|([\/\.\-])|\\$1|g;
+	$regex = quotemeta( $regex );
+	$regex =~ s/(?<!\\)\\%/%/g;
+	$regex =~ s/%\\\{([^\}]+)\\\}/%{$1}/g;
 
 	$regex =~ s/%T/%H:%M:%S/g;
 	$field_list =~ s/%T/%H%M%S/g;

Modified: branches/upstream/libdatetime-format-strptime-perl/current/t/004_locale_defaults.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdatetime-format-strptime-perl/current/t/004_locale_defaults.t?rev=23886&op=diff
==============================================================================
--- branches/upstream/libdatetime-format-strptime-perl/current/t/004_locale_defaults.t (original)
+++ branches/upstream/libdatetime-format-strptime-perl/current/t/004_locale_defaults.t Thu Aug  7 14:06:08 2008
@@ -36,7 +36,6 @@
 
 foreach (@tests) {
 	my ($locale, $pattern, $data) = @$_;
-
 	$object->locale($locale);
 	$object->pattern($pattern);
 	my $datetime = $object->parse_datetime( $data );

Modified: branches/upstream/libdatetime-format-strptime-perl/current/t/007_edge.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdatetime-format-strptime-perl/current/t/007_edge.t?rev=23886&op=diff
==============================================================================
--- branches/upstream/libdatetime-format-strptime-perl/current/t/007_edge.t (original)
+++ branches/upstream/libdatetime-format-strptime-perl/current/t/007_edge.t Thu Aug  7 14:06:08 2008
@@ -2,7 +2,7 @@
 
 # t/007_edge.t - these tests are for edge case bug report errors
 
-use Test::More tests => 10;
+use Test::More tests => 12;
 use DateTime;
 use DateTime::Format::Strptime;
 
@@ -43,6 +43,19 @@
 	is($parsed->epoch,'1131143580', 'Time zone applied to string');
 }
 
+#diag("1.08 - Good pattern, illegal datetime");
+my $bad_input_test = DateTime::Format::Strptime->new(
+	pattern => '%Y-%m-%d',
+	time_zone => 'Australia/Melbourne',
+	locale => 'en_AU',
+	on_error => 'croak',
+	diagnostic => 0,
+);
+
+eval { $bad_input_test->parse_datetime('0000-00-00') };
+isnt($@ , '', "Illegal input should carp");
+is(substr($@,0,39), 'Datetime 0000-00-00 is not a valid date', "Croak message should reflect illegal pattern");
+
 
 
 sub test {

Modified: branches/upstream/libdatetime-format-strptime-perl/current/t/more/001_all_locales.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdatetime-format-strptime-perl/current/t/more/001_all_locales.t?rev=23886&op=diff
==============================================================================
--- branches/upstream/libdatetime-format-strptime-perl/current/t/more/001_all_locales.t (original)
+++ branches/upstream/libdatetime-format-strptime-perl/current/t/more/001_all_locales.t Thu Aug  7 14:06:08 2008
@@ -2,7 +2,7 @@
 
 # t/more/001_all_locales.t - test formatting against every locales
 
-use Test::More tests => 18837;
+use Test::More qw(no_plan);
 use DateTime::Format::Strptime;
 use DateTime::Locale;
 use DateTime;
@@ -22,14 +22,14 @@
 			on_error=> 'croak',
 		)};
 		ok($@ eq '',"Constructor with Day Name");
-		
+
 		my $parsed;
 		eval {
 			$parsed = $strptime->parse_datetime($input);
 		} unless $@;
 		diag("[$@]") if $@ ne '';
 		ok($@ eq '',"Parsed with Day Name");
-		
+
 		is($parsed->strftime($pattern),$input,"Matched with Day Name");
 	}
 	diag( $locale );
@@ -39,7 +39,7 @@
 $pattern = "%Y-%m-%d %B";
 foreach my $locale ( @locales ) {
 	foreach my $month (1..12) {
-		my $dt = DateTime->now( locale => $locale )->set( month => $month );
+		my $dt = DateTime->now( locale => $locale )->truncate( to => 'month' )->set( month => $month );
 		my $input = $dt->strftime($pattern);
 		eval { $strptime = DateTime::Format::Strptime->new(
 			pattern => $pattern,
@@ -47,14 +47,14 @@
 			on_error=> 'croak',
 		)};
 		ok($@ eq '',"Constructor with Month Name");
-		
+
 		my $parsed;
 		eval {
 			$parsed = $strptime->parse_datetime($input);
 		} unless $@;
 		diag("[$@]") if $@ ne '';
 		ok($@ eq '',"Parsed with Month Name");
-		
+
 		is($parsed->strftime($pattern),$input,"Matched with Month Name");
 	}
 	diag( $locale );
@@ -72,14 +72,14 @@
 			on_error=> 'croak',
 		)};
 		ok($@ eq '',"Constructor with Meridian");
-		
+
 		my $parsed;
 		eval {
 			$parsed = $strptime->parse_datetime($input);
 		} unless $@;
 		diag("[$@]") if $@ ne '';
 		ok($@ eq '',"Parsed with Meridian");
-		
+
 		is($parsed->strftime($pattern),$input,"Matched with Meridian");
 	}
 	diag( $locale );




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