Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

I'm preparing my swing (a module which will be my effort to address this problem you've raised. I'm just posting this now as a message and a 'placeholder' to make myself obligated to posting my effort ;-). This node will be updated later.

Update: 25.09.06: added all below.

OK. While not perfect (and I am a wee bit hurried in making this posting even), there's a solution to follow, YMMV, etc etc. We don't want to locally modify ExtUtils::Installed for reasons rinceWind so cluefully mentioned (a future upgrade could well just clobber our modifications someday). So let's create a new module and stick it in the sitelib where (hopefully) no harm will come to it.

Since ExtUtils::Installed is doin' the OO mambo, let's dance with it. We'll just make our own constructor (which ordinarily is called just once per run). See how this works for you, rinceWind.

Update: 26.09.06: CODE CHANGE -- found a regexp mistake.

Update: 26.09.06:

code tested so far on Perl installations:

  • MSWin32, perl 5.8.8, Windows XP
  • GNU/Linux (gentoo), perl 5.8.8

package ExtUtils::ModsInstalled; # Last modified: 26 Sep 2006 at 02:35 AM EDT #-----------------------------------------------------------------# # Inherit from ExtUtils::Installed and discover other branches to # add to the two subtrees searched for .packlist files. # Author: Soren Andersen <somian *AT* cpan -DOT- org> # Status: experimental (pre-beta) # License: As for Perl #-----------------------------------------------------------------# use base 'ExtUtils::Installed'; use Config (); use File::Find 'find'; require ExtUtils::MM; require VMS::Filespec if $^O eq 'VMS'; use strict; use warnings; use vars qw/ @autoparents %Config $VERSION @Hardwired_in_Config $OurDbg $MSish /; $VERSION = '0.01'; *Config = \%Config::Config; $MSish = ($^O =~ /^((?i:MSWin\d?\d?)|os2|dos|mint)$/); @Hardwired_in_Config = qw(sitearch vendorarch archlib); $OurDbg = 0; # Turn off after testing any modifications { no strict 'refs'; @autoparents = map { s{\\}{/}g if $MSish; ($^O eq 'VMS' ? VMS::Filespec::unixify($_) : File::Spec::Unix->canonpath($_)) } grep {$_} map($Config{"${_}exp"}, @Hardwired_in_Config); } my $onlyonce = { map (($_,1),@autoparents) }; unshift @autoparents, $_ for grep {$_ && !$onlyonce->{$_}++ && -d "${_}/auto"} map { s{\\}{/}g if $MSish; ($^O eq 'VMS' ? VMS::Filespec::unixify($_) : File::Spec::Unix->canonpath($_)) } grep($_ ne '.',@INC); if ($OurDbg) { printf STDERR "WARNING: %s was not tested with this more ". "recent release (%s) of ExtUtils::Installed\n",__PACKAGE__, $ExtUtils::Installed::VERSION if $ExtUtils::Installed::VERSION > 0.08; print STDERR "Will look for .packlist files under:$/"; print STDERR $_ for map { sprintf qq[%s\n %s\n],$_, `du -sh "$_/auto"` } @autoparent +s; } # Much of our constructor is just lifted verbatim from EU::Installed 0 +.08. sub new { my ($class) = @_; $class = ref($class) || $class; my $self = {}; my $archlib = $autoparents[$#autoparents]; # Read the core packlist $self->{Perl}{packlist} = ExtUtils::Packlist->new( File::Spec->catfile($archlib, '.packlis +t') ); $self->{Perl}{version} = $Config{version}; # Read the individual module packlists my $sub = sub { # Only process module .packlists return if $_ ne ".packlist" || $File::Find::dir eq $archlib; my ($fqmodpn, $module, $modname); $module = $File::Find::name; $module =~ s{\\}{/}g if $MSish; $fqmodpn = $module; # Behead the pathname & convert what is left to a module name for my $instloc (@autoparents) { $module=~ s!\Q${instloc}\E/auto/(.*)/.packlist!$1!s and $modname = $1 and last; } return unless $modname; my $modfile = "$"; $modname =~ s!/!::!g; # Find the namespace-top module file in the @INC pathlist $self->{$modname}{version} = ''; foreach my $dir (@INC) { my $p = File::Spec->catfile($dir, $modfile); if (-r $p) { $modname = _module_name($p, $modname) if $^O eq 'VMS'; $self->{$modname}{version} = MM->parse_version($p); last; } } # Read the .packlist $self->{$modname}{packlist} = ExtUtils::Packlist->new($fqmodpn); warn "No .packlist for $modname?!" unless $self->{$modname}{packli +st}; }; my(@dirs) = grep { -e } @autoparents; find($sub, @dirs) if @dirs; return(bless($self, $class)); } 1; # ARRET! (All Real modules must REturn True) __END__ =head1 NAME ExtUtils::ModsInstalled - like EU::Installed but discover other branches to add to the two subtrees searched for .packlist files +. =head1 SYNOPSIS From the commandline: $ perl -MExtUtils::ModsInstalled -l \ -e'my $in=ExtUtils::ModsInstalled->new;' \ -e'push @mods,$_ for grep(/\Q$ARGV[0]/,$in->modules);' \ -e'print for map{sprintf qq[\n%-56s %s\n].("-"x68).q[%s],$_,$in->v +ersion($_),' \ -e'join("$/ ","",$in->directories($_,"all"))} @mods' \ Image =head1 DESCRIPTION As of version 0.08 the module C<ExtUtils::Installed> misses many modules installed to the Perl system, it is reported. This class inherits from ExtUtils::Installed and merely substitutes a different C<new> constructor in order to cast a wider net (and also fix a few small nits that to the author's tastes could be purged from C<ExtUtils::Installed>'s "new()" code). If ExtUtils::Installed is fixed in the future the need for a hack like this will go away. Note that =head1 SEE ALSO L<ExtUtils::Installed>, L<ExtUtils::Packlist> =cut

(26.09.06) On one system the "SYNOPSIS" example code shown in the POD above resulted in this output:

Image::Magick                              6.2.9

Image::Size                              2.992

In reply to Re^3: ExtUtils::Installed doesn't list all modules by Intrepid
in thread ExtUtils::Installed doesn't list all modules by rinceWind

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others meditating upon the Monastery: (6)
    As of 2019-12-05 19:20 GMT
    Find Nodes?
      Voting Booth?
      Strict and warnings: which comes first?

      Results (151 votes). Check out past polls.