r54280 - in /branches/upstream/libdatetime-format-natural-perl/current: ./ lib/DateTime/Format/ lib/DateTime/Format/Natural/ lib/DateTime/Format/Natural/Lang/ t/
jawnsy-guest at users.alioth.debian.org
jawnsy-guest at users.alioth.debian.org
Sun Mar 14 03:23:10 UTC 2010
Author: jawnsy-guest
Date: Sun Mar 14 03:23:02 2010
New Revision: 54280
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=54280
Log:
[svn-upgrade] Integrating new upstream version, libdatetime-format-natural-perl (0.85)
Modified:
branches/upstream/libdatetime-format-natural-perl/current/Changes
branches/upstream/libdatetime-format-natural-perl/current/META.yml
branches/upstream/libdatetime-format-natural-perl/current/lib/DateTime/Format/Natural.pm
branches/upstream/libdatetime-format-natural-perl/current/lib/DateTime/Format/Natural/Aliases.pm
branches/upstream/libdatetime-format-natural-perl/current/lib/DateTime/Format/Natural/Formatted.pm
branches/upstream/libdatetime-format-natural-perl/current/lib/DateTime/Format/Natural/Lang/Base.pm
branches/upstream/libdatetime-format-natural-perl/current/lib/DateTime/Format/Natural/Lang/EN.pm
branches/upstream/libdatetime-format-natural-perl/current/t/02-parse_format.t
Modified: branches/upstream/libdatetime-format-natural-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdatetime-format-natural-perl/current/Changes?rev=54280&op=diff
==============================================================================
--- branches/upstream/libdatetime-format-natural-perl/current/Changes (original)
+++ branches/upstream/libdatetime-format-natural-perl/current/Changes Sun Mar 14 03:23:02 2010
@@ -1,4 +1,28 @@
Revision history for Perl extension DateTime::Format::Natural.
+
+0.85 2010-03-13 <schubiger at cpan.org>
+
+ - Merged development version to stable.
+
+0.84_03 2010-03-11 <schubiger at cpan.org>
+
+ - Resolve short aliases only if preceded by a digit.
+
+ - Don't capture the date separator for matching with the format.
+
+0.84_02 2010-03-09 <schubiger at cpan.org>
+
+ - Guess the format of dates with a dot or hyphen as separator.
+
+ - Check for separator mismatch when not in lax mode.
+
+0.84_01 2010-02-24 <schubiger at cpan.org>
+
+ - Use the format parameter case-insensitively and test it.
+
+ - Don't bless into a reference within the metadata base constructor.
+
+ - Add some missing commas to the grammar description.
0.84 2010-02-22 <schubiger at cpan.org>
Modified: branches/upstream/libdatetime-format-natural-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdatetime-format-natural-perl/current/META.yml?rev=54280&op=diff
==============================================================================
--- branches/upstream/libdatetime-format-natural-perl/current/META.yml (original)
+++ branches/upstream/libdatetime-format-natural-perl/current/META.yml Sun Mar 14 03:23:02 2010
@@ -1,6 +1,6 @@
---
name: DateTime-Format-Natural
-version: 0.84
+version: 0.85
author:
- 'Steven Schubiger <schubiger at cpan.org>'
abstract: Create machine readable date/time with natural parsing logic
@@ -29,10 +29,10 @@
provides:
DateTime::Format::Natural:
file: lib/DateTime/Format/Natural.pm
- version: 0.84
+ version: 0.85
DateTime::Format::Natural::Aliases:
file: lib/DateTime/Format/Natural/Aliases.pm
- version: 0.02
+ version: 0.03
DateTime::Format::Natural::Base:
file: lib/DateTime/Format/Natural/Base.pm
version: 1.31
@@ -44,16 +44,16 @@
version: 0.04
DateTime::Format::Natural::Formatted:
file: lib/DateTime/Format/Natural/Formatted.pm
- version: 0.01
+ version: 0.04
DateTime::Format::Natural::Helpers:
file: lib/DateTime/Format/Natural/Helpers.pm
version: 0.05
DateTime::Format::Natural::Lang::Base:
file: lib/DateTime/Format/Natural/Lang/Base.pm
- version: 1.04
+ version: 1.05
DateTime::Format::Natural::Lang::EN:
file: lib/DateTime/Format/Natural/Lang/EN.pm
- version: 1.31
+ version: 1.33
DateTime::Format::Natural::Test:
file: lib/DateTime/Format/Natural/Test.pm
version: 0.05
Modified: branches/upstream/libdatetime-format-natural-perl/current/lib/DateTime/Format/Natural.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdatetime-format-natural-perl/current/lib/DateTime/Format/Natural.pm?rev=54280&op=diff
==============================================================================
--- branches/upstream/libdatetime-format-natural-perl/current/lib/DateTime/Format/Natural.pm (original)
+++ branches/upstream/libdatetime-format-natural-perl/current/lib/DateTime/Format/Natural.pm Sun Mar 14 03:23:02 2010
@@ -18,7 +18,7 @@
use Scalar::Util qw(blessed);
use Storable qw(dclone);
-our $VERSION = '0.84';
+our $VERSION = '0.85';
validation_options(
on_fail => sub
Modified: branches/upstream/libdatetime-format-natural-perl/current/lib/DateTime/Format/Natural/Aliases.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdatetime-format-natural-perl/current/lib/DateTime/Format/Natural/Aliases.pm?rev=54280&op=diff
==============================================================================
--- branches/upstream/libdatetime-format-natural-perl/current/lib/DateTime/Format/Natural/Aliases.pm (original)
+++ branches/upstream/libdatetime-format-natural-perl/current/lib/DateTime/Format/Natural/Aliases.pm Sun Mar 14 03:23:02 2010
@@ -3,7 +3,7 @@
use strict;
use warnings;
-our $VERSION = '0.02';
+our $VERSION = '0.03';
sub _rewrite_aliases
{
@@ -13,7 +13,7 @@
my $aliases = $self->{data}->{aliases};
if ($$date_string =~ /\s+/) {
- foreach my $type (qw(all tokens)) {
+ foreach my $type (qw(words tokens)) {
foreach my $alias (keys %{$aliases->{$type}}) {
if ($alias =~ /^\w+$/) {
$$date_string =~ s/\b $alias \b/$aliases->{$type}{$alias}/ix;
@@ -25,10 +25,11 @@
}
}
else {
- foreach my $type (qw(all short)) {
- foreach my $alias (keys %{$aliases->{$type}}) {
- $$date_string =~ s/$alias $/$aliases->{$type}{$alias}/ix;
- }
+ foreach my $alias (keys %{$aliases->{words}}) {
+ $$date_string =~ s/^ $alias $/$aliases->{words}{$alias}/ix;
+ }
+ foreach my $alias (keys %{$aliases->{short}}) {
+ $$date_string =~ s/(?<=\d) $alias $/$aliases->{short}{$alias}/ix;
}
}
}
Modified: branches/upstream/libdatetime-format-natural-perl/current/lib/DateTime/Format/Natural/Formatted.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdatetime-format-natural-perl/current/lib/DateTime/Format/Natural/Formatted.pm?rev=54280&op=diff
==============================================================================
--- branches/upstream/libdatetime-format-natural-perl/current/lib/DateTime/Format/Natural/Formatted.pm (original)
+++ branches/upstream/libdatetime-format-natural-perl/current/lib/DateTime/Format/Natural/Formatted.pm Sun Mar 14 03:23:02 2010
@@ -2,9 +2,9 @@
use strict;
use warnings;
-use boolean qw(true);
+use boolean qw(true false);
-our $VERSION = '0.01';
+our $VERSION = '0.04';
sub _parse_formatted_ymd
{
@@ -13,16 +13,19 @@
my $date = $self->_split_formatted($date_string);
- my $separator = quotemeta((keys %$count)[0]);
- my @chunks = split /$separator/, $date;
+ my $date_sep = quotemeta((keys %$count)[0]);
+ my @chunks = split /$date_sep/, $date;
my $i = 0;
my %length = map { length $_ => $i++ } @chunks;
- my $format = $self->{Format};
+ my $format = lc $self->{Format};
+ my $format_sep;
+
+ my $lax = false;
if (exists $length{4}) {
- $format = join $separator,
+ $format = join $date_sep,
($length{4} == 0
? qw(yyyy mm dd)
: ($format =~ /^m/
@@ -30,15 +33,27 @@
: qw(dd mm yyyy)
)
);
+ $lax = true;
+ }
+ elsif ($date_sep =~ /^\\[-.]$/ and $format !~ /$date_sep/) {
+ $format = join $date_sep, qw(dd mm yy);
+ $lax = true;
}
else {
- $separator = do { local $_ = $format;
- tr/a-zA-Z//d;
- tr/a-zA-Z//cs;
- quotemeta; };
+ $format_sep = do { local $_ = $format;
+ tr/a-zA-Z//d;
+ tr/a-zA-Z//cs;
+ quotemeta; };
+ }
+ $format_sep ||= $date_sep;
+
+ if (not $lax and ($format_sep ne $date_sep)) {
+ $self->_set_failure;
+ $self->_set_error("(mismatch between format and date separator)");
+ return $self->_get_datetime_object;
}
- my @separated_order = split /$separator/, $format;
+ my @separated_order = split /$format_sep/, $format;
my ($d, $m, $y) = do {
my %f = map { substr($_, 0, 1) => true } @separated_order;
@@ -53,7 +68,7 @@
my $separated_index = 0;
my $separated_indices = { map { substr($_, 0, 1) => $separated_index++ } @separated_order };
- my @bits = split /$separator/, $date;
+ my @bits = split /$date_sep/, $date;
my $century = $self->{datetime}
? int($self->{datetime}->year / 100)
Modified: branches/upstream/libdatetime-format-natural-perl/current/lib/DateTime/Format/Natural/Lang/Base.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdatetime-format-natural-perl/current/lib/DateTime/Format/Natural/Lang/Base.pm?rev=54280&op=diff
==============================================================================
--- branches/upstream/libdatetime-format-natural-perl/current/lib/DateTime/Format/Natural/Lang/Base.pm (original)
+++ branches/upstream/libdatetime-format-natural-perl/current/lib/DateTime/Format/Natural/Lang/Base.pm Sun Mar 14 03:23:02 2010
@@ -5,7 +5,7 @@
our ($VERSION, $AUTOLOAD);
-$VERSION = '1.04';
+$VERSION = '1.05';
sub __new
{
@@ -25,7 +25,7 @@
$obj->{duration} = \%{"${class}::data_duration"};
$obj->{aliases} = \%{"${class}::data_aliases"};
- return bless $obj, ref($class) || $class;
+ return bless $obj, $class;
}
AUTOLOAD
Modified: branches/upstream/libdatetime-format-natural-perl/current/lib/DateTime/Format/Natural/Lang/EN.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdatetime-format-natural-perl/current/lib/DateTime/Format/Natural/Lang/EN.pm?rev=54280&op=diff
==============================================================================
--- branches/upstream/libdatetime-format-natural-perl/current/lib/DateTime/Format/Natural/Lang/EN.pm (original)
+++ branches/upstream/libdatetime-format-natural-perl/current/lib/DateTime/Format/Natural/Lang/EN.pm Sun Mar 14 03:23:02 2010
@@ -9,7 +9,7 @@
use DateTime::Format::Natural::Helpers qw(%flag);
-our $VERSION = '1.31';
+our $VERSION = '1.33';
our (%init,
%timespan,
@@ -112,13 +112,13 @@
);
%data_aliases = (
- all => {
+ words => {
tues => 'tue',
thurs => 'thu',
},
tokens => {
- mins => 'minutes',
- '@' => 'at',
+ mins => 'minutes',
+ '@' => 'at',
},
short => {
min => 'minute',
@@ -159,11 +159,11 @@
# [
# { <token index> => <token value>, ... }, ------------> declares the index <-> value map
# [ [ <index(es) of token(s) to be passed> ], ... ], --> declares which tokens will be passed to the extended check(s)
-# [ <subroutine(s) for extended check(s)>, ... ] ------> declares the extended check(s)
+# [ <subroutine(s) for extended check(s)>, ... ], -----> declares the extended check(s)
# [ [ <index(es) of token(s) to be passed> ], ... ], --> declares which tokens will be passed to the worker method(s)
-# [ { <additional options to be passed> }, ... ] ------> declares additional options
+# [ { <additional options to be passed> }, ... ], -----> declares additional options
# [ <name of method to dispatch to>, ... ], -----------> declares the worker method(s)
-# { <shared option>, ... } ----------------------------> declares shared options (post-processed)
+# { <shared option>, ... }, ---------------------------> declares shared options (post-processed)
# ],
%grammar = (
Modified: branches/upstream/libdatetime-format-natural-perl/current/t/02-parse_format.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdatetime-format-natural-perl/current/t/02-parse_format.t?rev=54280&op=diff
==============================================================================
--- branches/upstream/libdatetime-format-natural-perl/current/t/02-parse_format.t (original)
+++ branches/upstream/libdatetime-format-natural-perl/current/t/02-parse_format.t Sun Mar 14 03:23:02 2010
@@ -13,11 +13,13 @@
{ '05/27/79' => [ '27.05.2079 00:00:00', 'mm/dd/yy' ] },
{ '1979-05-27' => [ '27.05.1979 00:00:00', 'yyyy-mm-dd' ] },
{ '1979-05-27 21:09:14' => [ '27.05.1979 21:09:14', 'yyyy-mm-dd' ] },
+ { '31.12.99' => [ '31.12.2099 00:00:00', undef ] },
+ { '31-12-99' => [ '31.12.2099 00:00:00', undef ] },
{ '1/3' => [ '03.01.2006 00:00:00', undef ] },
{ '1/3 16:00' => [ '03.01.2006 16:00:00', undef ] },
);
-_run_tests(7, [ [ \@specific ] ], \&compare);
+_run_tests(9, [ [ \@specific ] ], \&compare);
sub compare
{
@@ -25,8 +27,12 @@
foreach my $href (@$aref) {
my $key = (keys %$href)[0];
- foreach my $string ($case_strings->($key)) {
- compare_strings($string, $href->{$key}->[0], $href->{$key}->[1]);
+ my @formats = do {
+ local $_ = $href->{$key}->[1];
+ defined ($_) ? $case_strings->($_) : (undef) x 3;
+ };
+ foreach my $format (@formats) {
+ compare_strings($key, $href->{$key}->[0], $format);
}
}
}
More information about the Pkg-perl-cvs-commits
mailing list