Subject: | patch suggestions for Module::ScanDeps 1.04: additional preload rules, used_via_preload attribute |
Date: | Mon, 8 Aug 2011 15:12:40 +0200 |
To: | "bug-Module-ScanDeps [...] rt.cpan.org" <bug-Module-ScanDeps [...] rt.cpan.org> |
From: | Markus Jansen <markus.jansen [...] ericsson.com> |
Hi Roderich, Steffen, and others,
below you find a "-c" diff listing with 2 suggested patches for Module::ScanDeps 1.04.
First, I have found a number of preload rule refinements.
Second, I have added a "used_via_preload" attributed, which greatly helps scrutinizing whether excluding a module
(and implicitly its potentitial dependencies) is safe or not.
Please consider applying the additions (or a refactored version :-) into the next version.
Best regards,
Markus
diff -c /vobs/cc/CCA-perl01/perl5____________________sixtyfive_char_path/prod/lib/site_perl/5.10.1/Module/ScanDeps.pm@@/main/CCA_perl01_perl5_SunOS_sparc_integration/LATEST perl5/Module/ScanDeps.pm
*** /vobs/cc/CCA-perl01/perl5____________________sixtyfive_char_path/prod/lib/site_perl/5.10.1/Module/ScanDeps.pm@@/main/CCA_perl01_perl5_SunOS_sparc_integration/LATEST Thu Jul 21 10:55:14 2011
--- perl5/Module/ScanDeps.pm Mon Aug 8 14:37:22 2011
***************
*** 275,280 ****
--- 275,281 ----
_glob_in_inc('Date/Manip/Offset', 1));
},
'DateTime/Locale.pm' => 'sub',
+ 'DateTime/TimeZone.pm' => 'sub',
'DBI.pm' => sub {
grep !/\bProxy\b/, _glob_in_inc('DBD', 1);
},
***************
*** 354,364 ****
--- 355,375 ----
'Module/Pluggable.pm' => sub {
_glob_in_inc('$CurrentPackage/Plugin', 1);
},
+ 'Moose.pm' => sub {
+ _glob_in_inc('Moose', 1),
+ _glob_in_inc('Class/MOP', 1),
+ },
+ 'MooseX/AttributeHelpers.pm' => 'sub',
+ 'MooseX/POE.pm' => sub {
+ _glob_in_inc('MooseX/POE', 1),
+ _glob_in_inc('MooseX/Async', 1),
+ },
'MIME/Decoder.pm' => 'sub',
'Net/DNS/RR.pm' => 'sub',
'Net/FTP.pm' => 'sub',
'Net/Server.pm' => 'sub',
'Net/SSH/Perl.pm' => 'sub',
+ 'Package/Stash.pm' => 'sub',
'PAR/Repository.pm' => 'sub',
'PAR/Repository/Client.pm' => 'sub',
'Perl/Critic.pm' => 'sub', #not only Perl/Critic/Policy
***************
*** 370,375 ****
--- 381,391 ----
'POE.pm' => [ qw(
POE/Kernel.pm POE/Session.pm
) ],
+ 'POE/Component/Client/HTTP.pm' => sub {
+ _glob_in_inc('POE/Compoenent/Client/HTTP', 1),
+ 'POE/Filter/HTTPChunk.pm',
+ 'POE/Filter/HTTPHead.pm',
+ },
'POE/Kernel.pm' => sub {
_glob_in_inc('POE/XS/Resource', 1),
_glob_in_inc('POE/Resource', 1),
***************
*** 393,400 ****
termios.ph asm/termios.ph sys/termiox.ph sys/termios.ph sys/ttycom.ph
) ],
'SOAP/Lite.pm' => sub {
! (($] >= 5.008 ? ('utf8.pm') : ()), _glob_in_inc('SOAP/Transport', 1));
},
'SQL/Parser.pm' => sub {
_glob_in_inc('SQL/Dialects', 1);
},
--- 409,419 ----
termios.ph asm/termios.ph sys/termiox.ph sys/termios.ph sys/ttycom.ph
) ],
'SOAP/Lite.pm' => sub {
! (($] >= 5.008 ? ('utf8.pm') : ()),
! _glob_in_inc('SOAP/Lite/Deserializer', 1),
! _glob_in_inc('SOAP/Transport', 1));
},
+ 'Socket/GetAddrInfo.pm' => 'sub',
'SQL/Parser.pm' => sub {
_glob_in_inc('SQL/Dialects', 1);
},
***************
*** 649,659 ****
my $preload = _get_preload($pm) or next;
add_deps(
! used_by => $key,
rv => $args->{rv},
modules => $preload,
skip => $args->{skip},
warn_missing => $args->{warn_missing},
);
}
}
--- 668,679 ----
my $preload = _get_preload($pm) or next;
add_deps(
! used_by => $pm,
rv => $args->{rv},
modules => $preload,
skip => $args->{skip},
warn_missing => $args->{warn_missing},
+ used_via_preload => 1,
);
}
}
***************
*** 949,954 ****
--- 969,975 ----
sub _add_info {
my %args = @_;
my ($rv, $module, $file, $used_by, $type) = @args{qw/rv module file used_by type/};
+ my $used_via_preload = defined $args{used_via_preload} ? $args{used_via_preload} : 0;
return unless defined($module) and defined($file);
***************
*** 986,994 ****
};
if (defined($used_by) and $used_by ne $module) {
! push @{ $rv->{$module}{used_by} }, $used_by
! if ( (!File::Spec->case_tolerant() && !grep { $_ eq $used_by } @{ $rv->{$module}{used_by} })
! or ( File::Spec->case_tolerant() && !grep { lc($_) eq lc($used_by) } @{ $rv->{$module}{used_by} }));
# We assume here that another _add_info will be called to provide the other parts of $rv->{$used_by}
push @{ $rv->{$used_by}{uses} }, $module
--- 1007,1017 ----
};
if (defined($used_by) and $used_by ne $module) {
! if ( (!File::Spec->case_tolerant() && !grep { $_ eq $used_by } @{ $rv->{$module}{used_by} })
! or ( File::Spec->case_tolerant() && !grep { lc($_) eq lc($used_by) } @{ $rv->{$module}{used_by} })) {
! push @{ $rv->{$module}{used_by} }, $used_by;
! push @{ $rv->{$module}{used_via_preload} }, $used_by if ( $used_via_preload );
! }
# We assume here that another _add_info will be called to provide the other parts of $rv->{$used_by}
push @{ $rv->{$used_by}{uses} }, $module
***************
*** 1007,1012 ****
--- 1030,1036 ----
my $rv = $args{rv} || {};
my $skip = $args{skip} || {};
my $used_by = $args{used_by};
+ my $used_via_preload = $args{used_via_preload} || 0;
foreach my $module (@{ $args{modules} }) {
my $file = _find_in_inc($module)
***************
*** 1016,1022 ****
if (exists $rv->{$module}) {
_add_info( rv => $rv, module => $module,
file => $file, used_by => $used_by,
! type => undef );
next;
}
--- 1040,1046 ----
if (exists $rv->{$module}) {
_add_info( rv => $rv, module => $module,
file => $file, used_by => $used_by,
! type => undef, used_via_preload => $used_via_preload );
next;
}
***************
*** 1023,1029 ****
my $type = _gettype($file);
_add_info( rv => $rv, module => $module,
file => $file, used_by => $used_by,
! type => $type );
if ($module =~ /(.*?([^\/]*))\.p[mh]$/i) {
my ($path, $basename) = ($1, $2);
--- 1047,1053 ----
my $type = _gettype($file);
_add_info( rv => $rv, module => $module,
file => $file, used_by => $used_by,
! type => $type, used_via_preload => $used_via_preload );
if ($module =~ /(.*?([^\/]*))\.p[mh]$/i) {
my ($path, $basename) = ($1, $2);
Markus Jansen
Ericsson GmbH
Eurolab R&D
Ericsson Allee 1
52134 Herzogenrath, Germany
Phone +49 2407 575 5157
Fax +49 22407 575 150
Mobile +49 172 2742003
markus.jansen@ericsson.com
www.ericsson.com
Ericsson GmbH. Sitz: Düsseldorf. Registergericht: Amtsgericht Düsseldorf, HRB 33012. Geschäftsführer: Stefan Koetz (Vors.), Nils de Baar, Bernd Schmidt. Aufsichtsratsvorsitzender: Anders Runevad.
This Communication is confidential. We only send and receive email on the basis of the terms set out at www.ericsson.com/email_disclaimer<http://www.ericsson.com/email_disclaimer>.
Message body is not shown because it is too large.