Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

perl modules 1

Status
Not open for further replies.

jimberger

Programmer
Joined
Jul 5, 2001
Messages
222
Location
GB
hi all,

I'm trying to install LWP::Simple. I am using the ppm package installer with ActiveState perl. I type install LWP::Simple but it comes up with this error

Error installing package 'LWP-Simple': Could not locate a PPD file for package LWP-Simple

Has anyone seen this before? Also, does anyone know how to produce a list of installed modules with ActiveState? Any help will be useful as i'm new to perl.

Many thanks

Jim bob
 
I believe LWP comes with ActiveState Perl so there is no need to install. You can check by putting the following line in a program:

use LWP::Simple;

The 'ppm query' command will show you all the installed modules. For more help with ppm, try 'ppm help'.
 
cheers raider!

I did query with ppm. i have a module called lib installed which from my reading around is where LWP::Simple is from. However, i have written a script using this module but it dosent work. My script is as follows:

#!/usr/local/ActivePerl-5.6/bin/perl

use CGI qw(:standard);
use CGI::Carp qw(fatalsToBrowser);
use LWP::Simple;


$content =get('print "Content-type: text/html\n\n";
print "$content";

Any more ideas? Thanks for your time

Jim
 
BYy doesn't work do you mean the $content variable is empty? One thing to check is the URL. Another thing would be to try a different URL like the following:
Code:
use LWP::Simple;
$content = get("[URL unfurl="true"]http://www.yahoo.com");[/URL]
print "Content-type: text/html\n\n$content";
 
that works! So LWP::Simple only works for Is they any way that this module can be configured to work on a page on my internal web server. When i run the same script with a internal web site address i get a message saying the document contained no data. So i guess LWP can't access pages behind a firewall or something like that. Have you heard of any way to get round this or should i knock this idea on the head

either way -thanks for your help at least i've learnt how to read external web pages into my perl script!

jim
 
okay - persistant pays off. i've managed to do this through the LWP::UserAgent module. Thanks for your help anyway

jim
 
Jim, if you think about it, it makes perfect sense - that you can't access a webpage that's behind a firewall. You can only access pages that you have access to - as stupid as that sounds, it's true. A $content result of nothing must be LWP::Simple's way of telling you that either you typed the URL in wrong, or it can't grab that page for some reason(reason could be that the page is inside a firewall that you are outside of).

If you run that script on an internal network, you should have access to grab pages that are on that internal network. If you run that script on a machine that has access to the outside internet, than you should have access to grab pages that are on the outside internet, like
HTH.
Hardy Merrill
Mission Critical Linux, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top