[Bps-public-commit] r9676 - in Date-Extract: . lib/Date
sartak at bestpractical.com
sartak at bestpractical.com
Thu Nov 15 19:39:24 EST 2007
Author: sartak
Date: Thu Nov 15 19:39:23 2007
New Revision: 9676
Modified:
Date-Extract/ (props changed)
Date-Extract/Makefile.PL
Date-Extract/README
Date-Extract/lib/Date/Extract.pm
Date-Extract/t/00-load.t
Date-Extract/t/01-new.t
Date-Extract/t/02-extract.t
Log:
r45226 at onn: sartak | 2007-11-15 17:38:53 -0500
Change all instances of glean to extract
Modified: Date-Extract/Makefile.PL
==============================================================================
--- Date-Extract/Makefile.PL (original)
+++ Date-Extract/Makefile.PL Thu Nov 15 19:39:23 2007
@@ -2,8 +2,8 @@
use inc::Module::Install;
# Define metadata
-name 'Date-Glean';
-all_from 'lib/Date/Glean.pm';
+name 'Date-Extract';
+all_from 'lib/Date/Extract.pm';
requires 'DateTime';
Modified: Date-Extract/README
==============================================================================
--- Date-Extract/README (original)
+++ Date-Extract/README Thu Nov 15 19:39:23 2007
@@ -1,4 +1,4 @@
-Date::Glean - simple date extraction
+Date::Extract - simple date extraction
There are already a few modules for getting a date out of a string.
DateTime::Format::Natural should be your first choice. There's also
Modified: Date-Extract/lib/Date/Extract.pm
==============================================================================
--- Date-Extract/lib/Date/Extract.pm (original)
+++ Date-Extract/lib/Date/Extract.pm Thu Nov 15 19:39:23 2007
@@ -1,11 +1,11 @@
-package Date::Glean;
+package Date::Extract;
use strict;
use warnings;
use DateTime;
=head1 NAME
-Date::Glean - simple date extraction
+Date::Extract - simple date extraction
=head1 VERSION
@@ -17,8 +17,8 @@
=head1 SYNOPSIS
- my $parser = Date::Glean->new();
- my $dt = $parser->glean_date($arbitrary_text);
+ my $parser = Date::Extract->new();
+ my $dt = $parser->extract_date($arbitrary_text);
if ($parser->success) {
return $dt->ymd;
} else {
@@ -40,7 +40,7 @@
=head1 METHODS
-=head2 new PARAMHASH => C<Date::Glean>
+=head2 new PARAMHASH => C<Date::Extract>
=head3 arguments
@@ -134,19 +134,19 @@
return $self;
}
-=head2 glean_date text => C<DateTime>
+=head2 extract_date text => C<DateTime>
-Takes an arbitrary amount of text and gleans one or more dates from it. The
+Takes an arbitrary amount of text and extracts one or more dates from it. The
return value will always be a list of valid L<DateTime> objects. Be sure to
check the C<success> method before using them, though.
See the documentation of C<new> for the configuration of this method.
-You may reuse a parser for multiple calls to C<glean_date>.
+You may reuse a parser for multiple calls to C<extract_date>.
=cut
-sub glean_date
+sub extract_date
{
my ($self, $text) = @_;
$self->{success} = 0;
@@ -158,8 +158,8 @@
=head2 success => C<boolean>
-Returns whether or not the most recent C<glean_date> successfully gleaned a
-date. This will be C<undef> if C<glean_date> has not been run at all yet.
+Returns whether or not the most recent C<extract_date> successfully extracted a
+date. This will be C<undef> if C<extract_date> has not been run at all yet.
=cut
@@ -187,8 +187,8 @@
No known bugs at this point.
Please report any bugs or feature requests to
-C<bug-date-glean at rt.cpan.org>, or through the web interface at
-L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Date-Glean>.
+C<bug-date-extract at rt.cpan.org>, or through the web interface at
+L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Date-Extract>.
I will be notified, and then you'll automatically be notified of progress on
your bug as I make changes.
@@ -196,7 +196,7 @@
You can find documentation for this module with the perldoc command.
- perldoc Date::Glean
+ perldoc Date::Extract
You can also look for information at:
@@ -204,19 +204,19 @@
=item * AnnoCPAN: Annotated CPAN documentation
-L<http://annocpan.org/dist/Date-Glean>
+L<http://annocpan.org/dist/Date-Extract>
=item * CPAN Ratings
-L<http://cpanratings.perl.org/d/Date-Glean>
+L<http://cpanratings.perl.org/d/Date-Extract>
=item * RT: CPAN's request tracker
-L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Date-Glean>
+L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Date-Extract>
=item * Search CPAN
-L<http://search.cpan.org/dist/Date-Glean>
+L<http://search.cpan.org/dist/Date-Extract>
=back
@@ -234,5 +234,5 @@
=cut
-1; # End of Date::Glean
+1; # End of Date::Extract
Modified: Date-Extract/t/00-load.t
==============================================================================
--- Date-Extract/t/00-load.t (original)
+++ Date-Extract/t/00-load.t Thu Nov 15 19:39:23 2007
@@ -3,5 +3,5 @@
use warnings;
use Test::More tests => 1;
-use_ok 'Date::Glean';
+use_ok 'Date::Extract';
Modified: Date-Extract/t/01-new.t
==============================================================================
--- Date-Extract/t/01-new.t (original)
+++ Date-Extract/t/01-new.t Thu Nov 15 19:39:23 2007
@@ -2,22 +2,22 @@
use strict;
use warnings;
use Test::More tests => 24;
-use Date::Glean;
+use Date::Extract;
-my $parser = Date::Glean->new();
-ok($parser, "got a parser out of Date::Glean->new");
-ok($parser->isa("Date::Glean"), "new parser is a Date::Glean object");
+my $parser = Date::Extract->new();
+ok($parser, "got a parser out of Date::Extract->new");
+ok($parser->isa("Date::Extract"), "new parser is a Date::Extract object");
# conflict {{{
for my $preference (qw/first last earliest latest all all_cron/)
{
- $parser = Date::Glean->new(conflict => $preference);
- ok($parser, "got a parser out of Date::Glean->new(conflict => 'first')");
- ok($parser->isa("Date::Glean"), "new parser is a Date::Glean object");
+ $parser = Date::Extract->new(conflict => $preference);
+ ok($parser, "got a parser out of Date::Extract->new(conflict => 'first')");
+ ok($parser->isa("Date::Extract"), "new parser is a Date::Extract object");
}
-$parser = eval { Date::Glean->new(conflict => "invalid argument") };
-ok(!$parser, "did NOT get a parser out of Date::Glean->new(conflict => 'invalid argument')");
+$parser = eval { Date::Extract->new(conflict => "invalid argument") };
+ok(!$parser, "did NOT get a parser out of Date::Extract->new(conflict => 'invalid argument')");
like($@, qr/Invalid `conflict` passed to constructor/, "(conflict => 'invalid argument') gave a sensible error message");
like($@, qr/01-new\.t/, "invalid `conflict` error reported from caller's perspective");
@@ -25,12 +25,12 @@
# prefer_future, prefer_past {{{
for my $prefer (qw/prefer_future prefer_past/)
{
- $parser = Date::Glean->new($prefer => 1);
- ok($parser, "got a parser out of Date::Glean->new($prefer => 1)");
- ok($parser->isa("Date::Glean"), "new parser is a Date::Glean object");
+ $parser = Date::Extract->new($prefer => 1);
+ ok($parser, "got a parser out of Date::Extract->new($prefer => 1)");
+ ok($parser->isa("Date::Extract"), "new parser is a Date::Extract object");
}
-$parser = Date::Glean->new(prefer_future => 1, prefer_past => 1);
+$parser = Date::Extract->new(prefer_future => 1, prefer_past => 1);
ok(!$parser, "did NOT get a parser when specifying prefer future AND past");
like($@, qr/Conflicting options `prefer_future` and `prefer_past` found in constructor/, "prefer_future and prefer_past together gives a specific error");
like($@, qr/01-new\.t/, "conflicting options error reported from caller's perspective");
Modified: Date-Extract/t/02-extract.t
==============================================================================
--- Date-Extract/t/02-extract.t (original)
+++ Date-Extract/t/02-extract.t Thu Nov 15 19:39:23 2007
@@ -2,91 +2,91 @@
use strict;
use warnings;
use Test::More tests => 25;
-use Date::Glean;
+use Date::Extract;
use Test::MockTime 'set_fixed_time';
# a Friday. The time I wrote this line of code, in fact
set_fixed_time('2007-08-03T00:36:52Z');
-my $parser = Date::Glean->new(prefer_future => 1);
+my $parser = Date::Extract->new(prefer_future => 1);
# days relative to today {{{
-my $dt = $parser->glean_date("today");
-is($dt->ymd, "2007-08-03", "gleans 'today'");
+my $dt = $parser->extract_date("today");
+is($dt->ymd, "2007-08-03", "extracts 'today'");
-$dt = $parser->glean_date("tomorrow");
-is($dt->ymd, "2007-08-04", "gleans 'tomorrow'");
+$dt = $parser->extract_date("tomorrow");
+is($dt->ymd, "2007-08-04", "extracts 'tomorrow'");
-$dt = $parser->glean_date("yesterday");
-is($dt->ymd, "2007-08-02", "gleans 'yesterday'");
+$dt = $parser->extract_date("yesterday");
+is($dt->ymd, "2007-08-02", "extracts 'yesterday'");
-$dt = $parser->glean_date("tonight");
-is($dt->ymd, "2007-08-03", "gleans 'tonight'");
+$dt = $parser->extract_date("tonight");
+is($dt->ymd, "2007-08-03", "extracts 'tonight'");
# }}}
# days of the week {{{
-$dt = $parser->glean_date("saturday");
-is($dt->ymd, "2007-08-05", "gleans 'saturday'");
+$dt = $parser->extract_date("saturday");
+is($dt->ymd, "2007-08-05", "extracts 'saturday'");
-$dt = $parser->glean_date("sunday");
-is($dt->ymd, "2007-08-06", "gleans 'sunday'");
+$dt = $parser->extract_date("sunday");
+is($dt->ymd, "2007-08-06", "extracts 'sunday'");
-$dt = $parser->glean_date("monday");
-is($dt->ymd, "2007-08-07", "gleans 'monday'");
+$dt = $parser->extract_date("monday");
+is($dt->ymd, "2007-08-07", "extracts 'monday'");
-$dt = $parser->glean_date("tuesday");
-is($dt->ymd, "2007-08-08", "gleans 'tuesday'");
+$dt = $parser->extract_date("tuesday");
+is($dt->ymd, "2007-08-08", "extracts 'tuesday'");
-$dt = $parser->glean_date("wednesday");
-is($dt->ymd, "2007-08-09", "gleans 'wednesday'");
+$dt = $parser->extract_date("wednesday");
+is($dt->ymd, "2007-08-09", "extracts 'wednesday'");
-$dt = $parser->glean_date("thursday");
-is($dt->ymd, "2007-08-10", "gleans 'thursday'");
+$dt = $parser->extract_date("thursday");
+is($dt->ymd, "2007-08-10", "extracts 'thursday'");
-$dt = $parser->glean_date("friday");
-is($dt->ymd, "2007-08-11", "gleans 'friday'");
+$dt = $parser->extract_date("friday");
+is($dt->ymd, "2007-08-11", "extracts 'friday'");
# }}}
# "last" days of the week {{{
-$dt = $parser->glean_date("last friday");
-is($dt->ymd, "2007-07-27", "gleans 'last friday'");
+$dt = $parser->extract_date("last friday");
+is($dt->ymd, "2007-07-27", "extracts 'last friday'");
-$dt = $parser->glean_date("last saturday");
-is($dt->ymd, "2007-07-28", "gleans 'last saturday'");
+$dt = $parser->extract_date("last saturday");
+is($dt->ymd, "2007-07-28", "extracts 'last saturday'");
-$dt = $parser->glean_date("last sunday");
-is($dt->ymd, "2007-07-29", "gleans last 'sunday'");
+$dt = $parser->extract_date("last sunday");
+is($dt->ymd, "2007-07-29", "extracts last 'sunday'");
-$dt = $parser->glean_date("last monday");
-is($dt->ymd, "2007-07-30", "gleans 'last monday'");
+$dt = $parser->extract_date("last monday");
+is($dt->ymd, "2007-07-30", "extracts 'last monday'");
-$dt = $parser->glean_date("last tuesday");
-is($dt->ymd, "2007-07-31", "gleans 'last tuesday'");
+$dt = $parser->extract_date("last tuesday");
+is($dt->ymd, "2007-07-31", "extracts 'last tuesday'");
-$dt = $parser->glean_date("last wednesday");
-is($dt->ymd, "2007-08-01", "gleans 'last wednesday'");
+$dt = $parser->extract_date("last wednesday");
+is($dt->ymd, "2007-08-01", "extracts 'last wednesday'");
-$dt = $parser->glean_date("last thursday");
-is($dt->ymd, "2007-08-02", "gleans 'last thursday'");
+$dt = $parser->extract_date("last thursday");
+is($dt->ymd, "2007-08-02", "extracts 'last thursday'");
# }}}
# "next" days of the week {{{
-$dt = $parser->glean_date("next saturday");
-is($dt->ymd, "2007-08-05", "gleans 'next saturday'");
+$dt = $parser->extract_date("next saturday");
+is($dt->ymd, "2007-08-05", "extracts 'next saturday'");
-$dt = $parser->glean_date("next sunday");
-is($dt->ymd, "2007-08-06", "gleans 'next sunday'");
+$dt = $parser->extract_date("next sunday");
+is($dt->ymd, "2007-08-06", "extracts 'next sunday'");
-$dt = $parser->glean_date("next monday");
-is($dt->ymd, "2007-08-07", "gleans 'next monday'");
+$dt = $parser->extract_date("next monday");
+is($dt->ymd, "2007-08-07", "extracts 'next monday'");
-$dt = $parser->glean_date("next tuesday");
-is($dt->ymd, "2007-08-08", "gleans 'next tuesday'");
+$dt = $parser->extract_date("next tuesday");
+is($dt->ymd, "2007-08-08", "extracts 'next tuesday'");
-$dt = $parser->glean_date("next wednesday");
-is($dt->ymd, "2007-08-09", "gleans 'next wednesday'");
+$dt = $parser->extract_date("next wednesday");
+is($dt->ymd, "2007-08-09", "extracts 'next wednesday'");
-$dt = $parser->glean_date("next thursday");
-is($dt->ymd, "2007-08-10", "gleans 'next thursday'");
+$dt = $parser->extract_date("next thursday");
+is($dt->ymd, "2007-08-10", "extracts 'next thursday'");
-$dt = $parser->glean_date("next friday");
-is($dt->ymd, "2007-08-11", "gleans 'next friday'");
+$dt = $parser->extract_date("next friday");
+is($dt->ymd, "2007-08-11", "extracts 'next friday'");
# }}}
More information about the Bps-public-commit
mailing list