CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Advanced:
Help with Modules.....

 



mike
User

Jul 31, 2000, 11:08 PM

Post #1 of 6 (1154 views)
Help with Modules..... Can't Post

Hello,
Can someone help me out. I have a script that I found, and when I tried to run it I got an internal 500 error. The problem was that it says these lines in the script:
use HTML::LinkExtor;
use LWP::Simple qw(get head);

and I get the error can't locate HTML/LinkExtor and LWP/Simple. Now, I am running perl5 with linux, and I was just wondering what is going on. I have never had this problem before. Do I need these modules, or is there something wrong with my script.
Thanks,

Mike

------------------


Kanji
User / Moderator

Jul 31, 2000, 11:17 PM

Post #2 of 6 (1154 views)
Re: Help with Modules..... [In reply to] Can't Post

You need those modules. Install 'em via CPAN if you have sufficient permissions or install your own personal copies.


mike
User

Jul 31, 2000, 11:20 PM

Post #3 of 6 (1154 views)
Re: Help with Modules..... [In reply to] Can't Post

What is CPAN?

And if I install them, how do I call them from the script? Also, where can I get them?

Mike


perlkid
stranger

Aug 1, 2000, 1:52 AM

Post #4 of 6 (1154 views)
Re: Help with Modules..... [In reply to] Can't Post

 
CPAN is a site packed with perl modules and docs. It's at www.cpan.org

Go to http://www.cpan.org/modules/01modules.index.html

To see the full list of modules and look for the ones you'll need.

To use them just download them and upload them to your server and use this in your script.

require "nameofmod.pm";

I don't know If require works in that kind of situation but It's how to include perl libraries so I'm guessing it would work.

Correct Me if I'm wrong Kanji.

perlkid


Kanji
User / Moderator

Aug 1, 2000, 4:26 AM

Post #5 of 6 (1154 views)
Re: Help with Modules..... [In reply to] Can't Post

CPAN is the Comprehensive Perl Archive Network, a place to grab many Perl goodies, but its more known as the place for getting modules.

As perlkid indicated, http://www.cpan.org/ is a good place to start, but there are mirrors and the ultra-groovy Search CPAN.

Personally I prefer to browse the available modules directly rather than use the index.

There's also a CPAN module! perldoc CPAN will give you the low-down, but it can save you from the repetitive find, download, unpack, make, make test, make install procedure to get a module working.

Arguably, the best way to use the CPAN module is the interactive shell ...

<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>

perl -MCPAN -eshell</pre><HR></BLOCKQUOTE>

After it starts, type help for help, but you can both search for and install modules from that shell.




Kanji
User / Moderator

Aug 1, 2000, 4:38 AM

Post #6 of 6 (1154 views)
Re: Help with Modules..... [In reply to] Can't Post

Oh, after they're installed, you can use them in your script a number of ways, the most common are ...

<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>

use Some::Module;
require Some::Module;
require "Some/Module.pm";</pre><HR></BLOCKQUOTE>

By far, the prefered method of perl 5+ is use, as it does more than just a require.

Note you can't leave off the .pm extension or use the :: notation if you enclose the module name in quotes.

Anyhoo, some more docs you may want to look at ...

perldoc perlmod
perldoc -f use
perldoc -f require


There's also perlmodinstall and perlmodlib.

[This message has been edited by Kanji (edited 08-01-2000).]

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives