Author: dagolden
Date: Mon Oct 5 04:36:42 2009
New Revision: 13376
Modified:
Module-Build/branches/inc-bundling/lib/inc/latest.pm
Log:
added module pre-load feature to write(); eliminated DATA section
Modified: Module-Build/branches/inc-bundling/lib/inc/latest.pm
==============================================================================
--- Module-Build/branches/inc-bundling/lib/inc/latest.pm (original)
+++ Module-Build/branches/inc-bundling/lib/inc/latest.pm Mon Oct 5
04:36:42 2009
@@ -41,7 +41,7 @@
sub write {
my $package = shift;
- my ($where) = @_;
+ my ($where, @preload) = @_;
warn "should really be writing in inc/" unless $where =~ /inc$/;
@@ -49,7 +49,20 @@
File::Path::mkpath( $where );
my $fh = IO::File->new( File::Spec->catfile($where,'latest.pm'), "w" );
print {$fh} "# This stub created by inc::latest $VERSION\n";
- print {$fh} do {local $/; <DATA>};
+ print {$fh} <<'HERE';
+package inc::latest;
+use strict;
+use vars '@ISA';
+require inc::latest::private;
+...@isa = qw/inc::latest::private/;
+HERE
+ if (@preload) {
+ print {$fh} "\npackage inc::latest::preload;\n";
+ for my $mod (@preload) {
+ print {$fh} "inc::latest->import('$mod');\n";
+ }
+ }
+ print {$fh} "\n1;\n";
close $fh;
# write inc/latest/private;
@@ -230,11 +243,3 @@
=cut
-__DATA__
-package inc::latest;
-use strict;
-use vars '@ISA';
-require inc::latest::private;
-...@isa = qw/inc::latest::private/;
-1;
-