[Rt-commit] r4016 - in DBIx-SearchBuilder/trunk: . inc/ExtUtils inc/Module inc/Module/Install

jesse at bestpractical.com jesse at bestpractical.com
Wed Nov 2 11:39:08 EST 2005


Author: jesse
Date: Wed Nov  2 11:39:05 2005
New Revision: 4016

Added:
   DBIx-SearchBuilder/trunk/inc/ExtUtils/
   DBIx-SearchBuilder/trunk/inc/ExtUtils/AutoInstall.pm
   DBIx-SearchBuilder/trunk/inc/Module/Install/Include.pm
Modified:
   DBIx-SearchBuilder/trunk/   (props changed)
   DBIx-SearchBuilder/trunk/MANIFEST
   DBIx-SearchBuilder/trunk/META.yml
   DBIx-SearchBuilder/trunk/Makefile.PL
   DBIx-SearchBuilder/trunk/SIGNATURE
   DBIx-SearchBuilder/trunk/inc/Module/Install.pm
   DBIx-SearchBuilder/trunk/inc/Module/Install/AutoInstall.pm
   DBIx-SearchBuilder/trunk/inc/Module/Install/Base.pm
   DBIx-SearchBuilder/trunk/inc/Module/Install/Makefile.pm
   DBIx-SearchBuilder/trunk/inc/Module/Install/Metadata.pm
Log:
 r18096 at truegrounds:  jesse | 2005-11-02 22:32:35 -0500
  * 1.34


Modified: DBIx-SearchBuilder/trunk/MANIFEST
==============================================================================
--- DBIx-SearchBuilder/trunk/MANIFEST	(original)
+++ DBIx-SearchBuilder/trunk/MANIFEST	Wed Nov  2 11:39:05 2005
@@ -2,9 +2,11 @@
 ex/create_tables.pl
 ex/Example/Model/Address.pm
 ex/Example/Model/Employee.pm
+inc/ExtUtils/AutoInstall.pm
 inc/Module/Install.pm
 inc/Module/Install/AutoInstall.pm
 inc/Module/Install/Base.pm
+inc/Module/Install/Include.pm
 inc/Module/Install/Makefile.pm
 inc/Module/Install/Metadata.pm
 Makefile.PL

Modified: DBIx-SearchBuilder/trunk/META.yml
==============================================================================
--- DBIx-SearchBuilder/trunk/META.yml	(original)
+++ DBIx-SearchBuilder/trunk/META.yml	Wed Nov  2 11:39:05 2005
@@ -1,5 +1,5 @@
 name: DBIx-SearchBuilder
-version: 1.33
+version: 1.34
 license: perl
 distribution_type: module
 build_requires:
@@ -11,7 +11,8 @@
   Encode: 0
   Class::ReturnValue: 0.4
   Cache::Simple::TimedExpiry: 0.21
+  Clone: 0
 no_index:
   directory:
     - inc
-generated_by: Module::Install version 0.36
+generated_by: Module::Install version 0.37

Modified: DBIx-SearchBuilder/trunk/Makefile.PL
==============================================================================
--- DBIx-SearchBuilder/trunk/Makefile.PL	(original)
+++ DBIx-SearchBuilder/trunk/Makefile.PL	Wed Nov  2 11:39:05 2005
@@ -8,6 +8,7 @@
 requires('Encode');
 requires('Class::ReturnValue', 0.40);
 requires('Cache::Simple::TimedExpiry' => '0.21');
+requires('Clone');
 build_requires('Test::More' => 0.52);
 build_requires('DBD::SQLite');
 

Modified: DBIx-SearchBuilder/trunk/SIGNATURE
==============================================================================
--- DBIx-SearchBuilder/trunk/SIGNATURE	(original)
+++ DBIx-SearchBuilder/trunk/SIGNATURE	Wed Nov  2 11:39:05 2005
@@ -1,12 +1,12 @@
 This file contains message digests of all files listed in MANIFEST,
-signed via the Module::Signature module, version 0.41.
+signed via the Module::Signature module, version 0.50.
 
 To verify the content in this distribution, first make sure you have
 Module::Signature installed, then type:
 
     % cpansign -v
 
-It would check each file's integrity, as well as the signature's
+It will check each file's integrity, as well as the signature's
 validity.  If "==> Signature verified OK! <==" is not displayed,
 the distribution may already have been compromised, and you should
 not run its Makefile.PL or Build.PL.
@@ -14,14 +14,14 @@
 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1
 
-SHA1 b99db3fa10d5c7616968319db1bd03f1d16b632d Changes
-SHA1 e2ecbebae35087c74c256cf60871783963108dde MANIFEST
-SHA1 68591cf5f61a2be9288cedf25cc69edcf8284317 META.yml
-SHA1 ee67bd8159b64f5020f5ddd82cc88375c3716e06 Makefile.PL
+SHA1 8b706274f6fa13ff1b7a2f6a68a1ba0c679392ff Changes
+SHA1 a71ea5816fa4a8c39c4bcf788e40e255fa8157cd MANIFEST
+SHA1 85f957f96bf79435085339358773474c96154e7f META.yml
+SHA1 9e2b77ea1e98ae5fb9cca3942c3ef34148778c00 Makefile.PL
 SHA1 d7a41642c368f2a587587e09f9e815d434feebff README
 SHA1 5a53d12d5cccd94845a6a7cc105cd9be34e20f1c ROADMAP
