[SCM] Debian package checker branch, master, updated. 2.5.11-152-g4e51ff6
The following commit has been merged in the master branch:
commit 4e51ff6f08eafe191e9c3dc64ef185f86b973c68
Author: Niels Thykier <niels@thykier.net>
Date: Wed Feb 13 22:44:51 2013 +0100
L::CollScript: Eagerly load perl-coll collections
Besides a minor performance enhancement when checking a lot of
packages, it also ensures that all collections have no syntax errors.
Signed-off-by: Niels Thykier <niels@thykier.net>
diff --git a/lib/Lintian/CollScript.pm b/lib/Lintian/CollScript.pm
index 912f13e..b4770d4 100644
--- a/lib/Lintian/CollScript.pm
+++ b/lib/Lintian/CollScript.pm
@@ -90,6 +90,7 @@ sub new {
bless $self, $class;
$self->_parse_needs ($header->{'needs-info'});
+ $self->_load_collector;
return $self;
}
@@ -238,24 +239,6 @@ sub collect {
my $iface = $self->interface;
if ($iface eq 'perl-coll') {
my $collector = $self->{'_collect_sub'};
- unless (defined $collector) {
- my $cs_path = $self->script_path;
- my $ppkg = $self->name;
-
- $ppkg =~ s,[-.],_,go;
- $ppkg =~ s,/,::,go;
-
- require $cs_path;
-
- {
- no strict 'refs';
- $collector = \&{'Lintian::coll::' . $ppkg . '::collect'}
- if defined &{'Lintian::coll::' . $ppkg . '::collect'};
- }
- fail $self->name . ' does not have a collect function'
- unless defined $collector;
- $self->{'_collect_sub'} = $collector;
- }
$collector->($pkg_name, $task, $dir);
} elsif ($iface eq 'exec') {
system ($self->script_path, $pkg_name, $task, $dir) == 0
@@ -265,6 +248,28 @@ sub collect {
}
}
+sub _load_collector {
+ my ($self) = @_;
+ return unless $self->interface eq 'perl-coll';
+ my $cs_path = $self->script_path;
+ my $ppkg = $self->name;
+ my $collector;
+
+ $ppkg =~ s,[-.],_,go;
+ $ppkg =~ s,/,::,go;
+
+ require $cs_path;
+
+ {
+ no strict 'refs';
+ $collector = \&{'Lintian::coll::' . $ppkg . '::collect'}
+ if defined &{'Lintian::coll::' . $ppkg . '::collect'};
+ }
+ fail $self->name . ' does not have a collect function'
+ unless defined $collector;
+ $self->{'_collect_sub'} = $collector;
+}
+
=back
=head1 AUTHOR
--
Debian package checker
Reply to: