Ben Morrow wrote:
Quoth [email protected] (Ch Lamprecht):
there is a bug in Module::ScanDeps which causes {type} to be set to 'data'
instead of 'autoload' in some cases - and changing if the same file is scanned
more than once.
I attach a patch to fix this and a testfile. With the patch *.bs files are
always reported as 'autoload' - is that correct?
Probably not. The .bs files are not part of the AutoLoader mechanism,
they are run by DynaLoader when loading a .so. I would say they should
be 'share', but possibly they should be 'data'. Things like
Config_heavy.pl are 'data', and these .bs files are the same sort of
thing.
Thanks Ben,
I made it return 'data' now because it seems that this is what it was intended
to return in the past. The bug was caused by a lexical declaration in
combination with a conditional statement modifier inside a loop. Unless anybody
has objections I'd commit this.
Cheers, Christoph
--- C:\DOKUME~1\chris\LOKALE~1\Temp\ScanDeps.pm-revBASE.svn000.tmp.pm Mi Jul
1 22:32:08 2009
+++ C:\Dokumente und Einstellungen\chris\Desktop\MSD\lib\Module\ScanDeps.pm
Mi Jul 1 22:22:44 2009
@@ -1,5 +1,4 @@
package Module::ScanDeps;
-
use 5.006;
use strict;
use vars qw( $VERSION @EXPORT @EXPORT_OK @ISA $CurrentPackage @IncludeLibs
$ScanFileRE );
@@ -518,8 +517,7 @@
next;
}
- $type = 'module';
- $type = 'data' unless $input_file =~ /\.p[mh]$/io;
+ $type = _gettype($input_file);
$path = $input_file;
if ($type eq 'module') {
# necessary because add_deps does the search for shared libraries
and such
@@ -883,7 +881,6 @@
}
}
}
-
$rv->{$module} ||= {
file => $file,
key => $module,
@@ -925,8 +922,7 @@
next;
}
- my $type = 'module';
- $type = 'data' unless $file =~ /\.p[mh]$/i;
+ my $type = _gettype($file);
_add_info( rv => $rv, module => $module,
file => $file, used_by => $used_by,
type => $type );
@@ -937,12 +933,12 @@
foreach (_glob_in_inc("auto/$path")) {
next if $_->{file} =~ m{\bauto/$path/.*/}; # weed out subdirs
next if $_->{name} =~ m/(?:^|\/)\.(?:exists|packlist)$/;
- my $ext = lc($1) if $_->{name} =~ /(\.[^.]+)$/;
+ my ($ext,$type);
+ $ext = lc($1) if $_->{name} =~ /(\.[^.]+)$/;
next if $ext eq lc(lib_ext());
- my $type = 'shared' if $ext eq lc(dl_ext());
- $type = 'autoload' if $ext eq '.ix' or $ext eq '.al';
+ $type = 'shared' if $ext eq lc(dl_ext());
+ $type = 'autoload' if ($ext eq '.ix' or $ext eq '.al');
$type ||= 'data';
-
_add_info( rv => $rv, module =>
"auto/$path/$_->{name}",
file => $_->{file}, used_by => $module,
type => $type );
@@ -1202,7 +1198,7 @@
my $name = shift;
my $dlext = quotemeta(dl_ext());
- return 'autoload' if $name =~ /(?:\.ix|\.al|\.bs)$/i;
+ return 'autoload' if $name =~ /(?:\.ix|\.al)$/i;
return 'module' if $name =~ /\.p[mh]$/i;
return 'shared' if $name =~ /\.$dlext$/i;
return 'data';