Hi Monks,
I'm getting the following error from a piece of code I found on the intertubes
Cannot initialize proxy daemon: Can't assign requested address at /Lib +rary/Perl/5.10.0/HTTP/Proxy.pm line 271.
This is running on OSX 10.6.3 with the latest modules downloaded from cpan today.
I've tried running it under sudo, but the same error occurs.
Can anyone point me in the right direction to solve this?
#!/usr/bin/perl use HTTP::Recorder "0.03_01"; use HTTP::Proxy; # Set everything to undef if you have no proxy-servers # in your organisation my %whoami = ( # listen to every network interface on this machine: # host => undef, # host => "127.0.0.1", # listen only to network interface 10.1.1.5 host => "10.95.81.5", # which is the port I shall listen port => "3128", ); # this is for forwarding all requests to my proxy in the company my %proxy = ( host => "http://proxy.zdf:3128", user => undef, pass => undef, ); # set HTTP::Recorder as the agent my $agent = HTTP::Recorder->new( # Log to a file # file => "/tmp/tmpfile", file => "proxy.log", showwindow => 1); # Set my own proxy to forward requests $agent->proxy( "http", $proxy{host} ) if $proxy{host}; $request->proxy_authorization_basic( @proxy{ qw/user pass/ } ) if $proxy{user}; my $proxy = HTTP::Proxy->new; $proxy->agent( $agent ); $proxy->port( $whoami{port} ) if $whoami{port}; # Set how I get soon from my users if ( $whoami{host} ) { # My interface to be reached $proxy->host( $whoami{host} ); } # My port to be reached $proxy->port( $whoami{port} ); # you may need to set the host print "Your proxy-server in your web-browser shall be:\n"; printf "\t%s:%s\n", $whoami{host} ? $whoami{host} : "the_host_i_run", $whoami{port} ? $whoami{port} : 8080; print "Navigate to http://http-recorder/ to download the script\n"; print "\twhich has been generated\n"; # Endless loop $proxy->start();

In reply to HTTP::Proxy error by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.