in reply to Finding modules

If you have no clue where you (or `cpan`) installed your files, you can use `find` (see `man find` for more):

$ find /usr/ -name Simple.pm [...] $ find /usr/ -name Sendmail.pm [...]

Most likely, it's installed somewhere in /usr/. If nothing returns, you might try:

$ find / -name Simple.pm

I'm not sure wheter Solaris has the `locate` app. Otherwise that'd be even faster:

$ locate Simple.pm

HTH

Update: but of course, borisz' answer is way nicer :)

--
b10m

Replies are listed 'Best First'.
Re: Re: Finding modules
by Vautrin (Hermit) on Jan 27, 2004 at 17:58 UTC

    Of course there is no guarantee that your modules are installed in /usr/ so you may want to find the directories you are searching using the following code if you are using b10m's solution:

    use strict; use warnings; foreach my $path (@INC) { print "There are modules in: $path\n"; }

    Note that you need read access to these directories, so if your box is properly locked down this may mean you need root access.

      Of course there is no guarantee that your modules are installed in /usr/ so you may want to find the directories you are searching using the following code if you are using b10m's solution

      Of course there's no guarantee, that's why I wrote "most likely". "My solution" comes in handy when you know you installed the modules, but you somehow can't seem to use them (read: they're not in %INC). Otherwise, I would strongly suggest to use for example borisz' solution.

      Note that you need read access to these directories, so if your box is properly locked down this may mean you need root access.

      You would have quite a paranoid sysadmin, if you can't read the Perl modules' directories, but of course, it's possible :)

      --
      b10m
        Of course there is no guarantee that your modules are installed in /usr/ so you may want to find the directories you are searching using the following code if you are using b10m's solution
        Of course there's no guarantee, that's why I wrote "most likely". "My solution" comes in handy when you know you installed the modules, but you somehow can't seem to use them (read: they're not in %INC). Otherwise, I would strongly suggest to use for example borisz' solution.

        I understand. I was pointing out a way to double check where the modules were installed.

        Note that you need read access to these directories, so if your box is properly locked down this may mean you need root access.
        You would have quite a paranoid sysadmin, if you can't read the Perl modules' directories, but of course, it's possible :)

        Not really. It is standard procedure on a lot of boxes to make a directory readable but not executable, so you can access any programs you know the path of, but you can't list the directories contents. This means that although % ls -l /usr/bin wouldn't tell you what programs were installed, /usr/bin/perl would still work because you could read and execute the program /usr/bin/perl although you couldn't figure out if someone had perl installed by % ls /usr/bin/perl. Install programs in non standard paths and users can't even guess the path.

        Update: fixed my dyslexia. Thanks b10m!

Re: Re: Finding modules
by nimdokk (Vicar) on Jan 28, 2004 at 14:05 UTC
    A slight modification on this so you don't get error messages would be to do:
    $ find / -name Simple.pm 2>/dev/null $ find / -name Sendmail.pm 2>/dev/null

    And I'm certain it could be done in one line with a regexp :-)


    "Ex Libris un Peut de Tout"
      And I'm certain it could be done in one line with a regexp :-)

      You asked for it! ;)

      find / -regex '.*S\(imple\|endmail\)\.pm$' 2>/dev/null
      --
      b10m

      All code is usually tested, but rarely trusted.