View Full Version : PERL not compiling -HTTP.pm Module ????

12-14-2006, 04:10 PM
I m trying to code a perl script that is making a http request. When I run my code it gives me this message;:confused:

Can't locate HTTP/Request.pm in @INC (@INC contains: /usr/perl5/5.00503/sun4-solaris /usr/perl5/5.00503 /usr/perl5/site_perl/5.005/sun4-solaris /usr/perl5/site_perl/5.005 .) at ./http.pl line 3.
BEGIN failed--compilation aborted at ./http.pl line 3.

Now I know the http module is missing. Do you know where I find this module? All I have to do is find http.pm module and place it in my /usr/perl5/site_perl/5.005/* directory right?

12-14-2006, 04:37 PM
I don't think that module comes with OS X.
You will need to install it either via CPAN or Fink.
I use CPAN - to get started, run the following command:

sudo perl -MCPAN -e shell

12-14-2006, 04:57 PM
Thanks for the quick reply, but what does 'sudo perl -MCPAN -e shell' do? please Pardon me for my ignorance.

12-14-2006, 05:11 PM
For 'sudo', see the "root privileges" section of this Unix FAQ (http://forums.macosxhints.com/showthread.php?t=40648)

perl -MCPAN runs the CPAN module
The "-e shell" gives you an interactive shell "talking" to the CPAN module.

Read 'perldoc CPAN'

12-15-2006, 02:43 PM
When I run the script I get this message

501 Protocol scheme 'http' is not supported at ./http.pl line 20

Any idea what needs to be done?

12-15-2006, 03:49 PM
when I run the following piece of PERL script

#!/usr/bin/perl -w

use HTTP::Request;
require LWP::UserAgent;

$request = HTTP::Request->new(GET => 'http://localhost"');
$ua = LWP::UserAgent->new;

$response = $ua->request($request);

if ($response->is_success) {
print $response->content; # or whatever
else {
die $response->status_line;

I get this message:

501 Protocol scheme 'http' is not supported at ./http.pl line 16.

I know it can either be UserAgent crapping out or the firewall, any idea how to fix it?
My perl version is :

This is perl, version 5.005_03 built for sun4-solaris

12-15-2006, 05:10 PM
Whoa, you're on a "sun4-solaris" platform? But anyway, if we're talking about some script you've written but not shown us, we're going to have a difficult time debugging it. Best we can say for "what needs to be done" is "read the manpages or perldocs for whatever module you're using I'm afraid.

12-15-2006, 06:42 PM
I merged your new thread (about the error message re 'http' protocol) into this existing one in order to keep some context.

I hadn't noticed earlier that you are on Solaris.
Please note that these forums are dedicated to Mac OS X and so questions relating to the behaviour of Unix tools on other platforms are off-topic here. You should ask your Perl questions in a general Perl forum or on a Solaris forum.