r9095 - in /branches/upstream/libtext-quoted-perl/current: ./ inc/Module/ inc/Module/Install/

gregoa-guest at users.alioth.debian.org gregoa-guest at users.alioth.debian.org
Fri Nov 9 16:50:19 UTC 2007


Author: gregoa-guest
Date: Fri Nov  9 16:50:19 2007
New Revision: 9095

URL: http://svn.debian.org/wsvn/?sc=1&rev=9095
Log:
[svn-upgrade] Integrating new upstream version, libtext-quoted-perl (2.03)

Added:
    branches/upstream/libtext-quoted-perl/current/inc/Module/Install/Can.pm
    branches/upstream/libtext-quoted-perl/current/inc/Module/Install/Fetch.pm
    branches/upstream/libtext-quoted-perl/current/inc/Module/Install/Win32.pm
    branches/upstream/libtext-quoted-perl/current/inc/Module/Install/WriteAll.pm
Removed:
    branches/upstream/libtext-quoted-perl/current/inc/Module/Install/MakeMaker.pm
Modified:
    branches/upstream/libtext-quoted-perl/current/Changes
    branches/upstream/libtext-quoted-perl/current/MANIFEST
    branches/upstream/libtext-quoted-perl/current/META.yml
    branches/upstream/libtext-quoted-perl/current/Makefile.PL
    branches/upstream/libtext-quoted-perl/current/Quoted.pm
    branches/upstream/libtext-quoted-perl/current/README
    branches/upstream/libtext-quoted-perl/current/inc/Module/Install.pm
    branches/upstream/libtext-quoted-perl/current/inc/Module/Install/Base.pm
    branches/upstream/libtext-quoted-perl/current/inc/Module/Install/Makefile.pm
    branches/upstream/libtext-quoted-perl/current/inc/Module/Install/Metadata.pm

Modified: branches/upstream/libtext-quoted-perl/current/Changes
URL: http://svn.debian.org/wsvn/branches/upstream/libtext-quoted-perl/current/Changes?rev=9095&op=diff
==============================================================================
--- branches/upstream/libtext-quoted-perl/current/Changes (original)
+++ branches/upstream/libtext-quoted-perl/current/Changes Fri Nov  9 16:50:19 2007
@@ -1,4 +1,10 @@
 Revision history for Perl extension Text::Quoted.
+
+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

Modified: branches/upstream/libtext-quoted-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/branches/upstream/libtext-quoted-perl/current/MANIFEST?rev=9095&op=diff
==============================================================================
--- branches/upstream/libtext-quoted-perl/current/MANIFEST (original)
+++ branches/upstream/libtext-quoted-perl/current/MANIFEST Fri Nov  9 16:50:19 2007
@@ -1,9 +1,12 @@
 Changes
 inc/Module/Install.pm
 inc/Module/Install/Base.pm
+inc/Module/Install/Can.pm
+inc/Module/Install/Fetch.pm
 inc/Module/Install/Makefile.pm
-inc/Module/Install/MakeMaker.pm
 inc/Module/Install/Metadata.pm
+inc/Module/Install/Win32.pm
+inc/Module/Install/WriteAll.pm
 Makefile.PL
 MANIFEST			This list of files
 META.yml

Modified: branches/upstream/libtext-quoted-perl/current/META.yml
URL: http://svn.debian.org/wsvn/branches/upstream/libtext-quoted-perl/current/META.yml?rev=9095&op=diff
==============================================================================
--- branches/upstream/libtext-quoted-perl/current/META.yml (original)
+++ branches/upstream/libtext-quoted-perl/current/META.yml Fri Nov  9 16:50:19 2007
@@ -1,8 +1,13 @@
-author: Jesse Vincent <jesse at bestpractical.com>
+--- 
+abstract: Extract the structure of a quoted mail message
+author: 
+  - Jesse Vincent <jesse at bestpractical.com>
 distribution_type: module
-generated_by: Module::Install version 0.64
+generated_by: Module::Install version 0.68
 license: perl
-module_name: Text::Quoted
+meta-spec: 
+  url: http://module-build.sourceforge.net/META-spec-v1.3.html
+  version: 1.3
 name: Text-Quoted
 no_index: 
   directory: 
@@ -11,4 +16,5 @@
 requires: 
   Text::Autoformat: 0
   Text::Tabs: 0
-version: 2.02
+  perl: 5.6.0
+version: 2.03

Modified: branches/upstream/libtext-quoted-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/branches/upstream/libtext-quoted-perl/current/Makefile.PL?rev=9095&op=diff
==============================================================================
--- branches/upstream/libtext-quoted-perl/current/Makefile.PL (original)
+++ branches/upstream/libtext-quoted-perl/current/Makefile.PL Fri Nov  9 16:50:19 2007
@@ -1,13 +1,13 @@
 use 5.006;
-use  inc::Module::Install;
-license('perl');
-WriteMakefile(
-    'NAME'		=> 'Text::Quoted',
-    'VERSION_FROM'	=> 'Quoted.pm', # finds $VERSION
-    'PREREQ_PM'		=> {
-        Text::Autoformat => 0,
-	Text::Tabs => 0
-    }, # e.g., Module::Name => 1.1
-      ABSTRACT_FROM => 'Quoted.pm', # retrieve abstract from module
-       AUTHOR     => 'Jesse Vincent <jesse at bestpractical.com>'
-);
+use inc::Module::Install;
+
+name        'Text-Quoted';
+license     'perl';
+author       'Jesse Vincent <jesse at bestpractical.com>';
+
+all_from    'Quoted.pm';
+
+requires    'Text::Autoformat';
+requires    'Text::Tabs';
+
+WriteAll;

