r24429 - in /trunk/libdatetime-format-natural-perl: Changes META.yml debian/changelog lib/DateTime/Format/Natural.pm lib/DateTime/Format/Natural/Base.pm lib/DateTime/Format/Natural/Lang/Base.pm scripts/dateparse
ansgar-guest at users.alioth.debian.org
ansgar-guest at users.alioth.debian.org
Thu Aug 21 10:01:50 UTC 2008
Author: ansgar-guest
Date: Thu Aug 21 10:01:44 2008
New Revision: 24429
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=24429
Log:
New upstream release
Modified:
trunk/libdatetime-format-natural-perl/Changes
trunk/libdatetime-format-natural-perl/META.yml
trunk/libdatetime-format-natural-perl/debian/changelog
trunk/libdatetime-format-natural-perl/lib/DateTime/Format/Natural.pm
trunk/libdatetime-format-natural-perl/lib/DateTime/Format/Natural/Base.pm
trunk/libdatetime-format-natural-perl/lib/DateTime/Format/Natural/Lang/Base.pm
trunk/libdatetime-format-natural-perl/scripts/dateparse
Modified: trunk/libdatetime-format-natural-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdatetime-format-natural-perl/Changes?rev=24429&op=diff
==============================================================================
--- trunk/libdatetime-format-natural-perl/Changes (original)
+++ trunk/libdatetime-format-natural-perl/Changes Thu Aug 21 10:01:44 2008
@@ -1,4 +1,32 @@
Revision history for Perl extension DateTime::Format::Natural.
+
+0.72 Sat Aug 16 13:39:27 CEST 2008
+
+ - When referring within classes to themselves, use the proper
+ term "class" instead of "module".
+
+ - Merged development version to stable.
+
+0.71_04 Thu Aug 7 11:28:36 CEST 2008
+
+ - Call validation_options() when DateTime::Format::Natural
+ gets loaded (instead of relying on it to be called from
+ within a method).
+
+0.71_03 Sun Aug 3 11:06:09 CEST 2008
+
+ - Declared some more expected types when validating arguments
+ with Params::Validate.
+
+0.71_02 Fri Aug 1 13:54:02 CEST 2008
+
+ - Moved some duplicated code fragments within the main base class
+ to separate methods.
+
+0.71_01 Wed Jul 30 22:15:49 CEST 2008
+
+ - Added time_zone parameter support to 'dateparse' and a shortcut
+ to leave it quickly.
0.71 Thu Jun 12 11:17:22 CEST 2008
Modified: trunk/libdatetime-format-natural-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdatetime-format-natural-perl/META.yml?rev=24429&op=diff
==============================================================================
--- trunk/libdatetime-format-natural-perl/META.yml (original)
+++ trunk/libdatetime-format-natural-perl/META.yml Thu Aug 21 10:01:44 2008
@@ -1,6 +1,6 @@
---
name: DateTime-Format-Natural
-version: 0.71
+version: 0.72
author:
- 'Steven Schubiger <schubiger at cpan.org>'
abstract: Create machine readable date/time with natural parsing logic
@@ -22,13 +22,13 @@
provides:
DateTime::Format::Natural:
file: lib/DateTime/Format/Natural.pm
- version: 0.71
+ version: 0.72
DateTime::Format::Natural::Base:
file: lib/DateTime/Format/Natural/Base.pm
- version: 1.11
+ version: 1.13
DateTime::Format::Natural::Lang::Base:
file: lib/DateTime/Format/Natural/Lang/Base.pm
- version: 0.8
+ version: 0.9
DateTime::Format::Natural::Lang::EN:
file: lib/DateTime/Format/Natural/Lang/EN.pm
version: 1.11
Modified: trunk/libdatetime-format-natural-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdatetime-format-natural-perl/debian/changelog?rev=24429&op=diff
==============================================================================
--- trunk/libdatetime-format-natural-perl/debian/changelog (original)
+++ trunk/libdatetime-format-natural-perl/debian/changelog Thu Aug 21 10:01:44 2008
@@ -1,8 +1,12 @@
-libdatetime-format-natural-perl (0.71-2) UNRELEASED; urgency=low
+libdatetime-format-natural-perl (0.72-1) unstable; urgency=low
+ [ Tim Retout ]
* debian/copyright: Fix 'at your opinion' typo.
- -- Tim Retout <tim at retout.co.uk> Sun, 10 Aug 2008 15:54:53 -0300
+ [ Ansgar Burchardt ]
+ * New upstream release
+
+ -- Ansgar Burchardt <ansgar at 43-1.org> Thu, 21 Aug 2008 12:01:34 +0200
libdatetime-format-natural-perl (0.71-1) unstable; urgency=low
Modified: trunk/libdatetime-format-natural-perl/lib/DateTime/Format/Natural.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdatetime-format-natural-perl/lib/DateTime/Format/Natural.pm?rev=24429&op=diff
==============================================================================
--- trunk/libdatetime-format-natural-perl/lib/DateTime/Format/Natural.pm (original)
+++ trunk/libdatetime-format-natural-perl/lib/DateTime/Format/Natural.pm Thu Aug 21 10:01:44 2008
@@ -10,7 +10,17 @@
use List::MoreUtils qw(all any);
use Params::Validate ':all';
-our $VERSION = '0.71';
+our $VERSION = '0.72';
+
+validation_options(
+ on_fail => sub
+{
+ my ($error) = @_;
+ chomp $error;
+ croak $error;
+},
+ stack_skip => 2,
+);
sub new
{
@@ -44,16 +54,6 @@
sub _init_check
{
my $self = shift;
-
- validation_options(
- on_fail => sub
- {
- my ($error) = @_;
- chomp $error;
- croak $error;
- },
- stack_skip => 2,
- );
validate(@_, {
lang => {
@@ -193,13 +193,13 @@
my $self = shift;
if (@_ > 1) {
- validate(@_, { string => 1 });
+ validate(@_, { string => { type => SCALAR }});
my %opts = @_;
$self->{Date_string} = $opts{string};
(undef) = $opts{debug}; # legacy
}
else {
- validate_pos(@_, 1);
+ validate_pos(@_, { type => SCALAR });
($self->{Date_string}) = @_;
}
Modified: trunk/libdatetime-format-natural-perl/lib/DateTime/Format/Natural/Base.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdatetime-format-natural-perl/lib/DateTime/Format/Natural/Base.pm?rev=24429&op=diff
==============================================================================
--- trunk/libdatetime-format-natural-perl/lib/DateTime/Format/Natural/Base.pm (original)
+++ trunk/libdatetime-format-natural-perl/lib/DateTime/Format/Natural/Base.pm Thu Aug 21 10:01:44 2008
@@ -3,13 +3,12 @@
use strict;
use warnings;
-use DateTime ();
use Date::Calc qw(Add_Delta_Days
Decode_Day_of_Week
Nth_Weekday_of_Month_Year
check_date check_time);
-our $VERSION = '1.11';
+our $VERSION = '1.13';
use constant MORNING => '08';
use constant AFTERNOON => '14';
@@ -350,11 +349,7 @@
my $self = shift;
$self->_add_trace;
my ($month) = @_;
- $month = ucfirst lc $month;
- if (length $month == 3) {
- $month = $self->{data}->{months_abbrev}->{$month};
- }
- $self->_set(month => $self->{data}->{months}->{$month});
+ $self->_set(month => $self->_month_num($month));
$self->_set_modified(1);
}
@@ -363,11 +358,7 @@
my $self = shift;
$self->_add_trace;
my ($month, $day) = @_;
- $month = ucfirst lc $month;
- if (length $month == 3) {
- $month = $self->{data}->{months_abbrev}->{$month};
- }
- $self->_set(month => $self->{data}->{months}->{$month});
+ $self->_set(month => $self->_month_num($month));
if ($self->_valid_date(day => $day)) {
$self->_set(day => $day);
}
@@ -379,11 +370,7 @@
my $self = shift;
$self->_add_trace;
my ($day, $month) = @_;
- $month = ucfirst lc $month;
- if (length $month == 3) {
- $month = $self->{data}->{months_abbrev}->{$month};
- }
- $self->_set(month => $self->{data}->{months}->{$month});
+ $self->_set(month => $self->_month_num($month));
if ($self->_valid_date(day => $day)) {
$self->_set(day => $day);
}
@@ -406,10 +393,7 @@
my $self = shift;
$self->_add_trace;
my ($day) = @_;
- $day = ucfirst lc $day;
- if (length $day == 3) {
- $day = $self->{data}->{weekdays_abbrev}->{$day};
- }
+ $self->_day_name(\$day);
my $days_diff;
# Set current weekday by adding the day difference
if ($self->{data}->{weekdays}->{$day} > $self->{datetime}->wday) {
@@ -429,10 +413,7 @@
my $self = shift;
$self->_add_trace;
my ($day) = @_;
- $day = ucfirst lc $day;
- if (length $day == 3) {
- $day = $self->{data}->{weekdays_abbrev}->{$day};
- }
+ $self->_day_name(\$day);
my $days_diff = $self->{datetime}->wday + (7 - $self->{data}->{weekdays}->{$day});
$self->_subtract(day => $days_diff);
$self->_set_modified(2);
@@ -482,12 +463,8 @@
my $self = shift;
$self->_add_trace;
my ($month) = @_;
- $month = ucfirst lc $month;
- if (length $month == 3) {
- $month = $self->{data}->{months_abbrev}->{$month};
- }
$self->_subtract(year => 1);
- $self->_set(month => $self->{data}->{months}->{$month});
+ $self->_set(month => $self->_month_num($month));
$self->_set_modified(4);
}
@@ -522,10 +499,7 @@
my $self = shift;
$self->_add_trace;
my ($day) = @_;
- $day = ucfirst lc $day;
- if (length $day == 3) {
- $day = $self->{data}->{weekdays_abbrev}->{$day};
- }
+ $self->_day_name(\$day);
my $days_diff = (7 - $self->{datetime}->wday + Decode_Day_of_Week($day));
$self->_add(day => $days_diff);
$self->_set_modified(2);
@@ -536,10 +510,7 @@
my $self = shift;
$self->_add_trace;
my ($day) = @_;
- $day = ucfirst lc $day;
- if (length $day == 3) {
- $day = $self->{data}->{weekdays_abbrev}->{$day};
- }
+ $self->_day_name(\$day);
my $days_diff = (7 - $self->{datetime}->wday + Decode_Day_of_Week($day));
$self->_add(day => $days_diff);
$self->_set_modified(3);
@@ -550,12 +521,8 @@
my $self = shift;
$self->_add_trace;
my ($month) = @_;
- $month = ucfirst lc $month;
- if (length $month == 3) {
- $month = $self->{data}->{months_abbrev}->{$month};
- }
$self->_add(year => 1);
- $self->_set(month => $self->{data}->{months}->{$month});
+ $self->_set(month => $self->_month_num($month));
$self->_set_modified(2);
}
@@ -634,10 +601,7 @@
my $self = shift;
$self->_add_trace;
my ($day) = @_;
- $day = ucfirst lc $day;
- if (length $day == 3) {
- $day = $self->{data}->{weekdays_abbrev}->{$day};
- }
+ $self->_day_name(\$day);
my $days_diff = $self->{data}->{weekdays}->{$day} - $self->{datetime}->wday;
$self->_add(day => $days_diff);
$self->_set_modified(2);
@@ -666,14 +630,8 @@
my $self = shift;
my ($count, $day, $month) = @_;
$self->_add_trace;
- $day = ucfirst lc $day;
- if (length $day == 3) {
- $day = $self->{data}->{weekdays_abbrev}->{$day};
- }
- $month = ucfirst lc $month;
- if (length $month == 3) {
- $month = $self->{data}->{months_abbrev}->{$month};
- }
+ $self->_day_name(\$day);
+ $self->_month_name(\$month);
my $year;
($year, $month, $day) =
Nth_Weekday_of_Month_Year($self->{datetime}->year,
@@ -837,6 +795,37 @@
$self->_set_modified(2);
}
+sub _day_name
+{
+ my $self = shift;
+ my ($day) = @_;
+ $$day = ucfirst lc $$day;
+ if (length $$day == 3) {
+ $$day = $self->{data}->{weekdays_abbrev}->{$$day};
+ }
+}
+
+sub _month_name
+{
+ my $self = shift;
+ my ($month) = @_;
+ $$month = ucfirst lc $$month;
+ if (length $$month == 3) {
+ $$month = $self->{data}->{months_abbrev}->{$$month};
+ }
+}
+
+sub _month_num
+{
+ my $self = shift;
+ my ($month) = @_;
+ $month = ucfirst lc $month;
+ if (length $month == 3) {
+ $month = $self->{data}->{months_abbrev}->{$month};
+ }
+ return $self->{data}->{months}->{$month};
+}
+
sub _add
{
my ($self, $unit, $value) = @_;
@@ -914,7 +903,7 @@
=head1 DESCRIPTION
-The C<DateTime::Format::Natural::Base> module defines the core functionality of
+The C<DateTime::Format::Natural::Base> class defines the core functionality of
C<DateTime::Format::Natural>.
=head1 SEE ALSO
Modified: trunk/libdatetime-format-natural-perl/lib/DateTime/Format/Natural/Lang/Base.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdatetime-format-natural-perl/lib/DateTime/Format/Natural/Lang/Base.pm?rev=24429&op=diff
==============================================================================
--- trunk/libdatetime-format-natural-perl/lib/DateTime/Format/Natural/Lang/Base.pm (original)
+++ trunk/libdatetime-format-natural-perl/lib/DateTime/Format/Natural/Lang/Base.pm Thu Aug 21 10:01:44 2008
@@ -5,7 +5,7 @@
our ($VERSION, $AUTOLOAD);
-$VERSION = '0.8';
+$VERSION = '0.9';
sub __new
{
@@ -57,8 +57,8 @@
=head1 DESCRIPTION
-The C<DateTime::Format::Natural::Lang::Base> module defines the core functionality for
-C<DateTime::Format::Natural::Lang::> classes.
+The C<DateTime::Format::Natural::Lang::Base> class defines the core functionality for
+C<DateTime::Format::Natural::Lang::> grammar classes.
=head1 SEE ALSO
Modified: trunk/libdatetime-format-natural-perl/scripts/dateparse
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdatetime-format-natural-perl/scripts/dateparse?rev=24429&op=diff
==============================================================================
--- trunk/libdatetime-format-natural-perl/scripts/dateparse (original)
+++ trunk/libdatetime-format-natural-perl/scripts/dateparse Thu Aug 21 10:01:44 2008
@@ -30,7 +30,8 @@
l|lang=s
p|prefer_future
s|supported
- t|trace
+ t|time_zone=s
+ T|trace
V|version)) or usage();
usage() if $opts{h};
@@ -45,12 +46,13 @@
my $opts = shift;
$lang = $opts->{l} || LANG_DEFAULT;
- $trace = $opts->{t} || 0;
+ $trace = $opts->{T} || 0;
my %table = (
l => 'lang',
f => 'format',
p => 'prefer_future',
+ t => 'time_zone',
);
foreach my $opt (keys %$opts) {
@@ -69,7 +71,8 @@
-l, --lang language code
-p, --prefer_future use futuristic dates (when possible)
-s, --supported list of supported languages
- -t, --trace print trace after processing
+ -t, --time_zone time zone string
+ -T, --trace print trace after processing
-V, --version print version
USAGE
exit;
@@ -99,14 +102,14 @@
while (defined(my $input = $term->readline($prompt))) {
$term->addhistory($input) if $input =~ /\S/;
- last if $input =~ /^(?:quit|exit)$/;
+ last if $input =~ /^(?:q(?:uit)?|exit)$/;
if ($input =~ /^(?:\?|help)$/i) {
print <<EOT;
Commands
?, help this help screen
- exit, quit leave dateparse
+ exit, q, quit leave dateparse
everything else datetime string
EOT
@@ -143,7 +146,8 @@
-l, --lang language code
-p, --prefer_future use futuristic dates (when possible)
-s, --supported list of supported languages
- -t, --trace print trace after processing
+ -t, --time_zone time zone string
+ -T, --trace print trace after processing
-V, --version print version
=head1 AUTHOR
More information about the Pkg-perl-cvs-commits
mailing list