[Rt-commit] r4058 - in Jifty-DBI/trunk: . inc/ExtUtils inc/Module/Install

jesse at bestpractical.com jesse at bestpractical.com
Tue Nov 8 16:34:33 EST 2005


Author: jesse
Date: Tue Nov  8 16:34:30 2005
New Revision: 4058

Added:
   Jifty-DBI/trunk/inc/ExtUtils/
   Jifty-DBI/trunk/inc/ExtUtils/AutoInstall.pm
   Jifty-DBI/trunk/inc/Module/Install/Can.pm
   Jifty-DBI/trunk/inc/Module/Install/Fetch.pm
   Jifty-DBI/trunk/inc/Module/Install/Include.pm
   Jifty-DBI/trunk/inc/Module/Install/Win32.pm
   Jifty-DBI/trunk/inc/Module/Install/WriteAll.pm
Modified:
   Jifty-DBI/trunk/   (props changed)
   Jifty-DBI/trunk/MANIFEST
   Jifty-DBI/trunk/SIGNATURE
Log:
 r18588 at truegrounds:  jesse | 2005-11-08 16:32:12 -0500
 * released 0.05_01


Modified: Jifty-DBI/trunk/MANIFEST
==============================================================================
--- Jifty-DBI/trunk/MANIFEST	(original)
+++ Jifty-DBI/trunk/MANIFEST	Tue Nov  8 16:34:30 2005
@@ -1,14 +1,30 @@
 Changes
+doc/notes/on_intuitive_schema_definitions
 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/Can.pm
+inc/Module/Install/Fetch.pm
+inc/Module/Install/Include.pm
 inc/Module/Install/Makefile.pm
 inc/Module/Install/Metadata.pm
+inc/Module/Install/Win32.pm
+inc/Module/Install/WriteAll.pm
 lib/Jifty/DBI.pm
 lib/Jifty/DBI/Collection.pm
+lib/Jifty/DBI/Collection/Union.pm
+lib/Jifty/DBI/Collection/Unique.pm
+lib/Jifty/DBI/Column.pm
+lib/Jifty/DBI/Filter.pm
+lib/Jifty/DBI/Filter/base64.pm
+lib/Jifty/DBI/Filter/DateTime.pm
+lib/Jifty/DBI/Filter/JiftyRecord.pm
+lib/Jifty/DBI/Filter/Truncate.pm
+lib/Jifty/DBI/Filter/utf8.pm
 lib/Jifty/DBI/Handle.pm
 lib/Jifty/DBI/Handle/Informix.pm
 lib/Jifty/DBI/Handle/mysql.pm
@@ -18,15 +34,15 @@
 lib/Jifty/DBI/Handle/Pg.pm
 lib/Jifty/DBI/Handle/SQLite.pm
 lib/Jifty/DBI/Handle/Sybase.pm
+lib/Jifty/DBI/HasFilters.pm
 lib/Jifty/DBI/Record.pm
 lib/Jifty/DBI/Record/Cachable.pm
+lib/Jifty/DBI/Schema.pm
 lib/Jifty/DBI/SchemaGenerator.pm
-lib/Jifty/DBI/Union.pm
-lib/Jifty/DBI/Unique.pm
-lib/Jifty/DBI/Column.pm
 Makefile.PL
 MANIFEST			This list of files
 META.yml
+pm_to_blib
 README
 ROADMAP
 SIGNATURE
@@ -36,6 +52,10 @@
 t/01searches.t
 t/02records_object.t
 t/03rebless.t
+t/06filter.t
+t/06filter_datetime.t
+t/06filter_truncate.t
+t/06filter_utf8.t
 t/10schema.t
 t/11schema_records.t
 t/pod.t

Modified: Jifty-DBI/trunk/SIGNATURE
==============================================================================
--- Jifty-DBI/trunk/SIGNATURE	(original)
+++ Jifty-DBI/trunk/SIGNATURE	Tue Nov  8 16:34:30 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,51 +14,72 @@
 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1
 
