[Bps-public-commit] Date-Extract branch master updated. 0.06-3-g88d1405

BPS Git Server git at git.bestpractical.com
Wed Jan 11 22:10:07 UTC 2023


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Date-Extract".

The branch, master has been updated
       via  88d1405342a28ab44c85717fd149281fb940d452 (commit)
       via  13e91cdd308fcb05411f3015e3e5ca0668daa267 (commit)
       via  d6bc447bf96b7ab52bd2883e540d12edf2cbfa96 (commit)
      from  050bdbb938a72e9b206090403ca8cf74ed7f5be1 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 88d1405342a28ab44c85717fd149281fb940d452
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Wed Jan 11 17:09:12 2023 -0500

    Prep version 0.07

diff --git a/Changes b/Changes
index 7557a9c..29e11a1 100644
--- a/Changes
+++ b/Changes
@@ -1,3 +1,7 @@
+0.07 2023-01-11
+ - Update tests to use Test::MockTime::HiRes to align with changes in
+   DateTime::Format::Natural.
+
 0.06 2016-11-10
  - Fix a POD tag typo
  - Packaging updates, including fixing a missing META.yml
diff --git a/MANIFEST b/MANIFEST
index eeebce3..9db5380 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -8,6 +8,7 @@ inc/Module/Install/Fetch.pm
 inc/Module/Install/Include.pm
 inc/Module/Install/Makefile.pm
 inc/Module/Install/Metadata.pm
+inc/Module/Install/ReadmeFromPod.pm
 inc/Module/Install/Win32.pm
 inc/Module/Install/WriteAll.pm
 lib/Date/Extract.pm
diff --git a/META.yml b/META.yml
index d5624b0..c23082a 100644
--- a/META.yml
+++ b/META.yml
@@ -1,7 +1,7 @@
 ---
 abstract: 'extract probable dates from strings'
 author:
-  - 'Shawn M Moore, C<< <sartak at bestpractical dot com> >>'
+  - 'Shawn M Moore'
 build_requires:
   ExtUtils::MakeMaker: 6.36
   Test::MockTime: 0
@@ -10,7 +10,7 @@ configure_requires:
   ExtUtils::MakeMaker: 6.36
 distribution_type: module
 dynamic_config: 1
-generated_by: 'Module::Install version 1.17'
+generated_by: 'Module::Install version 1.19'
 license: perl
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -28,4 +28,4 @@ requires:
   parent: 0
 resources:
   license: http://dev.perl.org/licenses/
-version: '0.06'
+version: '0.07'
diff --git a/Makefile.PL b/Makefile.PL
index 9d092ae..5ee76b5 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -1,9 +1,11 @@
 # Load the Module::Install bundled in ./inc/
+use lib '.';
 use inc::Module::Install;
 
 # Define metadata
 name           'Date-Extract';
 all_from       'lib/Date/Extract.pm';
+readme_from    'lib/Date/Extract.pm';
 
 requires       'List::Util';
 requires       'Carp';
diff --git a/README b/README
index cd2d03c..ab8b048 100644
--- a/README
+++ b/README
@@ -1,9 +1,6 @@
 NAME
     Date::Extract - extract probable dates from strings
 
-VERSION
-    Version 0.02 released 13 Feb 08
-
 SYNOPSIS
         my $parser = Date::Extract->new();
         my $dt = $parser->extract($arbitrary_text)
@@ -13,24 +10,32 @@ SYNOPSIS
 MOTIVATION
     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
-    Time::ParseDate which fits some very specific formats. Finally, you can
-    coerce Date::Manip to do your bidding.
+    Time::ParseDate which fits many formats. Finally, you can coerce
+    Date::Manip to do your bidding.
 
     But I needed something that will take an arbitrary block of text, search
-    it for something that looks like a date string, and build a DateTime
-    object out of it. This module fills this niche. By design it will
-    produce few false positives. This means it will not catch nearly
-    everything that looks like a date string. So if you have the string "do
-    homework for class 2019" it won't return a DateTime object with the year
-    set to 2019.
+    it for something that looks like a date string, and extract it. This
+    module fills this niche. By design it will produce few false positives.
+    This means it will not catch nearly everything that looks like a date
+    string. So if you have the string "do homework for class 2019" it won't
+    return a DateTime object with the year set to 2019. This is what your
+    users would probably expect.
 
 METHODS
   new PARAMHASH => "Date::Extract"
    arguments
