Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Search @INC And Display Modules

by kvale (Monsignor)
on Apr 06, 2004 at 16:52 UTC ( #343013=note: print w/replies, xml ) Need Help??


in reply to Search @INC And Display Modules

You can get rid of that humongous hash def and deal with different perl versions by using Module::CoreList
use Module::CoreList; print $Module::CoreList::version{5.00503}{CPAN}; # prints 1.48 my $came_with_perl = $Module::CoreList::version{5.00503};

-Mark

Replies are listed 'Best First'.
Re: Re: Search @INC And Display Modules
by Vautrin (Hermit) on Apr 06, 2004 at 17:06 UTC
    You can get rid of that humongous hash def and deal with different perl versions by using Module::CoreList

    Actually, I tried that, and ran into a couple of problems with it:

    1. Module::CoreList is not installed by default on all systems. This would mean I would either have to include it in my code or have people download and install it -- which makes it less of the autonomous program I wanted it to be. (For instance, not everyone has the rights to install modules on their servers).
    2. Module::CoreList is incomplete. I don't know if it's because my version of Perl isn't supported or if I was using it wrong, but I got many of the Modules from perlmodlib in the output.
    3. Module::CoreList contains a big hash like the one right there, except mine worked for what was needed.
    4. I didn't need hashes of all the modules for all versions of perl. A hash of all of the modules was sufficient because if it was installed, 10 to 1 it came with Perl
    5. After playing around with it for a couple minutes, I figured it would be much quicker to create a macro in Emacs to grab the modules from perldoc perlmodlib, and it was.
    6. I also contemplated ripping modules from perldoc perlmodlib so that I would be sure of having the right modules for that particular version of Perl. I decided against it because that assumed that perldoc was installed, that the user had access rights to it, and that all perlmodlib pages were formatted a certain way (i.e. I'd have to do some debugging on different versions of Perl to be sure -- which seemed like more trouble then it was worth).

    Want to support the EFF and FSF by buying cool stuff? Click here.
      In Tk::Pod::FindPods I just use the following subroutine to determine whether a module is a non-core module:
      sub is_site_module { my $path = shift; if ($^O eq 'MSWin32') { return $path =~ m|[/\\]site[/\\]lib[/\\]|; } $path =~ /^( \Q$Config{'installsitelib'}\E | \Q$Config{'installsitearch'}\E )/x; }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://343013]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2022-05-23 08:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (81 votes). Check out past polls.

    Notices?