[Bps-public-commit] Text-Quoted branch, master, updated. 2.09
Alex Vandiver
alexmv at bestpractical.com
Fri Feb 20 12:51:12 EST 2015
The branch, master has been updated
via 9cce0e0fa8fdd80427f486c6a298e725e2346c6a (commit)
via ab48fcbd26bb964e9acd180c493fa6a63a5a2495 (commit)
via 5142ed1f931e7c3f3844d854e395ee2fe06096a0 (commit)
via da3b8da553fc72b52f20c53ec358981d6741a6b6 (commit)
via a542f690235b009c2c907262a2f96ebfb2d91f5b (commit)
via 035f39c2803b1763c321ffc7fefdfbc8a9d8dbbe (commit)
via 9986144091c7d69503bd384d8f821b3bb3479d00 (commit)
via a3318a107dc7bb0f4921abc7416fb11b35624db6 (commit)
from e966122ca7eec88b933263478fccda48c81cad28 (commit)
Summary of changes:
.gitignore | 11 +--
Changes | 118 +++++++++++++++---------------
MANIFEST | 3 +-
META.yml | 8 ++-
Makefile.PL | 11 ++-
README | 98 ++++++++++++++++++++-----
inc/Module/Install.pm | 22 +++---
inc/Module/Install/Base.pm | 2 +-
inc/Module/Install/Can.pm | 2 +-
inc/Module/Install/Fetch.pm | 2 +-
inc/Module/Install/Makefile.pm | 4 +-
inc/Module/Install/Metadata.pm | 6 +-
inc/Module/Install/ReadmeFromPod.pm | 138 ++++++++++++++++++++++++++++++++++++
inc/Module/Install/Win32.pm | 2 +-
inc/Module/Install/WriteAll.pm | 2 +-
Quoted.pm => lib/Text/Quoted.pm | 96 +++++++++++--------------
16 files changed, 355 insertions(+), 170 deletions(-)
create mode 100644 inc/Module/Install/ReadmeFromPod.pm
rename Quoted.pm => lib/Text/Quoted.pm (74%)
- Log -----------------------------------------------------------------
commit a3318a107dc7bb0f4921abc7416fb11b35624db6
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Fri Feb 20 12:28:33 2015 -0500
Move .pm file to a more standard layout
diff --git a/MANIFEST b/MANIFEST
index 5b74e35..64cc7d4 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -7,10 +7,10 @@ inc/Module/Install/Makefile.pm
inc/Module/Install/Metadata.pm
inc/Module/Install/Win32.pm
inc/Module/Install/WriteAll.pm
+lib/Text/Quoted.pm
Makefile.PL
MANIFEST This list of files
META.yml
-Quoted.pm
README
t/basics.t
t/empty_text.t
diff --git a/Makefile.PL b/Makefile.PL
index 34c0b6f..19c7ea1 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -5,7 +5,7 @@ name 'Text-Quoted';
license 'perl';
author 'Jesse Vincent <jesse at bestpractical.com>';
-all_from 'Quoted.pm';
+all_from 'lib/Text/Quoted.pm';
requires 'Text::Autoformat';
diff --git a/Quoted.pm b/lib/Text/Quoted.pm
similarity index 100%
rename from Quoted.pm
rename to lib/Text/Quoted.pm
commit 9986144091c7d69503bd384d8f821b3bb3479d00
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Fri Feb 20 12:37:14 2015 -0500
Apply standard BPS footer
diff --git a/lib/Text/Quoted.pm b/lib/Text/Quoted.pm
index 9a6967b..e8bafef 100644
--- a/lib/Text/Quoted.pm
+++ b/lib/Text/Quoted.pm
@@ -275,17 +275,16 @@ sub _expand_tabs {
Most of the heavy lifting is done by a modified version of Damian Conway's
C<Text::Autoformat>.
-=head1 COPYRIGHT
+=head1 AUTHOR
-Copyright (C) 2002-2003 Kasei Limited
-Copyright (C) 2003-2004 Simon Cozens
-Copyright (C) 2004-2013 Best Practical Solutions, LLC
+Best Practical Solutions, LLC E<lt>modules at bestpractical.comE<gt>
-This software is distributed WITHOUT ANY WARRANTY; without even the implied
-warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+=head1 LICENSE AND COPYRIGHT
-This library is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself.
+This software is Copyright (c) 2004-2015 by Best Practical Solutions, LLC
+
+This library is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
=cut
commit 035f39c2803b1763c321ffc7fefdfbc8a9d8dbbe
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Fri Feb 20 12:38:11 2015 -0500
Whitespace cleanups
diff --git a/lib/Text/Quoted.pm b/lib/Text/Quoted.pm
index e8bafef..53a6969 100644
--- a/lib/Text/Quoted.pm
+++ b/lib/Text/Quoted.pm
@@ -19,18 +19,20 @@ Text::Quoted - Extract the structure of a quoted mail message
=head1 SYNOPSIS
use Text::Quoted;
- Text::Quoted::set_quote_characters( qr/[:]/ ); # customize recognized quote characters
my $structure = extract($text);
+ # Optionally, customize recognized quote characters:
+ Text::Quoted::set_quote_characters( qr/[:]/ );
+
=head1 DESCRIPTION
C<Text::Quoted> examines the structure of some text which may contain
multiple different levels of quoting, and turns the text into a nested
-data structure.
+data structure.
The structure is an array reference containing hash references for each
-paragraph belonging to the same author. Each level of quoting recursively
-adds another list reference. So for instance, this:
+paragraph belonging to the same author. Each level of quoting
+recursively adds another list reference. So for instance, this:
> foo
> # Bar
@@ -43,8 +45,8 @@ turns into:
[
[
{ text => 'foo', quoter => '>', raw => '> foo' },
- [
- { text => 'Bar', quoter => '> #', raw => '> # Bar' }
+ [
+ { text => 'Bar', quoter => '> #', raw => '> # Bar' }
],
{ text => 'baz', quoter => '>', raw => '> baz' }
],
@@ -55,15 +57,15 @@ turns into:
This also tells you about what's in the hash references: C<raw> is the
paragraph of text as it appeared in the original input; C<text> is what
-it looked like when we stripped off the quotation characters, and C<quoter>
-is the quotation string.
+it looked like when we stripped off the quotation characters, and
+C<quoter> is the quotation string.
=head1 FUNCTIONS
=head2 extract
-Takes a single string argument which is the text to extract quote structure
-from. Returns a nested datastructure as described above.
+Takes a single string argument which is the text to extract quote
+structure from. Returns a nested datastructure as described above.
Exported by default.
@@ -99,7 +101,7 @@ sub _organize {
push @next, shift @todo while defined $todo[0]->{quoter}
and $todo[0]->{quoter} =~ /^\Q$newquoter/;
- # Find the
+ # Find the
# And pass them on to _organize()!
#print "Trying to organise the following lines over $newquoter:\n";
#print $_->{raw}."\n" for @next;
@@ -124,14 +126,14 @@ sub _organize {
sub _find_below {
my ( $top_level, @stuff ) = @_;
- # Find the prefices, shortest first.
- # And return the first one which is "below" where we are right
- # now but is a proper subset of the next line.
+ # Find the prefixes, shortest first; return the first one which is
+ # "below" where we are right now but is a proper subset of the next
+ # line.
return (
sort { length $a <=> length $b }
grep $_ && /^\Q$top_level\E./ && $stuff[0]->{quoter} =~ /^\Q$_\E/,
map $_->{quoter},
- @stuff
+ @stuff
)[0];
}
@@ -139,15 +141,15 @@ sub _find_below {
=head2 set_quote_characters
-Takes a regex (C<qr//>) matching characters that should indicate a quoted line.
-By default, a very liberal set is used:
+Takes a regex (C<qr//>) matching characters that should indicate a
+quoted line. By default, a very liberal set is used:
set_quote_characters(qr/[!#%=|:]/);
The character C<< E<gt> >> is always recognized as a quoting character.
-If C<undef> is provided instead of a regex, only C<< E<gt> >> will remain as a
-quote character.
+If C<undef> is provided instead of a regex, only C<< E<gt> >> will
+remain as a quote character.
Not exported by default, but exportable.
@@ -232,7 +234,7 @@ sub _classify {
{
push @paras, $line;
$first = 0;
- # We get warnings from undefined raw and text values if we don't supply alternates
+ # We get warnings from undefined raw and text values if we don't supply alternates
$firstfrom = length( $line->{raw} ||'' ) - length( $line->{text} || '');
}
else {
@@ -272,8 +274,8 @@ sub _expand_tabs {
=head1 CREDITS
-Most of the heavy lifting is done by a modified version of Damian Conway's
-C<Text::Autoformat>.
+Most of the heavy lifting is done by a modified version of Damian
+Conway's C<Text::Autoformat>.
=head1 AUTHOR
commit a542f690235b009c2c907262a2f96ebfb2d91f5b
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Fri Feb 20 12:38:38 2015 -0500
Remove commented-out debugging lines
diff --git a/lib/Text/Quoted.pm b/lib/Text/Quoted.pm
index 53a6969..61bde23 100644
--- a/lib/Text/Quoted.pm
+++ b/lib/Text/Quoted.pm
@@ -101,13 +101,9 @@ sub _organize {
push @next, shift @todo while defined $todo[0]->{quoter}
and $todo[0]->{quoter} =~ /^\Q$newquoter/;
- # Find the
# And pass them on to _organize()!
- #print "Trying to organise the following lines over $newquoter:\n";
- #print $_->{raw}."\n" for @next;
- #print "!-!-!-\n";
push @ret, _organize( $newquoter, @next );
- } # else { die "bugger! I had $top_level, but now I have $line->{raw}\n"; }
+ }
}
return \@ret;
}
commit da3b8da553fc72b52f20c53ec358981d6741a6b6
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Fri Feb 20 12:42:01 2015 -0500
Packaging updates
diff --git a/.gitignore b/.gitignore
index c9502c6..c17e390 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
-Makefile
-Makefile.old
-pm_to_blib
-blib/
-MANIFEST.old
+/Makefile
+/Makefile.old
+/pm_to_blib
+/blib/
+/MANIFEST.old
+/MYMETA.*
\ No newline at end of file
diff --git a/Changes b/Changes
index 66582e7..b666b83 100644
--- a/Changes
+++ b/Changes
@@ -1,63 +1,59 @@
Revision history for Perl extension Text::Quoted.
-2.08 Tue May 21 11:40:04 PDT 2013
- - add a combine_hunks function to recombine hunks (RJBS)
- - implicitly private methods are now underscore private: organize,
- find_below, classify, expand_tabs (RJBS)
-
-2.07 Thu May 16 18:18:01 PDT 2013
- - Add set_quote_characters() function to control what additional characters
- are treated as quoting chars (above and beyond ">")
-
-2.06 Mon Mar 15 2010
- - make extracting more effective
- - line with only '=' characters is not treated as quoter
- anymore, but separator
- - mark separating lines with "separator => 1" hash entry
- - don't return "empty => ''" hash key
- - update tests
-
-2.05 Wed Jan 24 2008
- - fix tests failure under perl 5.6.x,
- thanks to David Cantrell for cpan testing it
-
-2.04 Wed Jan 23 2008
- - use own expand_tabs instead of Text::Tabs
- - avoid segfaults when pos() is used inside of regexp
-
-2.03 Wed Nov 7 2007
- - delete a lot of unused code
- - many micro optimisations
- - performance improvements, up to 1.5x in total
- - clanups of Makefile, README
-
-2.02 Wed Feb 20 2007
- - fix a missing test in MANIFEST
-
-2.01 Wed Feb 20 2007
- - fix a problem with $VERSION
-
-1.10 Tue Feb 13 2007
- - fix a bug where lines are hidden when the quote character
- changes midstream. Reported by Dirk Pape and Sven Sternberger
-
-1.9 Fri Jun 24 15:34:46 EDT 2005
- - Manifest cleanup. From Mike Castle
-
-1.8 Thu Jul 1 23:21:14 EDT 2004
- - Fix handling for the case where we we're quoting
- a false but defined string. From Stephen Quinney.
-
-1.7 Wed Jun 16 16:54:57 EDT 2004
-
- - New maintainer learns to remove his debugging output
-
-1.6 Wed Jun 16 13:36:00 EDT 2004
-
- - New maintainer
- - Better handle attempts to quote an empty or undef string
-
-1.0 Tue Dec 3 15:01:07 2002
- - original version; created by h2xs 1.22 with options
- -AX -n Text::Quoted
-
+2.08 2013-05-21
+ - add a combine_hunks function to recombine hunks (RJBS)
+ - implicitly private methods are now underscore private: organize,
+ find_below, classify, expand_tabs (RJBS)
+
+2.07 2013-05-16
+ - Add set_quote_characters() function to control what additional
+ characters are treated as quoting chars (above and beyond ">")
+
+2.06 2010-03-15
+ - make extracting more effective
+ - line with only '=' characters is not treated as quoter anymore, but
+ separator
+ - mark separating lines with "separator => 1" hash entry
+ - don't return "empty => ''" hash key
+ - update tests
+
+2.05 2008-01-24
+ - fix tests failure under perl 5.6.x, thanks to David Cantrell for cpan
+ testing it
+
+2.04 2008-01-23
+ - use own expand_tabs instead of Text::Tabs
+ - avoid segfaults when pos() is used inside of regexp
+
+2.03 2007-11-07
+ - delete a lot of unused code
+ - many micro optimisations
+ - performance improvements, up to 1.5x in total
+ - clanups of Makefile, README
+
+2.02 2007-02-20
+ - fix a missing test in MANIFEST
+
+2.01 2007-02-20
+ - fix a problem with $VERSION
+
+1.10 2007-02-13
+ - fix a bug where lines are hidden when the quote character changes
+ midstream. Reported by Dirk Pape and Sven Sternberger
+
+1.9 2005-06-24
+ - Manifest cleanup. From Mike Castle
+
+1.8 2004-07-01
+ - Fix handling for the case where we we're quoting a false but defined
+ string. From Stephen Quinney.
+
+1.7 2004-06-16
+ - New maintainer learns to remove his debugging output
+
+1.6 2004-06-16
+ - New maintainer
+ - Better handle attempts to quote an empty or undef string
+
+1.0 2002-12-03
+ - original version; created by h2xs 1.22 with options -AX -n Text::Quoted
diff --git a/MANIFEST b/MANIFEST
index 64cc7d4..b8742ba 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -5,6 +5,7 @@ inc/Module/Install/Can.pm
inc/Module/Install/Fetch.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/Text/Quoted.pm
diff --git a/META.yml b/META.yml
index 41891d1..327e757 100644
--- a/META.yml
+++ b/META.yml
@@ -1,18 +1,19 @@
---
abstract: 'Extract the structure of a quoted mail message'
author:
- - 'Jesse Vincent <jesse at bestpractical.com>'
+ - 'Best Practical Solutions, LLC <modules at bestpractical.com>'
build_requires:
ExtUtils::MakeMaker: 6.59
configure_requires:
ExtUtils::MakeMaker: 6.59
distribution_type: module
dynamic_config: 1
-generated_by: 'Module::Install version 1.06'
+generated_by: 'Module::Install version 1.14'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: 1.4
+module_name: Text::Quoted
name: Text-Quoted
no_index:
directory:
@@ -23,4 +24,4 @@ requires:
perl: 5.6.0
resources:
license: http://dev.perl.org/licenses/
-version: 2.08
+version: '2.08'
diff --git a/Makefile.PL b/Makefile.PL
index 19c7ea1..bcb9d40 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -1,12 +1,10 @@
use 5.006;
use inc::Module::Install;
-name 'Text-Quoted';
-license 'perl';
-author 'Jesse Vincent <jesse at bestpractical.com>';
+all_from 'lib/Text/Quoted.pm';
+readme_from 'lib/Text/Quoted.pm';
-all_from 'lib/Text/Quoted.pm';
-
-requires 'Text::Autoformat';
+requires 'Text::Autoformat';
+sign;
WriteAll;
diff --git a/README b/README
index 306acf7..45be783 100644
--- a/README
+++ b/README
@@ -1,26 +1,86 @@
-Text::Quoted
-========================
+NAME
+ Text::Quoted - Extract the structure of a quoted mail message
-The README is used to introduce the module and provide instructions on
-how to install the module, any machine dependencies it may have (for
-example C compilers and installed libraries) and any other information
-that should be provided before the module is installed.
+SYNOPSIS
+ use Text::Quoted;
+ my $structure = extract($text);
-A README file is required for CPAN modules since CPAN extracts the
-README file from a module distribution so that people browsing the
-archive can use it get an idea of the modules uses. It is usually a
-good idea to provide version information here so that people can
-decide whether fixes for the module are worth downloading.
+ # Optionally, customize recognized quote characters:
+ Text::Quoted::set_quote_characters( qr/[:]/ );
-INSTALLATION
+DESCRIPTION
+ "Text::Quoted" examines the structure of some text which may contain
+ multiple different levels of quoting, and turns the text into a nested
+ data structure.
-To install this module type the following:
+ The structure is an array reference containing hash references for each
+ paragraph belonging to the same author. Each level of quoting
+ recursively adds another list reference. So for instance, this:
- perl Makefile.PL
- make
- make test
- make install
+ > foo
+ > # Bar
+ > baz
-SEE ALSO
+ quux
+
+ turns into:
+
+ [
+ [
+ { text => 'foo', quoter => '>', raw => '> foo' },
+ [
+ { text => 'Bar', quoter => '> #', raw => '> # Bar' }
+ ],
+ { text => 'baz', quoter => '>', raw => '> baz' }
+ ],
+
+ { empty => 1 },
+ { text => 'quux', quoter => '', raw => 'quux' }
+ ];
+
+ This also tells you about what's in the hash references: "raw" is the
+ paragraph of text as it appeared in the original input; "text" is what
+ it looked like when we stripped off the quotation characters, and
+ "quoter" is the quotation string.
+
+FUNCTIONS
+ extract
+ Takes a single string argument which is the text to extract quote
+ structure from. Returns a nested datastructure as described above.
+
+ Exported by default.
+
+ set_quote_characters
+ Takes a regex ("qr//") matching characters that should indicate a quoted
+ line. By default, a very liberal set is used:
+
+ set_quote_characters(qr/[!#%=|:]/);
+
+ The character ">" is always recognized as a quoting character.
+
+ If "undef" is provided instead of a regex, only ">" will remain as a
+ quote character.
+
+ Not exported by default, but exportable.
+
+ combine_hunks
+ my $text = combine_hunks( $arrayref_of_hunks );
+
+ Takes the output of "extract" and turns it back into text.
+
+ Not exported by default, but exportable.
+
+CREDITS
+ Most of the heavy lifting is done by a modified version of Damian
+ Conway's "Text::Autoformat".
+
+AUTHOR
+ Best Practical Solutions, LLC <modules at bestpractical.com>
+
+LICENSE AND COPYRIGHT
+ This software is Copyright (c) 2004-2015 by Best Practical Solutions,
+ LLC
+
+ This library is free software; you can redistribute it and/or modify it
+ under the same terms as Perl itself.
-`perldoc Text::Quoted`
diff --git a/inc/Module/Install.pm b/inc/Module/Install.pm
index 4ecf46b..ff767fa 100644
--- a/inc/Module/Install.pm
+++ b/inc/Module/Install.pm
@@ -17,7 +17,7 @@ package Module::Install;
# 3. The ./inc/ version of Module::Install loads
# }
-use 5.005;
+use 5.006;
use strict 'vars';
use Cwd ();
use File::Find ();
@@ -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.06';
+ $VERSION = '1.14';
# Storage for the pseudo-singleton
$MAIN = undef;
@@ -156,10 +156,10 @@ END_DIE
sub autoload {
my $self = shift;
my $who = $self->_caller;
- my $cwd = Cwd::cwd();
+ my $cwd = Cwd::getcwd();
my $sym = "${who}::AUTOLOAD";
$sym->{$cwd} = sub {
- my $pwd = Cwd::cwd();
+ my $pwd = Cwd::getcwd();
if ( my $code = $sym->{$pwd} ) {
# Delegate back to parent dirs
goto &$code unless $cwd eq $pwd;
@@ -239,7 +239,7 @@ sub new {
# ignore the prefix on extension modules built from top level.
my $base_path = Cwd::abs_path($FindBin::Bin);
- unless ( Cwd::abs_path(Cwd::cwd()) eq $base_path ) {
+ unless ( Cwd::abs_path(Cwd::getcwd()) eq $base_path ) {
delete $args{prefix};
}
return $args{_self} if $args{_self};
@@ -338,7 +338,7 @@ sub find_extensions {
if ( $subpath eq lc($subpath) || $subpath eq uc($subpath) ) {
my $content = Module::Install::_read($subpath . '.pm');
my $in_pod = 0;
- foreach ( split //, $content ) {
+ foreach ( split /\n/, $content ) {
$in_pod = 1 if /^=\w/;
$in_pod = 0 if /^=cut/;
next if ($in_pod || /^=cut/); # skip pod text
@@ -378,6 +378,7 @@ eval( $] >= 5.006 ? <<'END_NEW' : <<'END_OLD' ); die $@ if $@;
sub _read {
local *FH;
open( FH, '<', $_[0] ) or die "open($_[0]): $!";
+ binmode FH;
my $string = do { local $/; <FH> };
close FH or die "close($_[0]): $!";
return $string;
@@ -386,6 +387,7 @@ END_NEW
sub _read {
local *FH;
open( FH, "< $_[0]" ) or die "open($_[0]): $!";
+ binmode FH;
my $string = do { local $/; <FH> };
close FH or die "close($_[0]): $!";
return $string;
@@ -416,6 +418,7 @@ eval( $] >= 5.006 ? <<'END_NEW' : <<'END_OLD' ); die $@ if $@;
sub _write {
local *FH;
open( FH, '>', $_[0] ) or die "open($_[0]): $!";
+ binmode FH;
foreach ( 1 .. $#_ ) {
print FH $_[$_] or die "print($_[0]): $!";
}
@@ -425,6 +428,7 @@ END_NEW
sub _write {
local *FH;
open( FH, "> $_[0]" ) or die "open($_[0]): $!";
+ binmode FH;
foreach ( 1 .. $#_ ) {
print FH $_[$_] or die "print($_[0]): $!";
}
@@ -434,7 +438,7 @@ END_OLD
# _version is for processing module versions (eg, 1.03_05) not
# Perl versions (eg, 5.8.1).
-sub _version ($) {
+sub _version {
my $s = shift || 0;
my $d =()= $s =~ /(\.)/g;
if ( $d >= 2 ) {
@@ -450,12 +454,12 @@ sub _version ($) {
return $l + 0;
}
-sub _cmp ($$) {
+sub _cmp {
_version($_[1]) <=> _version($_[2]);
}
# Cloned from Params::Util::_CLASS
-sub _CLASS ($) {
+sub _CLASS {
(
defined $_[0]
and
diff --git a/inc/Module/Install/Base.pm b/inc/Module/Install/Base.pm
index 802844a..4206347 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.06';
+ $VERSION = '1.14';
}
# Suspend handler for "redefined" warnings
diff --git a/inc/Module/Install/Can.pm b/inc/Module/Install/Can.pm
index 22167b8..9929b1b 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.06';
+ $VERSION = '1.14';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
diff --git a/inc/Module/Install/Fetch.pm b/inc/Module/Install/Fetch.pm
index bee0c4f..3d8de76 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.06';
+ $VERSION = '1.14';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
diff --git a/inc/Module/Install/Makefile.pm b/inc/Module/Install/Makefile.pm
index 7052f36..66993af 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.06';
+ $VERSION = '1.14';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
@@ -133,7 +133,7 @@ sub makemaker_args {
return $args;
}
-# For mm args that take multiple space-seperated args,
+# For mm args that take multiple space-separated args,
# append an argument to the current list.
sub makemaker_append {
my $self = shift;
diff --git a/inc/Module/Install/Metadata.pm b/inc/Module/Install/Metadata.pm
index 58430f3..e547fa0 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.06';
+ $VERSION = '1.14';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
@@ -347,7 +347,7 @@ sub name_from {
^ \s*
package \s*
([\w:]+)
- \s* ;
+ [\s|;]*
/ixms
) {
my ($name, $module_name) = ($1, $1);
@@ -705,7 +705,7 @@ sub _write_mymeta_data {
my @yaml = Parse::CPAN::Meta::LoadFile('META.yml');
my $meta = $yaml[0];
- # Overwrite the non-configure dependency hashs
+ # Overwrite the non-configure dependency hashes
delete $meta->{requires};
delete $meta->{build_requires};
delete $meta->{recommends};
diff --git a/inc/Module/Install/ReadmeFromPod.pm b/inc/Module/Install/ReadmeFromPod.pm
new file mode 100644
index 0000000..b5e03c3
--- /dev/null
+++ b/inc/Module/Install/ReadmeFromPod.pm
@@ -0,0 +1,138 @@
+#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.22';
+
+sub readme_from {
+ my $self = shift;
+ return unless $self->is_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 '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 );
+ open my $out_fh, '>', $out_file or die "Could not write file $out_file:\n$!\n";
+ $parser->output_fh( *$out_fh );
+ $parser->parse_file( $in_file );
+ close $out_fh;
+ return $out_file;
+}
+
+
+sub _readme_htm {
+ my ($self, $in_file, $out_file, $options) = @_;
+ $out_file ||= 'README.htm';
+ require Pod::Html;
+ Pod::Html::pod2html(
+ "--infile=$in_file",
+ "--outfile=$out_file",
+ @$options,
+ );
+ # 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 );
+ $parser->parse_from_file($in_file, $out_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);
+ open my $out_fh, '>', $out_file or die "Could not write file $out_file:\n$!\n";
+ select $out_fh;
+ $parser->output;
+ select STDOUT;
+ close $out_fh;
+ 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 254
+
diff --git a/inc/Module/Install/Win32.pm b/inc/Module/Install/Win32.pm
index eeaa3fe..9706e5f 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.06';
+ $VERSION = '1.14';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
diff --git a/inc/Module/Install/WriteAll.pm b/inc/Module/Install/WriteAll.pm
index 85d8018..dbedc00 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.06';
+ $VERSION = '1.14';
@ISA = qw{Module::Install::Base};
$ISCORE = 1;
}
commit 5142ed1f931e7c3f3844d854e395ee2fe06096a0
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Fri Feb 20 12:45:51 2015 -0500
Compatibility with Text::Autoformat >= 1.69
diff --git a/lib/Text/Quoted.pm b/lib/Text/Quoted.pm
index 61bde23..0e338bf 100644
--- a/lib/Text/Quoted.pm
+++ b/lib/Text/Quoted.pm
@@ -10,7 +10,10 @@ our @ISA = qw(Exporter);
our @EXPORT = qw(extract);
our @EXPORT_OK = qw(set_quote_characters combine_hunks);
-use Text::Autoformat(); # Provides the Hang package, heh, heh.
+# Provides either the 'Hang' package -- or, on since version 1.69 of
+# Text::Autoformat, the 'Text::Autoformat::Hang' package.
+use Text::Autoformat();
+my $hang_package = Hang->can('new') ? "Hang" : "Text::Autoformat::Hang";
=head1 NAME
@@ -194,7 +197,7 @@ sub _classify {
foreach (splice @lines) {
my %line = ( raw => $_ );
@line{'quoter', 'text'} = (/\A *($quoter?) *(.*?)\s*\Z/);
- $line{hang} = Hang->new( $line{'text'} );
+ $line{hang} = $hang_package->new( $line{'text'} );
$line{empty} = 1 if $line{hang}->empty() && $line{'text'} !~ /\S/;
$line{separator} = 1 if $line{text} =~ /\A *$separator *\Z/o;
push @lines, \%line;
commit ab48fcbd26bb964e9acd180c493fa6a63a5a2495
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Fri Feb 20 12:48:18 2015 -0500
Switch back to using Text::Tabs, as it no longer segfaults perl
diff --git a/META.yml b/META.yml
index 327e757..54b7223 100644
--- a/META.yml
+++ b/META.yml
@@ -21,6 +21,7 @@ no_index:
- t
requires:
Text::Autoformat: 0
+ Text::Tabs: 0
perl: 5.6.0
resources:
license: http://dev.perl.org/licenses/
diff --git a/Makefile.PL b/Makefile.PL
index bcb9d40..8d78582 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -5,6 +5,7 @@ all_from 'lib/Text/Quoted.pm';
readme_from 'lib/Text/Quoted.pm';
requires 'Text::Autoformat';
+requires 'Text::Tabs';
sign;
WriteAll;
diff --git a/lib/Text/Quoted.pm b/lib/Text/Quoted.pm
index 0e338bf..635c88e 100644
--- a/lib/Text/Quoted.pm
+++ b/lib/Text/Quoted.pm
@@ -15,6 +15,8 @@ our @EXPORT_OK = qw(set_quote_characters combine_hunks);
use Text::Autoformat();
my $hang_package = Hang->can('new') ? "Hang" : "Text::Autoformat::Hang";
+use Text::Tabs();
+
=head1 NAME
Text::Quoted - Extract the structure of a quoted mail message
@@ -191,7 +193,7 @@ sub _classify {
# If the user passes in a null string, we really want to end up with _something_
# DETABIFY
- my @lines = _expand_tabs( split /\n/, $text );
+ my @lines = Text::Tabs::expand( split /\n/, $text );
# PARSE EACH LINE
foreach (splice @lines) {
@@ -253,24 +255,6 @@ sub _classify {
return @paras;
}
-# we don't use Text::Tabs anymore as it may segfault on perl 5.8.x with
-# UTF-8 strings and tabs mixed. http://rt.perl.org/rt3/Public/Bug/Display.html?id=40989
-# This bug unlikely to be fixed in 5.8.x, however we use workaround.
-# As soon as Text::Tabs will be fixed we can return back to it
-my $tabstop = 8;
-sub _expand_tabs {
- my $pad;
- for ( @_ ) {
- my $offs = 0;
- s{(.*?)\t}{
- $pad = $tabstop - (length($1) + $offs) % $tabstop;
- $offs += length($1)+$pad;
- $1 . (" " x $pad);
- }eg;
- }
- return @_;
-}
-
=head1 CREDITS
Most of the heavy lifting is done by a modified version of Damian
commit 9cce0e0fa8fdd80427f486c6a298e725e2346c6a
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Fri Feb 20 12:49:33 2015 -0500
Version bump to 2.09
diff --git a/META.yml b/META.yml
index 54b7223..fe05ba4 100644
--- a/META.yml
+++ b/META.yml
@@ -25,4 +25,4 @@ requires:
perl: 5.6.0
resources:
license: http://dev.perl.org/licenses/
-version: '2.08'
+version: '2.09'
diff --git a/lib/Text/Quoted.pm b/lib/Text/Quoted.pm
index 635c88e..317929b 100644
--- a/lib/Text/Quoted.pm
+++ b/lib/Text/Quoted.pm
@@ -1,5 +1,5 @@
package Text::Quoted;
-our $VERSION = "2.08";
+our $VERSION = "2.09";
use 5.006;
use strict;
use warnings;
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list