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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HTTP::Recorder and HTTP::Proxy

Status
Not open for further replies.

matlawtt

Programmer
Joined
Nov 4, 2006
Messages
1
Location
US
I'm by no means a professional programmer, but am trying to write a perl program using HTTP::Recorder and HTTP::Proxy. To start, I copied the example given at CPAN for the HTTP::Recorder module:

>!/usr/bin/perl
>
>use HTTP::Proxy;
>use HTTP::Recorder;
>
>my $proxy=HTTP::Proxy->new();
>
>#create a new HTTP::Recorder object
>my $agent = new HTTP::Recorder;
>
>#set the log file
>$agent->file("~/perl/proxytmpfile");
>
>#set HTTP::Recorder as the agent for the proxy
>$proxy->agent( $agent );
>
>#start the proxy
>$proxy->start();
>
>1;

When I run with perl, I'm not sure what to expect - it looks like it's hung (no command prompt) but maybe that's what it does while it's running the proxy? I'm pretty sure I have all the modules installed correctly (until I did I used to get an error when trying to run but now I don't).

The other question I have is how do I set my web browser to use this proxy? I know from the HTTP::Proxy FAQ that the default port is 8080. Is that all I have to set for my browser's HTTP proxy setting or do I need a default address as well? If so, what's the default address? This isn't clear in either the HTTP::Recorder FAQ (it just says to set the browser proxy to the one created by the program but doesn't say what that is).

I tried setting my brower port to 8080 only and using the manual proxy configuration setting on my browser (firefox) but I'm not generating a log file at all.

Also, probably a dumb question, but what's the purpose of the final line in the code above?

Thanks in advance for any help!

Matt
 
I'm feeling extremely lazy, so I'll just take the easy question for now.

matlawtt said:
Also, probably a dumb question, but what's the purpose of the final line in the code above?

I don't know.

There, done my part for the masses today. Come back anytime :)
 
Sounds like your program is waiting for input, why not post your code as it's the code with the issue;

FWIW 1; returns true to the calling script, indicating a successful 'require'

Paul
------------------------------------
Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top