+    format
+        Choose what format the extracted date(s) will be. The default is
+        "DateTime", which will return DateTime object(s). Other option
+        include "verbatim" (return the original text), or "epoch" (return
+        Unix timestamp).
+
     time_zone
+        Only relevant when "format" is set to "DateTime".
+
         Forces a particular time zone to be set (this actually matters, as
-        "Tuesday" on Monday at 11 PM means something different than
-        "Tuesday" on Tuesday at 1 AM).
+        "tomorrow" on Monday at 11 PM means something different than
+        "tomorrow" on Tuesday at 1 AM).
 
         By default it will use the "floating" time zone. See the
         documentation for DateTime.
@@ -70,85 +75,63 @@ METHODS
             follows any other date in the string.
 
         all Returns all dates found in the string, in the order they were
-            found in the strong.
+            found in the string.
 
         all_cron
             Returns all dates found in the string, in chronological order.
 
-        This method will combine the arguments of parser->new and extract.
-        Modify the "to" hash directly.
+  extract text, ARGS => dates
+    Takes an arbitrary amount of text and extracts one or more dates from
+    it. The return value will be zero or more dates, which by default are
+    DateTime objects (but can be customized with the "format" argument). If
+    called in scalar context, only one will be returned, even if the
+    "returns" argument specifies multiple possible return values.
 
-  extract, ARGS text => "DateTime"s
-        Takes an arbitrary amount of text and extracts one or more dates
-        from it. The return value will be zero or more "DateTime" objects.
-        If called in scalar context, only one will be returned, even if the
-        "returns" argument specifies multiple possible return values.
+    See the documentation of "new" for the configuration of this method. Any
+    arguments passed into this method will trump those from the constructor.
 
-        See the documentation of "new" for the configuration of this method.
-        Any arguments passed into this method will trump those from the
-        parser.
+    You may reuse a parser for multiple calls to "extract".
 
-        You may reuse a parser for multiple calls to "extract".
-
-        You do not need to have an instantiated "Date::Extract" object to
-        call this method. Just "Date::Extract->extract($foo)" will work.
+    You do not need to have an instantiated "Date::Extract" object to call
+    this method. Just "Date::Extract->extract($foo)" will work.
 
 FORMATS HANDLED
-        today; tomorrow; yesterday
-        last Friday; next Monday; previous Sat
-        Monday; Mon
-        November 13th, 1986; Nov 13, 1986
-        November 13th; Nov 13
-        13 Nov; 13th November
-        1986/11/13; 1986-11-13
-        11-13-86; 11/13/1986
+    *   today; tomorrow; yesterday
 
-CAVEATS
-        This module is *intentionally* very simple. Surprises are *not*
-        welcome here.
+    *   last Friday; next Monday; previous Sat
 
-SEE ALSO
-        DateTime::Format::Natural, Time::ParseDate, Date::Manip
+    *   Monday; Mon
 
-AUTHOR
-        Shawn M Moore, "<sartak at gmail.com>"
-
-BUGS
-        No known bugs at this point.
+    *   November 13th, 1986; Nov 13, 1986
 
-        Please report any bugs or feature requests to "bug-date-extract at
-        rt.cpan.org", or through the web interface at
-        <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.
+    *   13 November 1986; 13 Nov 1986
 
-SUPPORT
-        You can find documentation for this module with the perldoc command.
+    *   November 13th; Nov 13
 
-            perldoc Date::Extract
+    *   13 Nov; 13th November
 
-        You can also look for information at:
+    *   1986/11/13; 1986-11-13
 
-        * AnnoCPAN: Annotated CPAN documentation
-            <http://annocpan.org/dist/Date-Extract>
+    *   11-13-86; 11/13/1986
 
-        * CPAN Ratings
-            <http://cpanratings.perl.org/d/Date-Extract>
+CAVEATS
+    This module is *intentionally* very simple. Surprises are *not* welcome
+    here.
 
-        * RT: CPAN's request tracker
-            <http://rt.cpan.org/NoAuth/Bugs.html?Dist=Date-Extract>
+SEE ALSO
+    DateTime::Format::Natural, Time::ParseDate, Date::Manip
 
-        * Search CPAN
-            <http://search.cpan.org/dist/Date-Extract>
+AUTHOR
+    Shawn M Moore Best Practical Solutions <modules at bestpractical.com>
 
 ACKNOWLEDGEMENTS