Modified: branches/upstream/libtext-quoted-perl/current/Quoted.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libtext-quoted-perl/current/Quoted.pm?rev=9095&op=diff
==============================================================================
--- branches/upstream/libtext-quoted-perl/current/Quoted.pm (original)
+++ branches/upstream/libtext-quoted-perl/current/Quoted.pm Fri Nov  9 16:50:19 2007
@@ -1,5 +1,5 @@
 package Text::Quoted;
-our $VERSION = "2.02";
+our $VERSION = "2.03";
 use 5.006;
 use strict;
 use warnings;
@@ -10,6 +10,7 @@
 our @EXPORT = qw(extract);
 
 use Text::Autoformat();    # Provides the Hang package, heh, heh.
+use Text::Tabs();
 
 =head1 NAME
 
@@ -59,14 +60,14 @@
 =cut
 
 sub extract {
-    my $text  = shift;
-    my @paras = classify($text);
-    my @needed;
-    for my $p (@paras) {
-        push @needed, { map { $_ => $p->{$_} } qw(raw empty text quoter) };
-    }
-
-    return organize( "", @needed );
+    return organize( "",
+        map +{
+            raw    => $_->{'raw'},
+            empty  => $_->{'empty'},
+            text   => $_->{'text'},
+            quoter => $_->{'quoter'},
+        }, classify( @_ )
+    );
 }
 
 =head1 CREDITS
