Skip to content

Commit

Permalink
Use a regex instead of Module::Info to scan for packages
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.perl.org/modules/Module-Build/trunk@4242 50811bd7-b8ce-0310-adc1-d9db26280581
  • Loading branch information
kenahoo committed Jul 7, 2003
1 parent c8e7214 commit 7b236f7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
1 change: 0 additions & 1 deletion Build.PL
Expand Up @@ -31,7 +31,6 @@ my $build = new Module::Build
'Archive::Tar' => '1.00',
'ExtUtils::Install' => 0.30,
'ExtUtils::ParseXS' => 2.02,
'Module::Info' => 0,
# Module::Signature => 0.21, # Our support isn't good enough yet
},
build_requires => {
Expand Down
27 changes: 15 additions & 12 deletions lib/Module/Build/Base.pm
Expand Up @@ -1370,25 +1370,28 @@ sub find_dist_packages {
foreach my $file (@pm_files) {
next if $file =~ m{^t/}; # Skip things in t/

return unless $] >= 5.006; # perl 5.6 required for Module::Info
return unless eval "use Module::Info 0.19; 1";

my $localfile = File::Spec->catfile( split m{/}, $file );
my $version = $self->version_from_file( $localfile );

print "Scanning $localfile for packages\n";
my $module = Module::Info->new_from_file( $localfile );

foreach my $package ($module->packages_inside) {
$out{$package} = {
file => $file,
version => $version,
};

foreach my $package ($self->_packages_inside($localfile)) {
$out{$package}{file} = $file;
$out{$package}{version} = $version if defined $version;
}
}
return \%out;
}

sub _packages_inside {
# XXX this SUCKS SUCKS SUCKS! Damn you perl!
my ($self, $file) = @_;
my $fh = IO::File->new($file) or die "Can't read $file: $!";
my @packages;
while (defined(my $line = <$fh>)) {
push @packages, $1 if $line =~ /^[\s\{;]*package\s+([\w:]+)/;
}
return @packages;
}

sub make_tarball {
my ($self, $dir) = @_;

Expand Down

0 comments on commit 7b236f7

Please sign in to comment.