-        Thanks to Steven Schubiger for writing the fine
-        DateTime::Format::Natural. We still use it, but it doesn't quite
-        fill all the particular needs we have.
+    Thanks to Steven Schubiger for writing the fine
+    DateTime::Format::Natural. We still use it, but it doesn't quite fill
+    all the particular needs we have.
 
 COPYRIGHT & LICENSE
-        Copyright 2007 Best Practical Solutions.
+    Copyright 2007-2009 Best Practical Solutions.
 
-        This program is free software; you can redistribute it and/or modify
-        it under the same terms as Perl itself.
+    This program is free software; you can redistribute it and/or modify it
+    under the same terms as Perl itself.
 
diff --git a/lib/Date/Extract.pm b/lib/Date/Extract.pm
index 894c4eb..204eac9 100644
--- a/lib/Date/Extract.pm
+++ b/lib/Date/Extract.pm
@@ -5,7 +5,7 @@ use DateTime::Format::Natural;
 use List::Util 'reduce';
 use parent 'Class::Data::Inheritable';
 
-our $VERSION = '0.06';
+our $VERSION = '0.07';
 
 __PACKAGE__->mk_classdata($_) for qw/scalar_downgrade handlers regex/;
 
@@ -385,7 +385,8 @@ L<DateTime::Format::Natural>, L<Time::ParseDate>, L<Date::Manip>
 
 =head1 AUTHOR
 
-Shawn M Moore, C<< <sartak at bestpractical dot com> >>
+Shawn M Moore
+Best Practical Solutions <modules at bestpractical.com>
 
 =head1 ACKNOWLEDGEMENTS
 

commit 13e91cdd308fcb05411f3015e3e5ca0668daa267
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Wed Jan 11 16:52:46 2023 -0500

    Update Module::Install

diff --git a/inc/Module/AutoInstall.pm b/inc/Module/AutoInstall.pm
index 11184d4..8852e0b 100644
--- a/inc/Module/AutoInstall.pm
+++ b/inc/Module/AutoInstall.pm
@@ -8,7 +8,7 @@ use ExtUtils::MakeMaker ();
 
 use vars qw{$VERSION};
 BEGIN {
-	$VERSION = '1.17';
+	$VERSION = '1.19';
 }
 
 # special map on pre-defined feature sets
diff --git a/inc/Module/Install.pm b/inc/Module/Install.pm
index dbe10ca..7ba98c2 100644
--- a/inc/Module/Install.pm
+++ b/inc/Module/Install.pm
@@ -31,7 +31,7 @@ BEGIN {
 	# This is not enforced yet, but will be some time in the next few
 	# releases once we can make sure it won't clash with custom
 	# Module::Install extensions.
-	$VERSION = '1.17';
+	$VERSION = '1.19';
 
 	# Storage for the pseudo-singleton
 	$MAIN    = undef;
diff --git a/inc/Module/Install/AutoInstall.pm b/inc/Module/Install/AutoInstall.pm
index 03d1e70..0e3dada 100644
--- a/inc/Module/Install/AutoInstall.pm
+++ b/inc/Module/Install/AutoInstall.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.17';
+	$VERSION = '1.19';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }
diff --git a/inc/Module/Install/Base.pm b/inc/Module/Install/Base.pm
index 3d89918..9fa42c2 100644
--- a/inc/Module/Install/Base.pm
+++ b/inc/Module/Install/Base.pm
@@ -4,7 +4,7 @@ package Module::Install::Base;
 use strict 'vars';
 use vars qw{$VERSION};
 BEGIN {
-	$VERSION = '1.17';
+	$VERSION = '1.19';
 }
 
 # Suspend handler for "redefined" warnings