-SHA1 8e8a505afe88ea427c23ce5f1c948ff250e23a51 Changes
-SHA1 cc97ebd4a76d96cf13c439a3317522cd6d6a5aa9 MANIFEST
-SHA1 9a5d8e8beb344a9ea970124b0875a2ef0d74e3df META.yml
-SHA1 87ad5facaf7f56d0fb0db4e4e200a32b1feafb14 Makefile.PL
-SHA1 d7a41642c368f2a587587e09f9e815d434feebff README
-SHA1 577f45aff6753d42f43b794745175ce001af950f SearchBuilder.pm
-SHA1 aab8beb921d655433f1bfbefa18ba961ddac1888 SearchBuilder/Handle.pm
-SHA1 0103d897704a95032b32363dc65ea4f0d8f5965d SearchBuilder/Handle/Informix.pm
-SHA1 861cee4205d1f367af5cc68b561fd37e38c1acf0 SearchBuilder/Handle/ODBC.pm
-SHA1 6f798ff065f28239767230fcd8c9330dae4eafa7 SearchBuilder/Handle/Oracle.pm
-SHA1 bd0be64d5ce723cdc6323cc8c8b2265f58a959f9 SearchBuilder/Handle/Pg.pm
-SHA1 9f4aee2b7566bd30b0a35afe53aa7abf5196bc59 SearchBuilder/Handle/SQLite.pm
-SHA1 aec168c75ba6a33e3e5ac85cbefd2e2d7c036696 SearchBuilder/Handle/Sybase.pm
-SHA1 6399c19c7600c01f75e187facb1c01b2611b95df SearchBuilder/Handle/mysql.pm
-SHA1 f4f6ea88631e6310243b6351e8df11e1ec88b261 SearchBuilder/Handle/mysqlPP.pm
-SHA1 8d3c495adef829aee17100de02d92504c9a687ec SearchBuilder/Record.pm
-SHA1 dd4752f1b3a917de3823ddec20331e3c3d05e227 SearchBuilder/Record/Cachable.pm
-SHA1 3c98e03de0a6564fe6b864be8cb5183f2dce8196 SearchBuilder/SchemaGenerator.pm
-SHA1 446f59a1fa8fa631c908f1fe3ea671c7178c9270 SearchBuilder/Union.pm
-SHA1 1eb4e838ff1d8d927bfe177bf578df246802b03d SearchBuilder/Unique.pm
-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 ecc9992028e132adcb299454fbda4738ec4ee8b5 Changes
+SHA1 6c32c8ee37ec50dd6af63c58df45fb93e312c56a MANIFEST
+SHA1 bbfe94f678c5d68f391487295349d3167e546e69 META.yml
+SHA1 183f124d9b6ff045e1f5a88456287e1fe27a058e Makefile.PL
+SHA1 d0943ab047f543c92405564ab77ba008052544e6 README
+SHA1 82d6ac3f6def48558d09f8b6e3b53ed4194d8c81 ROADMAP
+SHA1 34189c5199fc6598c571149bb377ce2f78320abc doc/notes/on_intuitive_schema_definitions
+SHA1 584c0f6cdebcbf760dfca8413c94783586120214 ex/Example/Model/Address.pm
+SHA1 7cea1a5289f79c2a87837924a83feb583f6e8890 ex/Example/Model/Employee.pm
+SHA1 b13f61b844d906ac68be669141b1da722b4c96e7 ex/create_tables.pl
+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 0d0b6772bd5ec750e99d238942c88329e394d48d inc/Module/Install/Can.pm
+SHA1 a784ba7d2b096084b2ffed3a7d853e2847f4dedb inc/Module/Install/Fetch.pm
+SHA1 48cc63c52aa29d54f68f8c8cf7c0a72f7bde9ea0 inc/Module/Install/Include.pm
+SHA1 dc2af04175831ddb9a00de944e761e5c46bbf283 inc/Module/Install/Makefile.pm
+SHA1 421da5922ad85b72ae5b27c33803e86b3762d238 inc/Module/Install/Metadata.pm
+SHA1 2a1b494a7e5adaa3216e86d909dd5bf87d084c80 inc/Module/Install/Win32.pm
+SHA1 c92e1d32922615347e059e7e3a2f53b5e9c98e3b inc/Module/Install/WriteAll.pm
+SHA1 a2536f852fabaebcc270b07edcb27b00398eaa36 lib/Jifty/DBI.pm
+SHA1 ffd94e893773a8d645f49549913ae9023f4a0f98 lib/Jifty/DBI/Collection.pm
+SHA1 ecfae7430da875a856113e0c233daa0e31073000 lib/Jifty/DBI/Collection/Union.pm
+SHA1 853303d187396a3b4bfa1189b9da55f9b1d3c21d lib/Jifty/DBI/Collection/Unique.pm
+SHA1 8ff8dca8e73b0454cf94a06693f6b305f8f79e44 lib/Jifty/DBI/Column.pm
+SHA1 7e4e53fd7534af74b166c1682616cd00249e773e lib/Jifty/DBI/Filter.pm
+SHA1 0304e4a9d5133b7874641961c465b2092d285d0b lib/Jifty/DBI/Filter/DateTime.pm
+SHA1 da39a3ee5e6b4b0d3255bfef95601890afd80709 lib/Jifty/DBI/Filter/JiftyRecord.pm
+SHA1 c2d045ebcd85e6eb23c904e95078fc6378a2169b lib/Jifty/DBI/Filter/Truncate.pm
+SHA1 da39a3ee5e6b4b0d3255bfef95601890afd80709 lib/Jifty/DBI/Filter/base64.pm
+SHA1 3d913972057b66668bd00f27aaaa30942472cc3f lib/Jifty/DBI/Filter/utf8.pm
+SHA1 dbecc1162dda86e10b6aebdfa03d900c471f9d03 lib/Jifty/DBI/Handle.pm
+SHA1 0da066d810d2665364613d1ab565ec5713df9cf6 lib/Jifty/DBI/Handle/Informix.pm
+SHA1 eef1b18d3bcd997ff8b0a336fa5b9b281a3e27a3 lib/Jifty/DBI/Handle/ODBC.pm
+SHA1 743fef255886b61be6dbbdfddaf7d9768e964405 lib/Jifty/DBI/Handle/Oracle.pm
+SHA1 d007c0977b8f2ffada9a7147fd36e816cc5fd844 lib/Jifty/DBI/Handle/Pg.pm
+SHA1 fc81d24327c7129ea1cbf23394e092c11d22286d lib/Jifty/DBI/Handle/SQLite.pm
+SHA1 afcc0bdb7375bfbc080291e4b10831bf2f9a29e0 lib/Jifty/DBI/Handle/Sybase.pm
+SHA1 e6041a34c3044ed8b9691a5629ecf146fed95257 lib/Jifty/DBI/Handle/mysql.pm
+SHA1 f2cc4fcce79c9a88a023d4e6bd96c2089eef1ced lib/Jifty/DBI/Handle/mysqlPP.pm
+SHA1 e1f3f71be76647b8a93ce5d00c988c25bb435e5a lib/Jifty/DBI/HasFilters.pm
+SHA1 38b3d46f6e41144404b926d78bcf2c8f5689bca4 lib/Jifty/DBI/Record.pm
+SHA1 9397039da88949592dbbd28ac2bb274d457d2ebd lib/Jifty/DBI/Record/Cachable.pm
+SHA1 522ffb43e205d4dd5fa8531de9a1e1453753bd07 lib/Jifty/DBI/Schema.pm
+SHA1 6491200e57ced14679063b53d23a58c6b91e6b00 lib/Jifty/DBI/SchemaGenerator.pm
 SHA1 da39a3ee5e6b4b0d3255bfef95601890afd80709 pm_to_blib
