Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: How do I know if a package is on my server?

by shmem (Chancellor)
on Aug 26, 2017 at 12:41 UTC ( [id://1198060]=note: print w/replies, xml ) Need Help??


in reply to How do I know if a package is on my server?

And how would I go about seeing if the package/module *is* on the server using some script?

Easy - try to use the module, if that fails, it is not there. At least it is not found in any path included in perl's built-in array @INC.

So how do these things work?

What kind of "hosting server" do you have? what kind of access? Is it a server with shell access (i.e. ssh) or a plain web server?

Perl comes with many modules included, two of them are Config and Module::CoreList. The latter can be used to list all core modules:

# command line $ perl -lE 'use Module::CoreList; say for Module::CoreList->find_modul +es' # CGI #!/usr/bin/perl use Module::CoreList; use 5.10.0; say "Content-type: text/html\n"; say <<EOH; <html><head><title>CoreList</title></head> <body><h1>Perl Core Modules:</h1> <pre> EOH say for Module::CoreList->find_modules; say "</pre></body></html>";

The Config module exports the hash %Config which holds all information about how perl was built, including paths for module inclusion search (which, again, show up in @INC). The relevant keys are

  • privlib
  • vendorlib
  • sitelib

In a sane setup, the core modules root is $Config{privlib}. All vendor provided modules of the platform live in vendorlib, the modules specific for the site are in sitelib.

You can prepend an arbitrary directory to @INC using the lib module

use lib '/path/to/my/modules';

which ensures that modules are first looked for in there.

This bunch of information should be enough to enable you to answer the rest of your questions by yourself.

perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2024-03-28 18:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found