-SHA1 f09f56a6b597995f47a3193d37bf09a5cd9c0fb3 SearchBuilder.pm
-SHA1 dd33a037b62d7d6d0263aa5beb464199df7174f6 SearchBuilder/Handle.pm
+SHA1 f735b9cd758446a6e1694446fdbd7c419c704c65 SearchBuilder.pm
+SHA1 cad09fba893819afb6606447d6af718d4cdd93e8 SearchBuilder/Handle.pm
 SHA1 3ae0584e86c7573b6bfda4d025193c970ba30b40 SearchBuilder/Handle/Informix.pm
 SHA1 861cee4205d1f367af5cc68b561fd37e38c1acf0 SearchBuilder/Handle/ODBC.pm
 SHA1 50069f9fbfec254371f4c295f517fb73e1c006b2 SearchBuilder/Handle/Oracle.pm
@@ -30,7 +30,7 @@
 SHA1 494edbdaf8c9ba7c36fec4809d595051594a9c47 SearchBuilder/Handle/Sybase.pm
 SHA1 7fac6d8e867781f7d2007f8cc91bb7d9eadb1bfe SearchBuilder/Handle/mysql.pm
 SHA1 f4f6ea88631e6310243b6351e8df11e1ec88b261 SearchBuilder/Handle/mysqlPP.pm
-SHA1 a628f565b460cf4060d3ef1fdb17878059eac7e5 SearchBuilder/Record.pm
+SHA1 4c120acb54ab2f9f9531cb38a12e7d3eacf40d37 SearchBuilder/Record.pm
 SHA1 a5201fbeca07c19669ce920a4d48e39634626c46 SearchBuilder/Record/Cachable.pm
 SHA1 a15065e472797e2bfe8149f04d3bdc58f67a7a6d SearchBuilder/SchemaGenerator.pm
 SHA1 446f59a1fa8fa631c908f1fe3ea671c7178c9270 SearchBuilder/Union.pm
@@ -38,11 +38,13 @@
 SHA1 e7c7c7c91025072d25da78c93cefa2bc0aaf2b35 ex/Example/Model/Address.pm
 SHA1 f821661849153c21ad99393b6a3ea6720fdaf581 ex/Example/Model/Employee.pm
 SHA1 9689368197327e7b38af7f3d1f863e918ed4fa98 ex/create_tables.pl
-SHA1 05d89e1fe6d49cd518b5a3e6694cc313e655fb02 inc/Module/Install.pm
-SHA1 8a9c31fdf6a65a32295c8630923988f590bbf0f6 inc/Module/Install/AutoInstall.pm
-SHA1 2e300b145ee61eea9dfd71624b17b0bc9218aa4f inc/Module/Install/Base.pm
-SHA1 e094fe96aef06c68d7a424818c12e52b11f1ccdd inc/Module/Install/Makefile.pm
-SHA1 e448c6dc5351ef425e3f8bdbeb642409120bc3ca inc/Module/Install/Metadata.pm
+SHA1 d3a4a49c9bd1a1b3d6054d82c44cdf0ca1bb3f05 inc/ExtUtils/AutoInstall.pm
+SHA1 842ab7e28834effb9e4222aab72c4106727dea0f inc/Module/Install.pm
+SHA1 065c69ef1947864c665858968c0e6d74e5d14668 inc/Module/Install/AutoInstall.pm
+SHA1 1da4fc271065900f73682f31d4f9c0dae5288143 inc/Module/Install/Base.pm
+SHA1 48cc63c52aa29d54f68f8c8cf7c0a72f7bde9ea0 inc/Module/Install/Include.pm
+SHA1 dc2af04175831ddb9a00de944e761e5c46bbf283 inc/Module/Install/Makefile.pm
+SHA1 421da5922ad85b72ae5b27c33803e86b3762d238 inc/Module/Install/Metadata.pm
 SHA1 e59ea21b9407644714a5f67c7132a11916c25133 t/00.load.t
 SHA1 a7ed1ee359ebe2842b354b5652a441403e802080 t/01basics.t
 SHA1 2b2dc6f72370f60e1d233f2f8c12bb87414e825c t/01nocap_api.t
@@ -58,7 +60,7 @@
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.1 (GNU/Linux)
 
-iD8DBQFDMvf0Ei9d9xCOQEYRAqL0AKCxJDGbnESlu8gFHgU0gDJq9eaTUgCdHuLa
-xBpAkFKMMlEA0yw7WdqozHY=
-=1MuO
+iD8DBQFDaYS2Ei9d9xCOQEYRAlOZAKC2+0qcwD3sAfyp79fJZBhdkjMJigCcCoOH
+szaFEjAc5SAtsn5JgklBYnM=
+=q1aH
 -----END PGP SIGNATURE-----