-SHA1 e59ea21b9407644714a5f67c7132a11916c25133 t/00.load.t
-SHA1 a7ed1ee359ebe2842b354b5652a441403e802080 t/01basics.t
-SHA1 2b2dc6f72370f60e1d233f2f8c12bb87414e825c t/01nocap_api.t
-SHA1 0b41cb395ef2894ccfbb9facd46d8667af7995fc t/01records.t
-SHA1 4b1629583ac403c1dae7a56905ba27ce95be0249 t/01searches.t
-SHA1 18c721a5d0710b2e610f28eac705d8fb6e6dd8d7 t/02records_object.t
-SHA1 a1808be8dd28bd176ae0243876de36691afefefb t/03rebless.t
-SHA1 0e491643b0e344ea80e4bdb1c6e4b8327fa91915 t/10schema.t
-SHA1 56dc809450f969d0b2f624b6e11f0b7fe3d13113 t/11schema_records.t
+SHA1 18438268d2b91828b01098507184437fd06add10 t/00.load.t
+SHA1 4b4e1d9300737f48e819ee67e59c06910d0c2bd4 t/01basics.t
+SHA1 c6617ee68d0d1a97686fa93ff8a9d27e1ab9c353 t/01records.t
+SHA1 e9b81f442eec472731613b597df08d0a72254d2c t/01searches.t
+SHA1 1e0d5de52ce88e60b39be9fe47062f0605cc12f5 t/02records_object.t
+SHA1 047e0e404693918b05becb6549af605697d2450c t/03rebless.t
+SHA1 05bd6316e56823df2786bebe539986472f289532 t/06filter.t
+SHA1 d950e0dab238b6128d4fc483321bc52b64efa1a5 t/06filter_datetime.t
+SHA1 0588c1a31ac8d47e11303cb694ae6254e64de2da t/06filter_truncate.t
+SHA1 895318b3b717d4868b72e0aa29b2adcc3554d50e t/06filter_utf8.t
+SHA1 e95f70ce6feba4c6dff8c6ed0206d657c7bfe134 t/10schema.t
+SHA1 4daaf29bb0a22c31bd2a5ec1e0f7bb52a086b120 t/11schema_records.t
 SHA1 e9c6a5881fc60173fbc8d479c1afd2ce3b43bef1 t/pod.t