diff --git a/inc/Module/Install/Can.pm b/inc/Module/Install/Can.pm
index fc699b3..d65c753 100644
--- a/inc/Module/Install/Can.pm
+++ b/inc/Module/Install/Can.pm
@@ -8,7 +8,7 @@ use Module::Install::Base ();
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.17';
+	$VERSION = '1.19';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }
diff --git a/inc/Module/Install/Fetch.pm b/inc/Module/Install/Fetch.pm
index 3ee0aa1..3072b08 100644
--- a/inc/Module/Install/Fetch.pm
+++ b/inc/Module/Install/Fetch.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.17';
+	$VERSION = '1.19';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }
diff --git a/inc/Module/Install/Include.pm b/inc/Module/Install/Include.pm
index e8a73b8..13fdcd0 100644
--- a/inc/Module/Install/Include.pm
+++ b/inc/Module/Install/Include.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.17';
+	$VERSION = '1.19';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }
diff --git a/inc/Module/Install/Makefile.pm b/inc/Module/Install/Makefile.pm
index bc81e06..13a4464 100644
--- a/inc/Module/Install/Makefile.pm
+++ b/inc/Module/Install/Makefile.pm
@@ -8,7 +8,7 @@ use Fcntl qw/:flock :seek/;
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.17';
+	$VERSION = '1.19';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }
diff --git a/inc/Module/Install/Metadata.pm b/inc/Module/Install/Metadata.pm
index 29934cf..11bf971 100644
--- a/inc/Module/Install/Metadata.pm
+++ b/inc/Module/Install/Metadata.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.17';
+	$VERSION = '1.19';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }
diff --git a/inc/Module/Install/ReadmeFromPod.pm b/inc/Module/Install/ReadmeFromPod.pm
new file mode 100644
index 0000000..3738232
--- /dev/null
+++ b/inc/Module/Install/ReadmeFromPod.pm
@@ -0,0 +1,184 @@
+#line 1
+package Module::Install::ReadmeFromPod;
+
+use 5.006;
+use strict;
+use warnings;
+use base qw(Module::Install::Base);
+use vars qw($VERSION);
+
+$VERSION = '0.30';
+
+{
+
+    # these aren't defined until after _require_admin is run, so
+    # define them so prototypes are available during compilation.
+    sub io;
+    sub capture(&;@);
+
+#line 28
+
+    my $done = 0;
+
+    sub _require_admin {
+
+	# do this once to avoid redefinition warnings from IO::All
+	return if $done;
+
+	require IO::All;
+	IO::All->import( '-binary' );
+
+	require Capture::Tiny;
+	Capture::Tiny->import ( 'capture' );
+
+	return;
+    }
+
+}
+
+sub readme_from {
+  my $self = shift;
+  return unless $self->is_admin;
+
+  _require_admin;
+
+  # Input file
+  my $in_file  = shift || $self->_all_from
+    or die "Can't determine file to make readme_from";
+
+  # Get optional arguments
+  my ($clean, $format, $out_file, $options);
+  my $args = shift;
+  if ( ref $args ) {
+    # Arguments are in a hashref
+    if ( ref($args) ne 'HASH' ) {
+      die "Expected a hashref but got a ".ref($args)."\n";
+    } else {
+      $clean    = $args->{'clean'};
+      $format   = $args->{'format'};
+      $out_file = $args->{'output_file'};
+      $options  = $args->{'options'};
+    }
+  } else {
+    # Arguments are in a list
+    $clean    = $args;
+    $format   = shift;
+    $out_file = shift;
+    $options  = \@_;
+  }
+
+  # Default values;
+  $clean  ||= 0;
+  $format ||= 'txt';
+
+  # Generate README
+  print "readme_from $in_file to $format\n";
+  if ($format =~ m/te?xt/) {
+    $out_file = $self->_readme_txt($in_file, $out_file, $options);
+  } elsif ($format =~ m/html?/) {
+    $out_file = $self->_readme_htm($in_file, $out_file, $options);
+  } elsif ($format eq 'man') {
+    $out_file = $self->_readme_man($in_file, $out_file, $options);
+  } elsif ($format eq 'md') {
+    $out_file = $self->_readme_md($in_file, $out_file, $options);
+  } elsif ($format eq 'pdf') {
+    $out_file = $self->_readme_pdf($in_file, $out_file, $options);
+  }
+
+  if ($clean) {
+    $self->clean_files($out_file);
+  }
+
+  return 1;
+}
+
+
+sub _readme_txt {
+  my ($self, $in_file, $out_file, $options) = @_;
+  $out_file ||= 'README';
+  require Pod::Text;
+  my $parser = Pod::Text->new( @$options );
+  my $io = io->file($out_file)->open(">");
+  my $out_fh = $io->io_handle;
+  $parser->output_fh( *$out_fh );
+  $parser->parse_file( $in_file );
+  return $out_file;
+}
+
+
+sub _readme_htm {
+  my ($self, $in_file, $out_file, $options) = @_;
+  $out_file ||= 'README.htm';
+  require Pod::Html;
+  my ($o) = capture {
+    Pod::Html::pod2html(
+      "--infile=$in_file",
+      "--outfile=-",
+      @$options,
+    );
+  };
+  io->file($out_file)->print($o);
+  # Remove temporary files if needed
+  for my $file ('pod2htmd.tmp', 'pod2htmi.tmp') {
+    if (-e $file) {
+      unlink $file or warn "Warning: Could not remove file '$file'.\n$!\n";
+    }
+  }
+  return $out_file;
+}
+
+
+sub _readme_man {
+  my ($self, $in_file, $out_file, $options) = @_;
+  $out_file ||= 'README.1';
+  require Pod::Man;
+  my $parser = Pod::Man->new( @$options );
+  my $io = io->file($out_file)->open(">");
+  my $out_fh = $io->io_handle;
+  $parser->output_fh( *$out_fh );
+  $parser->parse_file( $in_file );
+  return $out_file;
+}
+
+
+sub _readme_pdf {
+  my ($self, $in_file, $out_file, $options) = @_;
+  $out_file ||= 'README.pdf';
+  eval { require App::pod2pdf; }
+    or die "Could not generate $out_file because pod2pdf could not be found\n";
+  my $parser = App::pod2pdf->new( @$options );
+  $parser->parse_from_file($in_file);
+  my ($o) = capture { $parser->output };
+  io->file($out_file)->print($o);
+  return $out_file;
+}
+
+sub _readme_md {
+  my ($self, $in_file, $out_file, $options) = @_;
+  $out_file ||= 'README.md';
+  require Pod::Markdown;
+  my $parser = Pod::Markdown->new( @$options );
+  my $io = io->file($out_file)->open(">");
+  my $out_fh = $io->io_handle;
+  $parser->output_fh( *$out_fh );
+  $parser->parse_file( $in_file );
+  return $out_file;
+}
+
+
+sub _all_from {
+  my $self = shift;
+  return unless $self->admin->{extensions};
+  my ($metadata) = grep {
+    ref($_) eq 'Module::Install::Metadata';
+  } @{$self->admin->{extensions}};
+  return unless $metadata;
+  return $metadata->{values}{all_from} || '';
+}
+
+'Readme!';
+
+__END__
+
+#line 316
+
diff --git a/inc/Module/Install/Win32.pm b/inc/Module/Install/Win32.pm
index dba25f9..f7aa615 100644
--- a/inc/Module/Install/Win32.pm
+++ b/inc/Module/Install/Win32.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.17';
+	$VERSION = '1.19';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }
diff --git a/inc/Module/Install/WriteAll.pm b/inc/Module/Install/WriteAll.pm
index d553bd7..2db861a 100644
--- a/inc/Module/Install/WriteAll.pm
+++ b/inc/Module/Install/WriteAll.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.17';
+	$VERSION = '1.19';
 	@ISA     = qw{Module::Install::Base};
 	$ISCORE  = 1;
 }

