Load XML-Feed-0.08 into trunk.
[catagits/XML-Feed.git] / inc / Module / Install / Makefile.pm
index e2f7e39..c2cb32a 100644 (file)
@@ -1,17 +1,19 @@
-#line 1 "inc/Module/Install/Makefile.pm - /Library/Perl/5.8.1/Module/Install/Makefile.pm"
+#line 1 "inc/Module/Install/Makefile.pm - /Library/Perl/5.8.6/Module/Install/Makefile.pm"
 package Module::Install::Makefile;
-use Module::Install::Base; @ISA = qw(Module::Install::Base);
-
-$VERSION = '0.01';
 
 use strict 'vars';
-use vars '$VERSION';
-
+use Module::Install::Base;
 use ExtUtils::MakeMaker ();
 
+use vars qw{$VERSION @ISA};
+BEGIN {
+       $VERSION = '0.57';
+       @ISA     = qw{Module::Install::Base};
+}
+
 sub Makefile { $_[0] }
 
-sub prompt { 
+sub prompt {
     shift;
     goto &ExtUtils::MakeMaker::prompt;
 }
@@ -23,18 +25,37 @@ sub makemaker_args {
     $args;
 }
 
-sub clean_files {
+# 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( ' ', @_ );
+}
+
+sub build_subdirs {
+    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}, @_),
+        FILES => join(' ', grep length, $clean->{FILES}, @_),
     );
 }
 
 sub libs {
     my $self = shift;
-    my $libs = ref $_[0] ? shift : [shift];
+    my $libs = ref $_[0] ? shift : [ shift ];
     $self->makemaker_args( LIBS => $libs );
 }
 
@@ -54,15 +75,17 @@ sub write {
     $args->{VERSION} = $self->version || $self->determine_VERSION($args);
     $args->{NAME} =~ s/-/::/g;
 
+    $args->{test} = {TESTS => $self->tests} if $self->tests;
+
     if ($] >= 5.005) {
-       $args->{ABSTRACT} = $self->abstract;
-       $args->{AUTHOR} = $self->author;
+        $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 ) {
-       $args->{SIGN} = 1 if $self->sign;
+        $args->{SIGN} = 1 if $self->sign;
     }
     delete $args->{SIGN} unless $self->is_admin;
 
@@ -72,10 +95,13 @@ sub write {
                  ($self->build_requires, $self->requires) );
 
     # merge both kinds of requires into prereq_pm
-    my $dir = ($args->{DIR} ||= []);
+    my $subdirs = ($args->{DIR} ||= []);
     if ($self->bundles) {
-        push @$dir, map "$_->[1]", @{$self->bundles};
-        delete $prereq->{$_->[0]} for @{$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) {
@@ -106,9 +132,10 @@ sub fix_up_makefile {
     my $postamble = "# Postamble by $top_class $top_version\n" . 
                     ($self->postamble || '');
 
+    local *MAKEFILE;
     open MAKEFILE, '< Makefile' or die $!;
     my $makefile = do { local $/; <MAKEFILE> };
-    close MAKEFILE;
+    close MAKEFILE or die $!;
 
     $makefile =~ s/\b(test_harness\(\$\(TEST_VERBOSE\), )/$1'inc', /;
     $makefile =~ s/( -I\$\(INST_ARCHLIB\))/ -Iinc$1/g;
@@ -118,8 +145,10 @@ sub fix_up_makefile {
     $makefile =~ s/^(PERL = .*)/$1 -Iinc/m;
 
     open MAKEFILE, '> Makefile' or die $!;
-    print MAKEFILE "$preamble$makefile$postamble";
-    close MAKEFILE;
+    print MAKEFILE "$preamble$makefile$postamble" or die $!;
+    close MAKEFILE or die $!;
+
+    1;
 }
 
 sub preamble {
@@ -130,7 +159,6 @@ sub preamble {
 
 sub postamble {
     my ($self, $text) = @_;
-
     $self->{postamble} ||= $self->admin->postamble;
     $self->{postamble} .= $text if defined $text;
     $self->{postamble}
@@ -140,4 +168,4 @@ sub postamble {
 
 __END__
 
-#line 273
+#line 295