-SHA1 c26d6927a84e35ee107984f494bf1c8bbfbb55c1 t/testmodels.pl
-SHA1 4788496012998da32d01aef7e74d2070931290e0 t/utils.pl
+SHA1 4d2fafe84ee36c962f418d4ad856d365436a0d6b t/testmodels.pl
+SHA1 e5428d52c38833da883fc0407581264fe31c66a8 t/utils.pl
 -----BEGIN PGP SIGNATURE-----
-Version: GnuPG v1.4.0 (GNU/Linux)
+Version: GnuPG v1.4.1 (GNU/Linux)
 
-iD8DBQFCp9bOEi9d9xCOQEYRAinIAJwJtA0cqIIy2uRmQ0FJWLbsGTrrHACgjH+T
-hsQf/j7k2YL/5ZAaTfTtTlc=
-=Z6fg
+iD8DBQFDcRjyEi9d9xCOQEYRAlTMAKC84Q2LjnLKcZMhAPt5FagyhInH/gCgslef
+1DQECmNQRUAH/UXbUxW27qc=
+=JgmR
 -----END PGP SIGNATURE-----

Added: Jifty-DBI/trunk/inc/ExtUtils/AutoInstall.pm
==============================================================================
--- (empty file)
+++ Jifty-DBI/trunk/inc/ExtUtils/AutoInstall.pm	Tue Nov  8 16:34:30 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

Added: Jifty-DBI/trunk/inc/Module/Install/Can.pm
==============================================================================
--- (empty file)
+++ Jifty-DBI/trunk/inc/Module/Install/Can.pm	Tue Nov  8 16:34:30 2005
@@ -0,0 +1,38 @@
+#line 1 "inc/Module/Install/Can.pm - /usr/local/share/perl/5.8.7/Module/Install/Can.pm"
+package Module::Install::Can;
+use Module::Install::Base; @ISA = qw(Module::Install::Base);
+$VERSION = '0.01';
+
+use strict;
+use Config ();
+use File::Spec ();
+use ExtUtils::MakeMaker ();
+
+# 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;
+}
+
+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;
+}
+
+1;

Added: Jifty-DBI/trunk/inc/Module/Install/Fetch.pm
==============================================================================
--- (empty file)
+++ Jifty-DBI/trunk/inc/Module/Install/Fetch.pm	Tue Nov  8 16:34:30 2005
@@ -0,0 +1,86 @@
+#line 1 "inc/Module/Install/Fetch.pm - /usr/local/share/perl/5.8.7/Module/Install/Fetch.pm"
+package Module::Install::Fetch;
+use Module::Install::Base; @ISA = qw(Module::Install::Base);
+
+$VERSION = '0.01';
+
+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/, << ".");
+open $host
+user anonymous anonymous\@example.com
+cd $path
+binary
+get $file $file
+quit
+.
+        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;

Added: Jifty-DBI/trunk/inc/Module/Install/Include.pm
==============================================================================
--- (empty file)
+++ Jifty-DBI/trunk/inc/Module/Install/Include.pm	Tue Nov  8 16:34:30 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;

Added: Jifty-DBI/trunk/inc/Module/Install/Win32.pm
==============================================================================
--- (empty file)
+++ Jifty-DBI/trunk/inc/Module/Install/Win32.pm	Tue Nov  8 16:34:30 2005
@@ -0,0 +1,63 @@
+#line 1 "inc/Module/Install/Win32.pm - /usr/local/share/perl/5.8.7/Module/Install/Win32.pm"
+package Module::Install::Win32;
+use Module::Install::Base; @ISA = qw(Module::Install::Base);
+
+$VERSION = '0.02';
+
+use strict;
+
+# 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 (
+        $Config::Config{make}                   and
+        $Config::Config{make} =~ /^nmake\b/i    and
+        $^O eq 'MSWin32'                        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 << '.';
+
+-------------------------------------------------------------------------------
+
+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.
+
+-------------------------------------------------------------------------------
+.
+    }
+}
+
+1;
+
+__END__
+

Added: Jifty-DBI/trunk/inc/Module/Install/WriteAll.pm
==============================================================================
--- (empty file)
+++ Jifty-DBI/trunk/inc/Module/Install/WriteAll.pm	Tue Nov  8 16:34:30 2005
@@ -0,0 +1,36 @@
+#line 1 "inc/Module/Install/WriteAll.pm - /usr/local/share/perl/5.8.7/Module/Install/WriteAll.pm"
+package Module::Install::WriteAll;
+use Module::Install::Base; @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};
+        $self->makemaker_args( PL_FILES => {} )
+            unless $self->makemaker_args->{'PL_FILES'};
+
+        if ($args{inline}) {
+            $self->Inline->write;
+        }
+        else {
+            $self->Makefile->write;
+        }
+    }
+}
+
+1;


More information about the Rt-commit mailing list