From: Tyler Riddle Date: Wed, 26 Sep 2012 17:06:03 +0000 (-0700) Subject: made enumerating packlists a configurable option X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5131b7553502036a20e5995d7e014d07808d6020;p=scpubgit%2FSystem-Introspector.git made enumerating packlists a configurable option --- diff --git a/lib/System/Introspector/Probe/LibDirs/Perl.pm b/lib/System/Introspector/Probe/LibDirs/Perl.pm index 5229e86..feb185e 100644 --- a/lib/System/Introspector/Probe/LibDirs/Perl.pm +++ b/lib/System/Introspector/Probe/LibDirs/Perl.pm @@ -20,6 +20,8 @@ has root => ( default => sub { '/' }, ); +has enumerate_packlists => ( is => 'ro', default => sub { 0 } ); + sub gather { my ($self) = @_; log_debug { "Gathering Perl library information" }; @@ -49,16 +51,20 @@ sub _gather_libdir_info { my $packlist = $installed->packlist($module)->packlist_file; Dlog_trace { "Packlist file for '$module' in '$libdir' is '$_'" } $packlist; + + $modules{$module} = {}; - if (-f $packlist) { - $modules{$module} = [ $installed->files($module, 'all') ]; - } else { - $modules{$module} = undef; + if ($self->enumerate_packlists && -f $packlist) { + $modules{$module}->{packlist} = [ $installed->files($module, 'all') ]; } } return \%modules; - +} + +#sub _enumerate_metadata { +# my ($self, $libdir, $module) = @_; +# # my $pipe = $self->_open_locate_pm_pipe($libdir); # while (defined( my $line = <$pipe> )) { # chomp $line; @@ -79,7 +85,7 @@ sub _gather_libdir_info { # }; # } # return \%module; -} +#} #sub _open_locate_pm_pipe { # my ($self, $libdir) = @_; @@ -104,7 +110,6 @@ sub _open_locate_libdirs_pipe { return handle_from_command sprintf #lib/perl5 for Local::Lib? - lib/perl for others q{locate --regex '^%s.*lib/perl5$'}, $root; -# q{locate --regex '^%s.*lib/perl$'}, $root; } 1;