-----------------------------------------------------------------------

Summary of changes:
 Changes                             |   4 +
 MANIFEST                            |   1 +
 META.yml                            |   6 +-
 Makefile.PL                         |   2 +
 README                              | 121 ++++++++++--------------
 inc/Module/AutoInstall.pm           |   2 +-
 inc/Module/Install.pm               |   2 +-
 inc/Module/Install/AutoInstall.pm   |   2 +-
 inc/Module/Install/Base.pm          |   2 +-
 inc/Module/Install/Can.pm           |   2 +-
 inc/Module/Install/Fetch.pm         |   2 +-
 inc/Module/Install/Include.pm       |   2 +-
 inc/Module/Install/Makefile.pm      |   2 +-
 inc/Module/Install/Metadata.pm      |   2 +-
 inc/Module/Install/ReadmeFromPod.pm | 184 ++++++++++++++++++++++++++++++++++++
 inc/Module/Install/Win32.pm         |   2 +-
 inc/Module/Install/WriteAll.pm      |   2 +-
 lib/Date/Extract.pm                 |   5 +-
 t/02-extract.t                      |   2 +-
 t/03-returns.t                      |   2 +-
 t/05-format.t                       |   2 +-
 21 files changed, 263 insertions(+), 88 deletions(-)
 create mode 100644 inc/Module/Install/ReadmeFromPod.pm


hooks/post-receive
-- 
Date-Extract


More information about the Bps-public-commit mailing list