Added: DBIx-SearchBuilder/trunk/inc/ExtUtils/AutoInstall.pm
==============================================================================
--- (empty file)
+++ DBIx-SearchBuilder/trunk/inc/ExtUtils/AutoInstall.pm	Wed Nov  2 11:39:05 2005
@@ -0,0 +1,647 @@
+#line 1 "inc/ExtUtils/AutoInstall.pm - /usr/local/share/perl/5.8.7/ExtUtils/AutoInstall.pm"
+package ExtUtils::AutoInstall;
+$ExtUtils::AutoInstall::VERSION = '0.63';
+
+use strict;
+use Cwd ();
+use ExtUtils::MakeMaker ();
+
+#line 312
+
+# special map on pre-defined feature sets
+my %FeatureMap = (
+    ''      => 'Core Features', # XXX: deprecated
+    '-core' => 'Core Features',
+);
+
+# various lexical flags
+my (@Missing, @Existing, %DisabledTests, $UnderCPAN, $HasCPANPLUS);
+my ($Config, $CheckOnly, $SkipInstall, $AcceptDefault, $TestOnly);
+my ($PostambleActions, $PostambleUsed);
+
+_accept_default(!-t STDIN); # see if it's a non-interactive session
+_init();
+
+sub _accept_default {
+    $AcceptDefault = shift;
+}
+
+sub missing_modules {
+    return @Missing;
+}
+
+sub do_install {
+    __PACKAGE__->install(
+        [ UNIVERSAL::isa($Config, 'HASH') ? %{$Config} : @{$Config}],
+        @Missing,
+    );
+}
+
+# initialize various flags, and/or perform install
+sub _init {
+    foreach my $arg (@ARGV, split(/[\s\t]+/, $ENV{PERL_EXTUTILS_AUTOINSTALL} || '')) {
+        if ($arg =~ /^--config=(.*)$/) {
+            $Config = [ split(',', $1) ];
+        }
+        elsif ($arg =~ /^--installdeps=(.*)$/) {
+            __PACKAGE__->install($Config, @Missing = split(/,/, $1));
+            exit 0;
+        }
+        elsif ($arg =~ /^--default(?:deps)?$/) {
+            $AcceptDefault = 1;
+        }
+        elsif ($arg =~ /^--check(?:deps)?$/) {
+            $CheckOnly = 1;
+        }
+        elsif ($arg =~ /^--skip(?:deps)?$/) {
+            $SkipInstall = 1;
+        }
+        elsif ($arg =~ /^--test(?:only)?$/) {
+            $TestOnly = 1;
+        }
+    }
+}
+
+# overrides MakeMaker's prompt() to automatically accept the default choice
+sub _prompt {
+    goto &ExtUtils::MakeMaker::prompt unless $AcceptDefault;
+
+    my ($prompt, $default) = @_;
+    my $y = ($default =~ /^[Yy]/);
+
+    print $prompt, ' [', ($y ? 'Y' : 'y'), '/', ($y ? 'n' : 'N'), '] ';
+    print "$default\n";
+    return $default;
+}
+
+# the workhorse
+sub import {
+    my $class = shift;
+    my @args  = @_ or return;
+    my $core_all;
+
+    print "*** $class version ".$class->VERSION."\n";
+    print "*** Checking for dependencies...\n";
+
+    my $cwd = Cwd::cwd();
+
+    $Config  = [];
+
+    my $maxlen = length((sort { length($b) <=> length($a) }
+        grep { /^[^\-]/ }
+        map { ref($_) ? keys %{ref($_) eq 'HASH' ? $_ : +{@{$_}}} : '' }
+        map { +{@args}->{$_} }
+        grep { /^[^\-]/ or /^-core$/i } keys %{+{@args}})[0]);
+
+    while (my ($feature, $modules) = splice(@args, 0, 2)) {
+        my (@required, @tests, @skiptests);
+        my $default  = 1;
+        my $conflict = 0;
+
+        if ($feature =~ m/^-(\w+)$/) {
+            my $option = lc($1);
+
+            # check for a newer version of myself
+            _update_to($modules, @_) and return if $option eq 'version';
+
+            # sets CPAN configuration options
+            $Config = $modules                  if $option eq 'config';
+
+            # promote every features to core status
+            $core_all = ($modules =~ /^all$/i) and next
+                if $option eq 'core';
+
+            next unless $option eq 'core';
+        }
+
+        print "[".($FeatureMap{lc($feature)} || $feature)."]\n";
+
+        $modules = [ %{$modules} ] if UNIVERSAL::isa($modules, 'HASH');
+
+        unshift @$modules, -default => &{shift(@$modules)}
+            if (ref($modules->[0]) eq 'CODE'); # XXX: bugward combatability
+
+        while (my ($mod, $arg) = splice(@$modules, 0, 2)) {
+            if ($mod =~ m/^-(\w+)$/) {
+                my $option = lc($1);
+
+                $default   = $arg    if ($option eq 'default');
+                $conflict  = $arg    if ($option eq 'conflict');
+                @tests     = @{$arg} if ($option eq 'tests');
+                @skiptests = @{$arg} if ($option eq 'skiptests');
+
+                next;
+            }
+
+            printf("- %-${maxlen}s ...", $mod);
+
+            # XXX: check for conflicts and uninstalls(!) them.
+            if (defined(my $cur = _version_check(_load($mod), $arg ||= 0))) {
+                print "loaded. ($cur".($arg ? " >= $arg" : '').")\n";
+                push @Existing, $mod => $arg;
+                $DisabledTests{$_} = 1 for map { glob($_) } @skiptests;
+            }
+            else {
+                print "missing." . ($arg ? " (would need $arg)" : '') . "\n";
+                push @required, $mod => $arg;
+            }
+        }
+
+        next unless @required;
+
+        my $mandatory = ($feature eq '-core' or $core_all);
+
+        if (!$SkipInstall and ($CheckOnly or _prompt(
+            qq{==> Auto-install the }. (@required / 2).
+            ($mandatory ? ' mandatory' : ' optional').
+            qq{ module(s) from CPAN?}, $default ? 'y' : 'n',
+        ) =~ /^[Yy]/)) {
+            push (@Missing, @required);
+            $DisabledTests{$_} = 1 for map { glob($_) } @skiptests;
+        }
+
+        elsif (!$SkipInstall and $default and $mandatory and _prompt(
+            qq{==> The module(s) are mandatory! Really skip?}, 'n',
+        ) =~ /^[Nn]/) {
+            push (@Missing, @required);
+            $DisabledTests{$_} = 1 for map { glob($_) } @skiptests;
+        }
+
+        else {
+            $DisabledTests{$_} = 1 for map { glob($_) } @tests;
+        }
+    }
+
+    _check_lock(); # check for $UnderCPAN
+
+    if (@Missing and not ($CheckOnly or $UnderCPAN)) {
+        require Config;
+        print "*** Dependencies will be installed the next time you type '$Config::Config{make}'.\n";
+        # make an educated guess of whether we'll need root permission.
+        print "    (You may need to do that as the 'root' user.)\n" if eval '$>';
+    }
+    print "*** $class configuration finished.\n";
+
+    chdir $cwd;
+
+    # import to main::
+    no strict 'refs';
+    *{'main::WriteMakefile'} = \&Write if caller(0) eq 'main';
+}
+
+# CPAN.pm is non-reentrant, so check if we're under it and have no CPANPLUS
+sub _check_lock {
+    return unless @Missing;
+    return if _has_cpanplus();
+
+    require CPAN; CPAN::Config->load;
+    my $lock = MM->catfile($CPAN::Config->{cpan_home}, ".lock");
+
+    if (-f $lock and open(LOCK, $lock)
+        and ($^O eq 'MSWin32' ? _under_cpan() : <LOCK> == getppid())
+        and ($CPAN::Config->{prerequisites_policy} || '') ne 'ignore'
+    ) {
+        print << '.';
+
+*** Since we're running under CPAN, I'll just let it take care
+    of the dependency's installation later.
+.
+        $UnderCPAN = 1;
+    }
+
+    close LOCK;
+}
+
+sub install {
+    my $class  = shift;
+
+    my $i; # used below to strip leading '-' from config keys
+    my @config = (map { s/^-// if ++$i; $_ } @{+shift});
+
+    my (@modules, @installed);
+    while (my ($pkg, $ver) = splice(@_, 0, 2)) {
+        # grep out those already installed
+        if (defined(_version_check(_load($pkg), $ver))) {
+            push @installed, $pkg;
+        }
+        else {
+            push @modules, $pkg, $ver;
+        }
+    }
+
+    return @installed unless @modules; # nothing to do
+
+    print "*** Installing dependencies...\n";
+
+    return unless _connected_to('cpan.org');
+
+    my %args = @config;
+    my %failed;
+    local *FAILED;
+    if ($args{do_once} and open(FAILED, '.#autoinstall.failed')) {
+        while (<FAILED>) { chomp; $failed{$_}++ }
+        close FAILED;
+
+        my @newmod;
+        while (my ($k, $v) = splice(@modules, 0, 2)) {
+            push @newmod, ($k => $v) unless $failed{$k};
+        }
+        @modules = @newmod;
+    }
+
+    if (_has_cpanplus()) {
+        _install_cpanplus(\@modules, \@config);
+    }
+    else {
+        _install_cpan(\@modules, \@config);
+    }
+
+    print "*** $class installation finished.\n";
+
+    # see if we have successfully installed them
+    while (my ($pkg, $ver) = splice(@modules, 0, 2)) {
+        if (defined(_version_check(_load($pkg), $ver))) {
+            push @installed, $pkg;
+        }
+        elsif ($args{do_once} and open(FAILED, '>> .#autoinstall.failed')) {
+            print FAILED "$pkg\n";
+        }
+    }
+
+    close FAILED if $args{do_once};
+
+    return @installed;
+}
+
+sub _install_cpanplus {
+    my @modules = @{+shift};
+    my @config  = @{+shift};
+    my $installed = 0;
+
+    require CPANPLUS::Backend;
+    my $cp   = CPANPLUS::Backend->new;
+    my $conf = $cp->configure_object;
+
+    return unless _can_write(
+        $conf->can('conf')
+            ? $conf->get_conf('base')       # 0.05x+
+            : $conf->_get_build('base')     # 0.04x
+    );
+
+    # if we're root, set UNINST=1 to avoid trouble unless user asked for it.
+    my $makeflags = $conf->get_conf('makeflags') || '';
+    if (UNIVERSAL::isa($makeflags, 'HASH')) {
+        # 0.03+ uses a hashref here
+        $makeflags->{UNINST} = 1 unless exists $makeflags->{UNINST};
+    }
+    else {
+        # 0.02 and below uses a scalar
+        $makeflags = join(' ', split(' ', $makeflags), 'UNINST=1')
+            if ($makeflags !~ /\bUNINST\b/ and eval qq{ $> eq '0' });
+    }
+    $conf->set_conf(makeflags => $makeflags);
+    $conf->set_conf(prereqs => 1);
+
+    while (my ($key, $val) = splice(@config, 0, 2)) {
+        eval { $conf->set_conf($key, $val) };
+    }
+
+    my $modtree = $cp->module_tree;
+    while (my ($pkg, $ver) = splice(@modules, 0, 2)) {
+        print "*** Installing $pkg...\n";
+
+        MY::preinstall($pkg, $ver) or next if defined &MY::preinstall;
+
+        my $success;
+        my $obj = $modtree->{$pkg};
+
+        if ($obj and defined(_version_check($obj->{version}, $ver))) {
+            my $pathname = $pkg; $pathname =~ s/::/\\W/;
+
+            foreach my $inc (grep { m/$pathname.pm/i } keys(%INC)) {
+                delete $INC{$inc};
+            }
+
+            my $rv = $cp->install( modules => [ $obj->{module} ]);
+
+            if ($rv and ($rv->{$obj->{module}} or $rv->{ok})) {
+                print "*** $pkg successfully installed.\n";
+                $success = 1;
+            }
+            else {
+                print "*** $pkg installation cancelled.\n";
+                $success = 0;
+            }
+
+            $installed += $success;
+        }
+        else {
+            print << ".";
+*** Could not find a version $ver or above for $pkg; skipping.
+.
+        }
+
+        MY::postinstall($pkg, $ver, $success) if defined &MY::postinstall;
+    }
+
+    return $installed;
+}
+
+sub _install_cpan {
+    my @modules = @{+shift};
+    my @config  = @{+shift};
+    my $installed = 0;
+    my %args;
+
+    require CPAN; CPAN::Config->load;
+    require Config;
+
+    return unless _can_write(MM->catfile($CPAN::Config->{cpan_home}, 'sources'))
+              and _can_write($Config::Config{sitelib});
+
+    # if we're root, set UNINST=1 to avoid trouble unless user asked for it.
+    my $makeflags = $CPAN::Config->{make_install_arg} || '';
+    $CPAN::Config->{make_install_arg} = join(' ', split(' ', $makeflags), 'UNINST=1')
+        if ($makeflags !~ /\bUNINST\b/ and eval qq{ $> eq '0' });
+
+    # don't show start-up info
+    $CPAN::Config->{inhibit_startup_message} = 1;
+
+    # set additional options
+    while (my ($opt, $arg) = splice(@config, 0, 2)) {
+        ($args{$opt} = $arg, next)
+            if $opt =~ /^force$/; # pseudo-option
+        $CPAN::Config->{$opt} = $arg;
+    }
+
+    local $CPAN::Config->{prerequisites_policy} = 'follow';
+
+    while (my ($pkg, $ver) = splice(@modules, 0, 2)) {
+        MY::preinstall($pkg, $ver) or next if defined &MY::preinstall;
+
+        print "*** Installing $pkg...\n";
+
+        my $obj = CPAN::Shell->expand(Module => $pkg);
+        my $success = 0;
+
+        if ($obj and defined(_version_check($obj->cpan_version, $ver))) {
+            my $pathname = $pkg; $pathname =~ s/::/\\W/;
+
+            foreach my $inc (grep { m/$pathname.pm/i } keys(%INC)) {
+                delete $INC{$inc};
+            }
+
+            $obj->force('install') if $args{force};
+
+            my $rv = $obj->install || eval { 
+                $CPAN::META->instance(
+                    'CPAN::Distribution',
+                    $obj->cpan_file,
+                )->{install} if $CPAN::META
+            };
+
+            if ($rv eq 'YES') {
+                print "*** $pkg successfully installed.\n";
+                $success = 1;
+            }
+            else {
+                print "*** $pkg installation failed.\n";
+                $success = 0;
+            }
+
+            $installed += $success;
+        }
+        else {
+            print << ".";
+*** Could not find a version $ver or above for $pkg; skipping.
+.
+        }
+
+        MY::postinstall($pkg, $ver, $success) if defined &MY::postinstall;
+    }
+
+    return $installed;
+}
+
+sub _has_cpanplus {
+    return (
+        $HasCPANPLUS = (
+            $INC{'CPANPLUS/Config.pm'} or
+            _load('CPANPLUS::Shell::Default')
+        )
+    );
+}
+
+# make guesses on whether we're under the CPAN installation directory
+sub _under_cpan {
+    require Cwd;
+    require File::Spec;
+
+    my $cwd  = File::Spec->canonpath(Cwd::cwd());
+    my $cpan = File::Spec->canonpath($CPAN::Config->{cpan_home});
+
+    return (index($cwd, $cpan) > -1);
+}
+
+sub _update_to {
+    my $class = __PACKAGE__;
+    my $ver   = shift;
+
+    return if defined(_version_check(_load($class), $ver)); # no need to upgrade
+
+    if (_prompt(
+        "==> A newer version of $class ($ver) is required. Install?", 'y'
+    ) =~ /^[Nn]/) {
+        die "*** Please install $class $ver manually.\n";
+    }
+
+    print << ".";
+*** Trying to fetch it from CPAN...
+.
+
+    # install ourselves
+    _load($class) and return $class->import(@_)
+        if $class->install([], $class, $ver);
+
+    print << '.'; exit 1;
+
+*** Cannot bootstrap myself. :-( Installation terminated.
+.
+}
+
+# check if we're connected to some host, using inet_aton
+sub _connected_to {
+    my $site = shift;
+
+    return (
+        ( _load('Socket') and Socket::inet_aton($site) ) or _prompt(qq(
+*** Your host cannot resolve the domain name '$site', which
+    probably means the Internet connections are unavailable.
+==> Should we try to install the required module(s) anyway?), 'n'
+        ) =~ /^[Yy]/
+    );
+}
+
+# check if a directory is writable; may create it on demand
+sub _can_write {
+    my $path = shift;
+    mkdir ($path, 0755) unless -e $path;
+
+    return 1 if -w $path;
+
+    print << ".";
+*** You are not allowed to write to the directory '$path';
+    the installation may fail due to insufficient permissions.
+.
+
+    if (eval '$>' and lc(`sudo -V`) =~ /version/ and _prompt(qq(
+==> Should we try to re-execute the autoinstall process with 'sudo'?), 'y'
+    ) =~ /^[Yy]/) {
+        # try to bootstrap ourselves from sudo
+        print << ".";
+*** Trying to re-execute the autoinstall process with 'sudo'...
+.
+        my $missing = join(',', @Missing);
+        my $config  = join(',',
+            UNIVERSAL::isa($Config, 'HASH') ? %{$Config} : @{$Config}
+        ) if $Config;
+
+        return unless system('sudo', $^X, $0, "--config=$config", "--installdeps=$missing");
+
+        print << ".";
+*** The 'sudo' command exited with error!  Resuming...
+.
+    }
+
+    return _prompt(qq(
+==> Should we try to install the required module(s) anyway?), 'n'
+    ) =~ /^[Yy]/
+}
+
+# load a module and return the version it reports
+sub _load {
+    my $mod = pop; # class/instance doesn't matter
+    my $file = $mod;
+
+    $file =~ s|::|/|g;
+    $file .= '.pm';
+
+    local $@;
+    return eval { require $file; $mod->VERSION } || ($@ ? undef : 0);
+}
+
+# compare two versions, either use Sort::Versions or plain comparison
+sub _version_check {
+    my ($cur, $min) = @_;
+    return unless defined $cur;
+
+    $cur =~ s/\s+$//;
+
+    # check for version numbers that are not in decimal format
+    if (ref($cur) or ref($min) or $cur =~ /v|\..*\./ or $min =~ /v|\..*\./) {
+        if ($version::VERSION or defined(_load('version'))) {
+            # use version.pm if it is installed.
+            return ((version->new($cur) >= version->new($min)) ? $cur : undef);
+        }
+        elsif ($Sort::Versions::VERSION or defined(_load('Sort::Versions'))) {
+            # use Sort::Versions as the sorting algorithm for a.b.c versions
+            return ((Sort::Versions::versioncmp($cur, $min) != -1) ? $cur : undef);
+        }
+
+        warn "Cannot reliably compare non-decimal formatted versions.\n".
+             "Please install version.pm or Sort::Versions.\n";
+    }
+
+    # plain comparison
+    local $^W = 0; # shuts off 'not numeric' bugs
+    return ($cur >= $min ? $cur : undef);
+}
+
+# nothing; this usage is deprecated.
+sub main::PREREQ_PM { return {}; }
+
+sub _make_args {
+    my %args = @_;
+
+    $args{PREREQ_PM} = { %{$args{PREREQ_PM} || {} }, @Existing, @Missing }
+        if $UnderCPAN or $TestOnly;
+
+    if ($args{EXE_FILES}) {
+        require ExtUtils::Manifest;
+        my $manifest = ExtUtils::Manifest::maniread('MANIFEST');
+
+        $args{EXE_FILES} = [
+            grep { exists $manifest->{$_} } @{$args{EXE_FILES}}
+        ];
+    }
+
+    $args{test}{TESTS} ||= 't/*.t';
+    $args{test}{TESTS} = join(' ', grep {
+        !exists($DisabledTests{$_})
+    } map { glob($_) } split(/\s+/, $args{test}{TESTS}));
+
+    my $missing = join(',', @Missing);
+    my $config  = join(',',
+        UNIVERSAL::isa($Config, 'HASH') ? %{$Config} : @{$Config}
+    ) if $Config;
+
+    $PostambleActions = (
+        $missing ? "\$(PERL) $0 --config=$config --installdeps=$missing"
+                 : "\@\$(NOOP)"
+    );
+
+    return %args;
+}
+
+# a wrapper to ExtUtils::MakeMaker::WriteMakefile
+sub Write {
+    require Carp;
+    Carp::croak "WriteMakefile: Need even number of args" if @_ % 2;
+
+    if ($CheckOnly) {
+        print << ".";
+*** Makefile not written in check-only mode.
+.
+        return;
+    }
+
+    my %args = _make_args(@_);
+
+    no strict 'refs';
+
+    $PostambleUsed = 0;
+    local *MY::postamble = \&postamble unless defined &MY::postamble;
+    ExtUtils::MakeMaker::WriteMakefile(%args);
+
+    print << "." unless $PostambleUsed;
+*** WARNING: Makefile written with customized MY::postamble() without
+    including contents from ExtUtils::AutoInstall::postamble() --
+    auto installation features disabled.  Please contact the author.
+.
+
+    return 1;
+}
+
+sub postamble {
+    $PostambleUsed = 1;
+
+    return << ".";
+
+config :: installdeps
+\t\@\$(NOOP)
+
+checkdeps ::
+\t\$(PERL) $0 --checkdeps
+
+installdeps ::
+\t$PostambleActions
+
+.
+
+}
+
+1;
+
+__END__
+
+#line 978

Modified: DBIx-SearchBuilder/trunk/inc/Module/Install.pm
==============================================================================
--- DBIx-SearchBuilder/trunk/inc/Module/Install.pm	(original)
+++ DBIx-SearchBuilder/trunk/inc/Module/Install.pm	Wed Nov  2 11:39:05 2005
@@ -1,6 +1,6 @@
-#line 1 "inc/Module/Install.pm - /usr/local/share/perl/5.8.4/Module/Install.pm"
+#line 1 "inc/Module/Install.pm - /usr/local/share/perl/5.8.7/Module/Install.pm"
 package Module::Install;
-$VERSION = '0.36';
+$VERSION = '0.37';
 
 die << "." unless $INC{join('/', inc => split(/::/, __PACKAGE__)).'.pm'};
 Please invoke ${\__PACKAGE__} with:
@@ -21,7 +21,7 @@
 @inc::Module::Install::ISA = 'Module::Install';
 *inc::Module::Install::VERSION = *VERSION;
 
-#line 129
+#line 130
 
 sub import {
     my $class = shift;
@@ -44,7 +44,7 @@
     delete $INC{"$self->{path}.pm"};
 }
 
-#line 156
+#line 157
 
 sub autoload {
     my $self = shift;
@@ -64,7 +64,7 @@
     };
 }
 
-#line 181
+#line 182
 
 sub new {
     my ($class, %args) = @_;
@@ -89,7 +89,7 @@
     bless(\%args, $class);
 }
 
-#line 210
+#line 211
 
 sub call {
     my $self   = shift;
@@ -100,7 +100,7 @@
     goto &{$obj->can($method)};
 }
 
-#line 225
+#line 226
 
 sub load {
     my ($self, $method) = @_;
@@ -124,7 +124,7 @@
     $obj;
 }
 
-#line 255
+#line 256
 
 sub load_extensions {
     my ($self, $path, $top_obj) = @_;
@@ -143,7 +143,7 @@
     }
 }
 
-#line 279
+#line 280
 
 sub find_extensions {
     my ($self, $path) = @_;
@@ -166,4 +166,4 @@
 
 __END__
 
-#line 617
+#line 618

Modified: DBIx-SearchBuilder/trunk/inc/Module/Install/AutoInstall.pm
==============================================================================
--- DBIx-SearchBuilder/trunk/inc/Module/Install/AutoInstall.pm	(original)
+++ DBIx-SearchBuilder/trunk/inc/Module/Install/AutoInstall.pm	Wed Nov  2 11:39:05 2005
@@ -1,4 +1,4 @@
-#line 1 "inc/Module/Install/AutoInstall.pm - /usr/local/share/perl/5.8.4/Module/Install/AutoInstall.pm"
+#line 1 "inc/Module/Install/AutoInstall.pm - /usr/local/share/perl/5.8.7/Module/Install/AutoInstall.pm"
 package Module::Install::AutoInstall;
 use Module::Install::Base; @ISA = qw(Module::Install::Base);
 
@@ -18,20 +18,6 @@
     my $self = shift;
     return if $self->{done}++;
 
-# ExtUtils::AutoInstall Bootstrap Code, version 7.
-AUTO:{my$p='ExtUtils::AutoInstall';my$v=0.49;$p->VERSION||0>=$v
-or+eval"use $p $v;1"or+do{my$e=$ENV{PERL_EXTUTILS_AUTOINSTALL};
-(!defined($e)||$e!~m/--(?:default|skip|testonly)/and-t STDIN or
-eval"use ExtUtils::MakeMaker;WriteMakefile(PREREQ_PM=>{'$p',$v}
-);1"and exit)and print"==> $p $v required. Install it from CP".
-"AN? [Y/n] "and<STDIN>!~/^n/i and print"*** Installing $p\n"and
-do{if (eval '$>' and lc(`sudo -V`) =~ /version/){system('sudo',
-$^X,"-MCPANPLUS","-e","CPANPLUS::install $p");eval"use $p $v;1"
-||system('sudo', $^X, "-MCPAN", "-e", "CPAN::install $p")}eval{
-require CPANPLUS;CPANPLUS::install$p};eval"use $p $v;1"or eval{
-require CPAN;CPAN::install$p};eval"use $p $v;1"||die"*** Please
-manually install $p $v from cpan.org first...\n"}}}
-
     # Flatten array of arrays into a single array
     my @core = map @$_, map @$_, grep ref,
                $self->build_requires, $self->requires;
@@ -40,6 +26,10 @@
         push @core, splice(@_, 0, 2);
     }
 
+    # We'll need ExtUtils::AutoInstall
+    $self->include('ExtUtils::AutoInstall');
+    require ExtUtils::AutoInstall;
+
     ExtUtils::AutoInstall->import(
         (@core ? (-core => \@core) : ()), @_, $self->features
     );

Modified: DBIx-SearchBuilder/trunk/inc/Module/Install/Base.pm
==============================================================================
--- DBIx-SearchBuilder/trunk/inc/Module/Install/Base.pm	(original)
+++ DBIx-SearchBuilder/trunk/inc/Module/Install/Base.pm	Wed Nov  2 11:39:05 2005
@@ -1,4 +1,4 @@
-#line 1 "inc/Module/Install/Base.pm - /usr/local/share/perl/5.8.4/Module/Install/Base.pm"
+#line 1 "inc/Module/Install/Base.pm - /usr/local/share/perl/5.8.7/Module/Install/Base.pm"
 package Module::Install::Base;
 
 #line 28

Added: DBIx-SearchBuilder/trunk/inc/Module/Install/Include.pm
==============================================================================
--- (empty file)
+++ DBIx-SearchBuilder/trunk/inc/Module/Install/Include.pm	Wed Nov  2 11:39:05 2005
@@ -0,0 +1,10 @@
+#line 1 "inc/Module/Install/Include.pm - /usr/local/share/perl/5.8.7/Module/Install/Include.pm"
+package Module::Install::Include;
+use Module::Install::Base; @ISA = qw(Module::Install::Base);
+
+sub include { +shift->admin->include(@_) };
+sub include_deps { +shift->admin->include_deps(@_) };
+sub auto_include { +shift->admin->auto_include(@_) };
+sub auto_include_deps { +shift->admin->auto_include_deps(@_) };
+
+1;

Modified: DBIx-SearchBuilder/trunk/inc/Module/Install/Makefile.pm
==============================================================================
--- DBIx-SearchBuilder/trunk/inc/Module/Install/Makefile.pm	(original)
+++ DBIx-SearchBuilder/trunk/inc/Module/Install/Makefile.pm	Wed Nov  2 11:39:05 2005
@@ -1,4 +1,4 @@
-#line 1 "inc/Module/Install/Makefile.pm - /usr/local/share/perl/5.8.4/Module/Install/Makefile.pm"
+#line 1 "inc/Module/Install/Makefile.pm - /usr/local/share/perl/5.8.7/Module/Install/Makefile.pm"
 package Module::Install::Makefile;
 use Module::Install::Base; @ISA = qw(Module::Install::Base);
 
@@ -53,6 +53,7 @@
     $args->{NAME} = $self->module_name || $self->name || $self->determine_NAME($args);
     $args->{VERSION} = $self->version || $self->determine_VERSION($args);
     $args->{NAME} =~ s/-/::/g;
+    $args->{test} = {TESTS => $self->tests};
 
     if ($] >= 5.005) {
 	$args->{ABSTRACT} = $self->abstract;
@@ -140,4 +141,4 @@
 
 __END__
 
-#line 273
+#line 274

Modified: DBIx-SearchBuilder/trunk/inc/Module/Install/Metadata.pm
==============================================================================
--- DBIx-SearchBuilder/trunk/inc/Module/Install/Metadata.pm	(original)
+++ DBIx-SearchBuilder/trunk/inc/Module/Install/Metadata.pm	Wed Nov  2 11:39:05 2005
@@ -1,4 +1,4 @@
-#line 1 "inc/Module/Install/Metadata.pm - /usr/local/share/perl/5.8.4/Module/Install/Metadata.pm"
+#line 1 "inc/Module/Install/Metadata.pm - /usr/local/share/perl/5.8.7/Module/Install/Metadata.pm"
 package Module::Install::Metadata;
 use Module::Install::Base; @ISA = qw(Module::Install::Base);
 
@@ -11,7 +11,7 @@
 
 my @scalar_keys = qw(
     name module_name version abstract author license
-    distribution_type sign perl_version
+    distribution_type sign perl_version tests
 );
 my @tuple_keys  = qw(build_requires requires recommends bundles);
 


More information about the Rt-commit mailing list