@@ -91,20 +92,22 @@
 sub organize {
     my $top_level = shift;
     my @todo      = @_;
+    $top_level = '' unless defined $top_level;
+
     my @ret;
 
     # Recursively form a data structure which reflects the quoting
     # structure of the list.
-    while (@todo) {
-        my $line = shift @todo;
-        if ( defn( $line->{quoter} ) eq defn($top_level) ) {
+    while (my $line = shift @todo) {
+        my $q = defined $line->{quoter}? $line->{quoter}: '';
+        if ( $q eq $top_level ) {
 
             # Just append lines at "my" level.
             push @ret, $line
               if exists $line->{quoter}
               or exists $line->{empty};
         }
-        elsif ( defn( $line->{quoter} ) =~ /^\Q$top_level\E.+/ ) {
+        elsif ( $q =~ /^\Q$top_level\E./ ) {
 
             # Find all the lines at a quoting level "below" me.
             my $newquoter = find_below( $top_level, $line, @todo );
@@ -137,28 +140,15 @@
 sub find_below {
     my ( $top_level, @stuff ) = @_;
 
-    #print "## Looking for the next level of quoting after $top_level\n";
-    #print "## We have:\n";
-    #print "## $_->{raw}\n" for @stuff;
-
-    my @prefices = sort { length $a <=> length $b } map { $_->{quoter} } @stuff;
-
     # Find the prefices, shortest first.
-
-    # return $prefices[0] if $prefices[0] eq $prefices[-1];
-
-    for (@prefices) {
-
-        # And return the first one which is "below" where we are right
-        # now but is a proper subset of the next line. 
-        next unless $_;
-        if ( $_ =~ /^\Q$top_level\E.+/ and $stuff[0]->{quoter} =~ /^\Q$_\E/ ) {
-
-            #print "## We decided on $_\n";
-            return $_;
-        }
-    }
-    die "Can't happen";
+    # And 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 
+    )[0];
 }
 
 # Everything below this point is essentially Text::Autoformat.
@@ -179,28 +169,18 @@
     # If the user passes in a null string, we really want to end up with _something_
 
     # DETABIFY
-    my @rawlines = split /\n/, $text;
-    use Text::Tabs;
-    @rawlines = expand(@rawlines);
+    my @lines = Text::Tabs::expand( split /\n/, $text );
 
 
     # PARSE EACH LINE
 
-    my $pre = 0;
-    my @lines;
-    foreach (@rawlines) {
-        push @lines, { raw => $_};
-        s/\A([ \t]*)($quoter?)([ \t]*)//;
-        $lines[-1]{presig} = $lines[-1]{prespace} = defn $1;
-        $lines[-1]{presig} .= $lines[-1]{quoter}     = defn $2;
-        $lines[-1]{presig} .= $lines[-1]{quotespace} = defn $3;
-        $lines[-1]{hang} = defn( Hang->new($_) );
-
-        s/([ \t]*)(.*?)(\s*)$//;
-        $lines[-1]{hangspace} = defn $1;
-        $lines[-1]{text}      = defn $2;
-        $lines[-1]{empty}     = $lines[-1]{hang}->empty() && $2 !~ /\S/;
-        $lines[-1]{separator} = $lines[-1]{text} =~ /^$separator$/;
+    foreach (splice @lines) {
+        my %line = ( raw => $_ );
+        @line{'quoter', 'text'} = (/\A *($quoter?) *(.*?)\s*\Z/o);
+        $line{hang}      = Hang->new( $line{'text'} );
+        $line{empty}     = $line{hang}->empty() && $line{'text'} !~ /\S/;
+        $line{separator} = $line{text} =~ /^$separator$/o;
+        push @lines, \%line;
     }
 
     # SUBDIVIDE DOCUMENT INTO COHERENT SUBSECTIONS
@@ -211,7 +191,7 @@
         if ( $line->{separator}
             || $line->{quoter} ne $chunks[-1][-1]->{quoter}
             || $line->{empty}
-            || @chunks && $chunks[-1][-1]->{empty} )
+            || $chunks[-1][-1]->{empty} )
         {
             push @chunks, [$line];
         }
@@ -245,33 +225,12 @@
         }
     }
 
-    my $remainder = "";
-
-    # ALIGN QUOTERS
-    # DETERMINE HANGING MARKER TYPE (BULLET, ALPHA, ROMAN, ETC.)
-
-    my %sigs;
-    my $lastquoted   = 0;
-    my $lastprespace = 0;
-    for my $i ( 0 .. $#paras ) {
-        my $para = $paras[$i];
-        if ( $para->{quoter} ) {
-            if ($lastquoted) { $para->{prespace} = $lastprespace }
-            else { $lastquoted = 1; $lastprespace = $para->{prespace} }
-        }
-        else {
-            $lastquoted = 0;
-        }
-    }
-
     # Reapply hangs
-    for (@paras) {
-        next unless my $hang = $_->{hang};
-        next unless $hang->stringify;
-        $_->{text} = $hang->stringify . " " . $_->{text};
+    for (grep $_->{hang}, @paras) {
+        next unless my $str = $_->{hang}->stringify;
+        $_->{text} = $str . " " . $_->{text};
     }
     return @paras;
 }
 
-sub val { return "" }
 1;

Modified: branches/upstream/libtext-quoted-perl/current/README
URL: http://svn.debian.org/wsvn/branches/upstream/libtext-quoted-perl/current/README?rev=9095&op=diff
==============================================================================
--- branches/upstream/libtext-quoted-perl/current/README (original)
+++ branches/upstream/libtext-quoted-perl/current/README Fri Nov  9 16:50:19 2007
@@ -1,4 +1,4 @@
-Text/Quoted version 0.01
+Text::Quoted
 ========================
 
 The README is used to introduce the module and provide instructions on
@@ -21,17 +21,6 @@
    make test
    make install
 
-DEPENDENCIES
+SEE ALSO
 
-This module requires these other modules and libraries:
-
-	Text::AutoFormat
-
-COPYRIGHT AND LICENCE
-
-
-Copyright (C) 2002 Simon Cozens
-
-This library is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself. 
-
+`perldoc Text::Quoted`

Modified: branches/upstream/libtext-quoted-perl/current/inc/Module/Install.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libtext-quoted-perl/current/inc/Module/Install.pm?rev=9095&op=diff
==============================================================================
--- branches/upstream/libtext-quoted-perl/current/inc/Module/Install.pm (original)
+++ branches/upstream/libtext-quoted-perl/current/inc/Module/Install.pm Fri Nov  9 16:50:19 2007
@@ -28,7 +28,7 @@
     # 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 = '0.64';
+    $VERSION = '0.68';
 }
 
 # Whether or not inc::Module::Install is actually loaded, the

Modified: branches/upstream/libtext-quoted-perl/current/inc/Module/Install/Base.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libtext-quoted-perl/current/inc/Module/Install/Base.pm?rev=9095&op=diff
==============================================================================
--- branches/upstream/libtext-quoted-perl/current/inc/Module/Install/Base.pm (original)
+++ branches/upstream/libtext-quoted-perl/current/inc/Module/Install/Base.pm Fri Nov  9 16:50:19 2007
@@ -1,7 +1,7 @@
 #line 1
 package Module::Install::Base;
 
-$VERSION = '0.64';
+$VERSION = '0.68';
 
 # Suspend handler for "redefined" warnings
 BEGIN {

Added: branches/upstream/libtext-quoted-perl/current/inc/Module/Install/Can.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libtext-quoted-perl/current/inc/Module/Install/Can.pm?rev=9095&op=file
==============================================================================
--- branches/upstream/libtext-quoted-perl/current/inc/Module/Install/Can.pm (added)
+++ branches/upstream/libtext-quoted-perl/current/inc/Module/Install/Can.pm Fri Nov  9 16:50:19 2007
@@ -1,0 +1,82 @@
+#line 1
+package Module::Install::Can;
+
+use strict;
+use Module::Install::Base;
+use Config ();
+### This adds a 5.005 Perl version dependency.
+### This is a bug and will be fixed.
+use File::Spec ();
+use ExtUtils::MakeMaker ();
+
+use vars qw{$VERSION $ISCORE @ISA};
+BEGIN {
+	$VERSION = '0.68';
+	$ISCORE  = 1;
+	@ISA     = qw{Module::Install::Base};
+}
+
+# check if we can load some module
+### Upgrade this to not have to load the module if possible
+sub can_use {
+	my ($self, $mod, $ver) = @_;
+	$mod =~ s{::|\\}{/}g;
+	$mod .= '.pm' unless $mod =~ /\.pm$/i;
+
+	my $pkg = $mod;
+	$pkg =~ s{/}{::}g;
+	$pkg =~ s{\.pm$}{}i;
+
+	local $@;
+	eval { require $mod; $pkg->VERSION($ver || 0); 1 };
+}
+
+# check if we can run some command
+sub can_run {
+	my ($self, $cmd) = @_;
+
+	my $_cmd = $cmd;
+	return $_cmd if (-x $_cmd or $_cmd = MM->maybe_command($_cmd));
+
+	for my $dir ((split /$Config::Config{path_sep}/, $ENV{PATH}), '.') {
+		my $abs = File::Spec->catfile($dir, $_[1]);
+		return $abs if (-x $abs or $abs = MM->maybe_command($abs));
+	}
+
+	return;
+}
+
+# can we locate a (the) C compiler
+sub can_cc {
+	my $self   = shift;
+	my @chunks = split(/ /, $Config::Config{cc}) or return;
+
+	# $Config{cc} may contain args; try to find out the program part
+	while (@chunks) {
+		return $self->can_run("@chunks") || (pop(@chunks), next);
+	}
+
+	return;
+}
+
+# Fix Cygwin bug on maybe_command();
+if ( $^O eq 'cygwin' ) {
+	require ExtUtils::MM_Cygwin;
+	require ExtUtils::MM_Win32;
+	if ( ! defined(&ExtUtils::MM_Cygwin::maybe_command) ) {
+		*ExtUtils::MM_Cygwin::maybe_command = sub {
+			my ($self, $file) = @_;
+			if ($file =~ m{^/cygdrive/}i and ExtUtils::MM_Win32->can('maybe_command')) {
+				ExtUtils::MM_Win32->maybe_command($file);
+			} else {
+				ExtUtils::MM_Unix->maybe_command($file);
+			}
+		}
+	}
+}
+
+1;
+
+__END__
+
+#line 157

Added: branches/upstream/libtext-quoted-perl/current/inc/Module/Install/Fetch.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libtext-quoted-perl/current/inc/Module/Install/Fetch.pm?rev=9095&op=file
==============================================================================
--- branches/upstream/libtext-quoted-perl/current/inc/Module/Install/Fetch.pm (added)
+++ branches/upstream/libtext-quoted-perl/current/inc/Module/Install/Fetch.pm Fri Nov  9 16:50:19 2007
@@ -1,0 +1,93 @@
+#line 1
+package Module::Install::Fetch;
+
+use strict;
+use Module::Install::Base;
+
+use vars qw{$VERSION $ISCORE @ISA};
+BEGIN {
+	$VERSION = '0.68';
+	$ISCORE  = 1;
+	@ISA     = qw{Module::Install::Base};
+}
+
+sub get_file {
+    my ($self, %args) = @_;
+    my ($scheme, $host, $path, $file) = 
+        $args{url} =~ m|^(\w+)://([^/]+)(.+)/(.+)| or return;
+
+    if ( $scheme eq 'http' and ! eval { require LWP::Simple; 1 } ) {
+        $args{url} = $args{ftp_url}
+            or (warn("LWP support unavailable!\n"), return);
+        ($scheme, $host, $path, $file) = 
+            $args{url} =~ m|^(\w+)://([^/]+)(.+)/(.+)| or return;
+    }
+
+    $|++;
+    print "Fetching '$file' from $host... ";
+
+    unless (eval { require Socket; Socket::inet_aton($host) }) {
+        warn "'$host' resolve failed!\n";
+        return;
+    }
+
+    return unless $scheme eq 'ftp' or $scheme eq 'http';
+
+    require Cwd;
+    my $dir = Cwd::getcwd();
+    chdir $args{local_dir} or return if exists $args{local_dir};
+
+    if (eval { require LWP::Simple; 1 }) {
+        LWP::Simple::mirror($args{url}, $file);
+    }
+    elsif (eval { require Net::FTP; 1 }) { eval {
+        # use Net::FTP to get past firewall
+        my $ftp = Net::FTP->new($host, Passive => 1, Timeout => 600);
+        $ftp->login("anonymous", 'anonymous at example.com');
+        $ftp->cwd($path);
+        $ftp->binary;
+        $ftp->get($file) or (warn("$!\n"), return);
+        $ftp->quit;
+    } }
+    elsif (my $ftp = $self->can_run('ftp')) { eval {
+        # no Net::FTP, fallback to ftp.exe
+        require FileHandle;
+        my $fh = FileHandle->new;
+
+        local $SIG{CHLD} = 'IGNORE';
+        unless ($fh->open("|$ftp -n")) {
+            warn "Couldn't open ftp: $!\n";
+            chdir $dir; return;
+        }
+
+        my @dialog = split(/\n/, <<"END_FTP");
+open $host
+user anonymous anonymous\@example.com
+cd $path
+binary
+get $file $file
+quit
+END_FTP
+        foreach (@dialog) { $fh->print("$_\n") }
+        $fh->close;
+    } }
+    else {
+        warn "No working 'ftp' program available!\n";
+        chdir $dir; return;
+    }
+
+    unless (-f $file) {
+        warn "Fetching failed: $@\n";
+        chdir $dir; return;
+    }
+
+    return if exists $args{size} and -s $file != $args{size};
+    system($args{run}) if exists $args{run};
+    unlink($file) if $args{remove};
+
+    print(((!exists $args{check_for} or -e $args{check_for})
+        ? "done!" : "failed! ($!)"), "\n");
+    chdir $dir; return !$?;
+}
+
+1;

Modified: branches/upstream/libtext-quoted-perl/current/inc/Module/Install/Makefile.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libtext-quoted-perl/current/inc/Module/Install/Makefile.pm?rev=9095&op=diff
==============================================================================
--- branches/upstream/libtext-quoted-perl/current/inc/Module/Install/Makefile.pm (original)
+++ branches/upstream/libtext-quoted-perl/current/inc/Module/Install/Makefile.pm Fri Nov  9 16:50:19 2007
@@ -7,7 +7,7 @@
 
 use vars qw{$VERSION $ISCORE @ISA};
 BEGIN {
-	$VERSION = '0.64';
+	$VERSION = '0.68';
 	$ISCORE  = 1;
 	@ISA     = qw{Module::Install::Base};
 }
@@ -17,192 +17,221 @@
 my %seen = ();
 
 sub prompt {
-    shift;
-
-    # Infinite loop protection
-    my @c = caller();
-    if ( ++$seen{"$c[1]|$c[2]|$_[0]"} > 3 ) {
-        die "Caught an potential prompt infinite loop ($c[1]|$c[2]|$_[0])";
-    }
-
-    # In automated testing, always use defaults
-    if ( $ENV{AUTOMATED_TESTING} and ! $ENV{PERL_MM_USE_DEFAULT} ) {
-        local $ENV{PERL_MM_USE_DEFAULT} = 1;
-        goto &ExtUtils::MakeMaker::prompt;
-    } else {
-        goto &ExtUtils::MakeMaker::prompt;
-    }
+	shift;
+
+	# Infinite loop protection
+	my @c = caller();
+	if ( ++$seen{"$c[1]|$c[2]|$_[0]"} > 3 ) {
+		die "Caught an potential prompt infinite loop ($c[1]|$c[2]|$_[0])";
+	}
+
+	# In automated testing, always use defaults
+	if ( $ENV{AUTOMATED_TESTING} and ! $ENV{PERL_MM_USE_DEFAULT} ) {
+		local $ENV{PERL_MM_USE_DEFAULT} = 1;
+		goto &ExtUtils::MakeMaker::prompt;
+	} else {
+		goto &ExtUtils::MakeMaker::prompt;
+	}
 }
 
 sub makemaker_args {
-    my $self = shift;
-    my $args = ($self->{makemaker_args} ||= {});
-    %$args = ( %$args, @_ ) if @_;
-    $args;
+	my $self = shift;
+	my $args = ($self->{makemaker_args} ||= {});
+	%$args = ( %$args, @_ ) if @_;
+	$args;
 }
 
 # For mm args that take multiple space-seperated args,
 # append an argument to the current list.
 sub makemaker_append {
-    my $self = shift;
-    my $name = shift;
-    my $args = $self->makemaker_args;
-    $args->{name} = defined $args->{$name}
-    	? join( ' ', $args->{name}, @_ )
-    	: join( ' ', @_ );
+	my $self = sShift;
+	my $name = shift;
+	my $args = $self->makemaker_args;
+	$args->{name} = defined $args->{$name}
+		? join( ' ', $args->{name}, @_ )
+		: join( ' ', @_ );
 }
 
 sub build_subdirs {
-    my $self    = shift;
-    my $subdirs = $self->makemaker_args->{DIR} ||= [];
-    for my $subdir (@_) {
-        push @$subdirs, $subdir;
-    }
+	my $self    = shift;
+	my $subdirs = $self->makemaker_args->{DIR} ||= [];
+	for my $subdir (@_) {
+		push @$subdirs, $subdir;
+	}
 }
 
 sub clean_files {
-    my $self  = shift;
-    my $clean = $self->makemaker_args->{clean} ||= {};
-    %$clean = (
-        %$clean, 
-        FILES => join(' ', grep length, $clean->{FILES}, @_),
-    );
+	my $self  = shift;
+	my $clean = $self->makemaker_args->{clean} ||= {};
+	%$clean = (
+		%$clean, 
+		FILES => join(' ', grep length, $clean->{FILES}, @_),
+	);
 }
 
 sub realclean_files {
-    my $self  = shift;
-    my $realclean = $self->makemaker_args->{realclean} ||= {};
-    %$realclean = (
-        %$realclean, 
-        FILES => join(' ', grep length, $realclean->{FILES}, @_),
-    );
+	my $self  = shift;
+	my $realclean = $self->makemaker_args->{realclean} ||= {};
+	%$realclean = (
+		%$realclean, 
+		FILES => join(' ', grep length, $realclean->{FILES}, @_),
+	);
 }
 
 sub libs {
-    my $self = shift;
-    my $libs = ref $_[0] ? shift : [ shift ];
-    $self->makemaker_args( LIBS => $libs );
+	my $self = shift;
+	my $libs = ref $_[0] ? shift : [ shift ];
+	$self->makemaker_args( LIBS => $libs );
 }
 
 sub inc {
-    my $self = shift;
-    $self->makemaker_args( INC => shift );
+	my $self = shift;
+	$self->makemaker_args( INC => shift );
+}
+
+my %test_dir = ();
+
+sub _wanted_t {
+	/\.t$/ and -f $_ and $test_dir{$File::Find::dir} = 1;
+}
+
+sub tests_recursive {
+	my $self = shift;
+	if ( $self->tests ) {
+		die "tests_recursive will not work if tests are already defined";
+	}
+	my $dir = shift || 't';
+	unless ( -d $dir ) {
+		die "tests_recursive dir '$dir' does not exist";
+	}
+	require File::Find;
+	%test_dir = ();
+	File::Find::find( \&_wanted_t, $dir );
+	$self->tests( join ' ', map { "$_/*.t" } sort keys %test_dir );
 }
 
 sub write {
-    my $self = shift;
-    die "&Makefile->write() takes no arguments\n" if @_;
-
-    my $args = $self->makemaker_args;
-    $args->{DISTNAME} = $self->name;
-    $args->{NAME}     = $self->module_name || $self->name || $self->determine_NAME($args);
-    $args->{VERSION}  = $self->version || $self->determine_VERSION($args);
-    $args->{NAME}     =~ s/-/::/g;
-    if ( $self->tests ) {
-        $args->{test} = { TESTS => $self->tests };
-    }
-    if ($] >= 5.005) {
-        $args->{ABSTRACT} = $self->abstract;
-        $args->{AUTHOR}   = $self->author;
-    }
-    if ( eval($ExtUtils::MakeMaker::VERSION) >= 6.10 ) {
-        $args->{NO_META} = 1;
-    }
-    if ( eval($ExtUtils::MakeMaker::VERSION) > 6.17 and $self->sign ) {
-        $args->{SIGN} = 1;
-    }
-    unless ( $self->is_admin ) {
-        delete $args->{SIGN};
-    }
-
-    # merge both kinds of requires into prereq_pm
-    my $prereq = ($args->{PREREQ_PM} ||= {});
-    %$prereq = ( %$prereq, map { @$_ } map { @$_ } grep $_,
-                 ($self->build_requires, $self->requires) );
-
-    # merge both kinds of requires into prereq_pm
-    my $subdirs = ($args->{DIR} ||= []);
-    if ($self->bundles) {
-        foreach my $bundle (@{ $self->bundles }) {
-            my ($file, $dir) = @$bundle;
-            push @$subdirs, $dir if -d $dir;
-            delete $prereq->{$file};
-        }
-    }
-
-    if ( my $perl_version = $self->perl_version ) {
-        eval "use $perl_version; 1"
-            or die "ERROR: perl: Version $] is installed, "
-                . "but we need version >= $perl_version";
-    }
-
-    my %args = map { ( $_ => $args->{$_} ) } grep {defined($args->{$_})} keys %$args;
-    if ($self->admin->preop) {
-        $args{dist} = $self->admin->preop;
-    }
-
-    my $mm = ExtUtils::MakeMaker::WriteMakefile(%args);
-    $self->fix_up_makefile($mm->{FIRST_MAKEFILE} || 'Makefile');
+	my $self = shift;
+	die "&Makefile->write() takes no arguments\n" if @_;
+
+	my $args = $self->makemaker_args;
+	$args->{DISTNAME} = $self->name;
+	$args->{NAME}     = $self->module_name || $self->name || $self->determine_NAME($args);
+	$args->{VERSION}  = $self->version || $self->determine_VERSION($args);
+	$args->{NAME}     =~ s/-/::/g;
+	if ( $self->tests ) {
+		$args->{test} = { TESTS => $self->tests };
+	}
+	if ($] >= 5.005) {
+		$args->{ABSTRACT} = $self->abstract;
+		$args->{AUTHOR}   = $self->author;
+	}
+	if ( eval($ExtUtils::MakeMaker::VERSION) >= 6.10 ) {
+		$args->{NO_META} = 1;
+	}
+	if ( eval($ExtUtils::MakeMaker::VERSION) > 6.17 and $self->sign ) {
+		$args->{SIGN} = 1;
+	}
+	unless ( $self->is_admin ) {
+		delete $args->{SIGN};
+	}
+
+	# merge both kinds of requires into prereq_pm
+	my $prereq = ($args->{PREREQ_PM} ||= {});
+	%$prereq = ( %$prereq,
+		map { @$_ }
+		map { @$_ }
+		grep $_,
+		($self->build_requires, $self->requires)
+	);
+
+	# merge both kinds of requires into prereq_pm
+	my $subdirs = ($args->{DIR} ||= []);
+	if ($self->bundles) {
+		foreach my $bundle (@{ $self->bundles }) {
+			my ($file, $dir) = @$bundle;
+			push @$subdirs, $dir if -d $dir;
+			delete $prereq->{$file};
+		}
+	}
+
+	if ( my $perl_version = $self->perl_version ) {
+		eval "use $perl_version; 1"
+			or die "ERROR: perl: Version $] is installed, "
+			. "but we need version >= $perl_version";
+	}
+
+	$args->{INSTALLDIRS} = $self->installdirs;
+
+	my %args = map { ( $_ => $args->{$_} ) } grep {defined($args->{$_})} keys %$args;
+
+	my $user_preop = delete $args{dist}->{PREOP};
+	if (my $preop = $self->admin->preop($user_preop)) {
+		$args{dist} = $preop;
+	}
+
+	my $mm = ExtUtils::MakeMaker::WriteMakefile(%args);
+	$self->fix_up_makefile($mm->{FIRST_MAKEFILE} || 'Makefile');
 }
 
 sub fix_up_makefile {
-    my $self          = shift;
-    my $makefile_name = shift;
-    my $top_class     = ref($self->_top) || '';
-    my $top_version   = $self->_top->VERSION || '';
-
-    my $preamble = $self->preamble 
-        ? "# Preamble by $top_class $top_version\n"
-            . $self->preamble
-        : '';
-    my $postamble = "# Postamble by $top_class $top_version\n"
-        . ($self->postamble || '');
-
-    local *MAKEFILE;
-    open MAKEFILE, "< $makefile_name" or die "fix_up_makefile: Couldn't open $makefile_name: $!";
-    my $makefile = do { local $/; <MAKEFILE> };
-    close MAKEFILE or die $!;
-
-    $makefile =~ s/\b(test_harness\(\$\(TEST_VERBOSE\), )/$1'inc', /;
-    $makefile =~ s/( -I\$\(INST_ARCHLIB\))/ -Iinc$1/g;
-    $makefile =~ s/( "-I\$\(INST_LIB\)")/ "-Iinc"$1/g;
-    $makefile =~ s/^(FULLPERL = .*)/$1 "-Iinc"/m;
-    $makefile =~ s/^(PERL = .*)/$1 "-Iinc"/m;
-
-    # Module::Install will never be used to build the Core Perl
-    # Sometimes PERL_LIB and PERL_ARCHLIB get written anyway, which breaks
-    # PREFIX/PERL5LIB, and thus, install_share. Blank them if they exist
-    $makefile =~ s/^PERL_LIB = .+/PERL_LIB =/m;
-    #$makefile =~ s/^PERL_ARCHLIB = .+/PERL_ARCHLIB =/m;
-
-    # Perl 5.005 mentions PERL_LIB explicitly, so we have to remove that as well.
-    $makefile =~ s/("?)-I\$\(PERL_LIB\)\1//g;
-
-    # XXX - This is currently unused; not sure if it breaks other MM-users
-    # $makefile =~ s/^pm_to_blib\s+:\s+/pm_to_blib :: /mg;
-
-    open  MAKEFILE, "> $makefile_name" or die "fix_up_makefile: Couldn't open $makefile_name: $!";
-    print MAKEFILE  "$preamble$makefile$postamble" or die $!;
-    close MAKEFILE  or die $!;
-
-    1;
+	my $self          = shift;
+	my $makefile_name = shift;
+	my $top_class     = ref($self->_top) || '';
+	my $top_version   = $self->_top->VERSION || '';
+
+	my $preamble = $self->preamble 
+		? "# Preamble by $top_class $top_version\n"
+			. $self->preamble
+		: '';
+	my $postamble = "# Postamble by $top_class $top_version\n"
+		. ($self->postamble || '');
+
+	local *MAKEFILE;
+	open MAKEFILE, "< $makefile_name" or die "fix_up_makefile: Couldn't open $makefile_name: $!";
+	my $makefile = do { local $/; <MAKEFILE> };
+	close MAKEFILE or die $!;
+
+	$makefile =~ s/\b(test_harness\(\$\(TEST_VERBOSE\), )/$1'inc', /;
+	$makefile =~ s/( -I\$\(INST_ARCHLIB\))/ -Iinc$1/g;
+	$makefile =~ s/( "-I\$\(INST_LIB\)")/ "-Iinc"$1/g;
+	$makefile =~ s/^(FULLPERL = .*)/$1 "-Iinc"/m;
+	$makefile =~ s/^(PERL = .*)/$1 "-Iinc"/m;
+
+	# Module::Install will never be used to build the Core Perl
+	# Sometimes PERL_LIB and PERL_ARCHLIB get written anyway, which breaks
+	# PREFIX/PERL5LIB, and thus, install_share. Blank them if they exist
+	$makefile =~ s/^PERL_LIB = .+/PERL_LIB =/m;
+	#$makefile =~ s/^PERL_ARCHLIB = .+/PERL_ARCHLIB =/m;
+
+	# Perl 5.005 mentions PERL_LIB explicitly, so we have to remove that as well.
+	$makefile =~ s/("?)-I\$\(PERL_LIB\)\1//g;
+
+	# XXX - This is currently unused; not sure if it breaks other MM-users
+	# $makefile =~ s/^pm_to_blib\s+:\s+/pm_to_blib :: /mg;
+
+	open  MAKEFILE, "> $makefile_name" or die "fix_up_makefile: Couldn't open $makefile_name: $!";
+	print MAKEFILE  "$preamble$makefile$postamble" or die $!;
+	close MAKEFILE  or die $!;
+
+	1;
 }
 
 sub preamble {
-    my ($self, $text) = @_;
-    $self->{preamble} = $text . $self->{preamble} if defined $text;
-    $self->{preamble};
+	my ($self, $text) = @_;
+	$self->{preamble} = $text . $self->{preamble} if defined $text;
+	$self->{preamble};
 }
 
 sub postamble {
-    my ($self, $text) = @_;
-    $self->{postamble} ||= $self->admin->postamble;
-    $self->{postamble} .= $text if defined $text;
-    $self->{postamble}
+	my ($self, $text) = @_;
+	$self->{postamble} ||= $self->admin->postamble;
+	$self->{postamble} .= $text if defined $text;
+	$self->{postamble}
 }
 
 1;
 
 __END__
 
-#line 334
+#line 363

Modified: branches/upstream/libtext-quoted-perl/current/inc/Module/Install/Metadata.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libtext-quoted-perl/current/inc/Module/Install/Metadata.pm?rev=9095&op=diff
==============================================================================
--- branches/upstream/libtext-quoted-perl/current/inc/Module/Install/Metadata.pm (original)
+++ branches/upstream/libtext-quoted-perl/current/inc/Module/Install/Metadata.pm Fri Nov  9 16:50:19 2007
@@ -6,14 +6,14 @@
 
 use vars qw{$VERSION $ISCORE @ISA};
 BEGIN {
-	$VERSION = '0.64';
+	$VERSION = '0.68';
 	$ISCORE  = 1;
 	@ISA     = qw{Module::Install::Base};
 }
 
 my @scalar_keys = qw{
     name module_name abstract author version license
-    distribution_type perl_version tests
+    distribution_type perl_version tests installdirs
 };
 
 my @tuple_keys = qw{
@@ -56,9 +56,23 @@
     };
 }
 
+# configure_requires is currently a null-op
+sub configure_requires { 1 }
+
+# Aliases for build_requires that will have alternative
+# meanings in some future version of META.yml.
+sub test_requires      { shift->build_requires(@_)  }
+sub install_requires   { shift->build_requires(@_)  }
+
+# Aliases for installdirs options
+sub install_as_core    { $_[0]->installdirs('perl')   }
+sub install_as_cpan    { $_[0]->installdirs('site')   }
+sub install_as_site    { $_[0]->installdirs('site')   }
+sub install_as_vendor  { $_[0]->installdirs('vendor') }
+
 sub sign {
     my $self = shift;
-    return $self->{'values'}{'sign'} if defined wantarray and !@_;
+    return $self->{'values'}{'sign'} if defined wantarray and ! @_;
     $self->{'values'}{'sign'} = ( @_ ? $_[0] : 1 );
     return $self;
 }
@@ -279,9 +293,11 @@
 
     if (
         $self->_slurp($file) =~ m/
-        =head \d \s+
-        (?:licen[cs]e|licensing|copyright|legal)\b
-        (.*?)
+        (
+            =head \d \s+
+            (?:licen[cs]e|licensing|copyright|legal)\b
+            .*?
+        )
         (=head\\d.*|=cut.*|)
         \z
     /ixms
@@ -289,19 +305,24 @@
     {
         my $license_text = $1;
         my @phrases      = (
-            'under the same (?:terms|license) as perl itself' => 'perl',
-            'GNU public license'                              => 'gpl',
-            'GNU lesser public license'                       => 'gpl',
-            'BSD license'                                     => 'bsd',
-            'Artistic license'                                => 'artistic',
-            'GPL'                                             => 'gpl',
-            'LGPL'                                            => 'lgpl',
-            'BSD'                                             => 'bsd',
-            'Artistic'                                        => 'artistic',
+            'under the same (?:terms|license) as perl itself' => 'perl',        1,
+            'GNU public license'                              => 'gpl',         1,
+            'GNU lesser public license'                       => 'gpl',         1,
+            'BSD license'                                     => 'bsd',         1,
+            'Artistic license'                                => 'artistic',    1,
+            'GPL'                                             => 'gpl',         1,
+            'LGPL'                                            => 'lgpl',        1,
+            'BSD'                                             => 'bsd',         1,
+            'Artistic'                                        => 'artistic',    1,
+            'MIT'                                             => 'mit',         1,
+            'proprietary'                                     => 'proprietary', 0,
         );
-        while ( my ( $pattern, $license ) = splice( @phrases, 0, 2 ) ) {
+        while ( my ($pattern, $license, $osi) = splice(@phrases, 0, 3) ) {
             $pattern =~ s{\s+}{\\s+}g;
             if ( $license_text =~ /\b$pattern\b/i ) {
+                if ( $osi and $license_text =~ /All rights reserved/i ) {
+                        warn "LEGAL WARNING: 'All rights reserved' may invalidate Open Source licenses. Consider removing it.";
+		}
                 $self->license($license);
                 return 1;
             }

Added: branches/upstream/libtext-quoted-perl/current/inc/Module/Install/Win32.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libtext-quoted-perl/current/inc/Module/Install/Win32.pm?rev=9095&op=file
==============================================================================
--- branches/upstream/libtext-quoted-perl/current/inc/Module/Install/Win32.pm (added)
+++ branches/upstream/libtext-quoted-perl/current/inc/Module/Install/Win32.pm Fri Nov  9 16:50:19 2007
@@ -1,0 +1,65 @@
+#line 1
+package Module::Install::Win32;
+
+use strict;
+use Module::Install::Base;
+
+use vars qw{$VERSION $ISCORE @ISA};
+BEGIN {
+	$VERSION = '0.68';
+	$ISCORE  = 1;
+	@ISA     = qw{Module::Install::Base};
+}
+
+# determine if the user needs nmake, and download it if needed
+sub check_nmake {
+	my $self = shift;
+	$self->load('can_run');
+	$self->load('get_file');
+	
+	require Config;
+	return unless (
+		$^O eq 'MSWin32'                     and
+		$Config::Config{make}                and
+		$Config::Config{make} =~ /^nmake\b/i and
+		! $self->can_run('nmake')
+	);
+
+	print "The required 'nmake' executable not found, fetching it...\n";
+
+	require File::Basename;
+	my $rv = $self->get_file(
+		url       => 'http://download.microsoft.com/download/vc15/Patch/1.52/W95/EN-US/Nmake15.exe',
+		ftp_url   => 'ftp://ftp.microsoft.com/Softlib/MSLFILES/Nmake15.exe',
+		local_dir => File::Basename::dirname($^X),
+		size      => 51928,
+		run       => 'Nmake15.exe /o > nul',
+		check_for => 'Nmake.exe',
+		remove    => 1,
+	);
+
+	if (!$rv) {
+        die <<'END_MESSAGE';
+
+-------------------------------------------------------------------------------
+
+Since you are using Microsoft Windows, you will need the 'nmake' utility
+before installation. It's available at:
+
+  http://download.microsoft.com/download/vc15/Patch/1.52/W95/EN-US/Nmake15.exe
+      or
+  ftp://ftp.microsoft.com/Softlib/MSLFILES/Nmake15.exe
+
+Please download the file manually, save it to a directory in %PATH% (e.g.
+C:\WINDOWS\COMMAND\), then launch the MS-DOS command line shell, "cd" to
+that directory, and run "Nmake15.exe" from there; that will create the
+'nmake.exe' file needed by this module.
+
+You may then resume the installation process described in README.
+
+-------------------------------------------------------------------------------
+END_MESSAGE
+	}
+}
+
+1;

Added: branches/upstream/libtext-quoted-perl/current/inc/Module/Install/WriteAll.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libtext-quoted-perl/current/inc/Module/Install/WriteAll.pm?rev=9095&op=file
==============================================================================
--- branches/upstream/libtext-quoted-perl/current/inc/Module/Install/WriteAll.pm (added)
+++ branches/upstream/libtext-quoted-perl/current/inc/Module/Install/WriteAll.pm Fri Nov  9 16:50:19 2007
@@ -1,0 +1,43 @@
+#line 1
+package Module::Install::WriteAll;
+
+use strict;
+use Module::Install::Base;
+
+use vars qw{$VERSION $ISCORE @ISA};
+BEGIN {
+	$VERSION = '0.68';
+	$ISCORE  = 1;
+	@ISA     = qw{Module::Install::Base};
+}
+
+sub WriteAll {
+    my $self = shift;
+    my %args = (
+        meta        => 1,
+        sign        => 0,
+        inline      => 0,
+        check_nmake => 1,
+        @_
+    );
+
+    $self->sign(1)                if $args{sign};
+    $self->Meta->write            if $args{meta};
+    $self->admin->WriteAll(%args) if $self->is_admin;
+
+    if ( $0 =~ /Build.PL$/i ) {
+        $self->Build->write;
+    } else {
+        $self->check_nmake if $args{check_nmake};
+        unless ( $self->makemaker_args->{'PL_FILES'} ) {
+        	$self->makemaker_args( PL_FILES => {} );
+        }
+        if ($args{inline}) {
+            $self->Inline->write;
+        } else {
+            $self->Makefile->write;
+        }
+    }
+}
+
+1;




More information about the Pkg-perl-cvs-commits mailing list