Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

No Host Option provided in Net::HTTP::methods, line 43

by ted.byers (Monk)
on Sep 25, 2011 at 01:46 UTC ( #927698=perlquestion: print w/replies, xml ) Need Help??
ted.byers has asked for the wisdom of the Perl Monks concerning the following question:

The title is the error message I find in the apache error logs.

What is especially odd is that there are two different cgi scripts that do basically the same thing, but one works and the other gives this error.

You can even check out the behaviour of the two scripts at these two URLS:

The following code producs the error in the title

sub print_response { unless ($query->param) { print "<b>Results</b>"; return; } $ticker = $query->param('ticker'); $begin_dt = $query->param('begin_dt'); $end_dt = $query->param('end_dt'); print "<b>FIRST:<br />Ticker: $ticker<br />Start date: $begin_dt<b +r />End date: $end_dt</b><br /><br />"; use Net::HTTP; print "<b>SECOND:<br />Ticker: $ticker<br />Start date: $begin_dt< +br />End date: $end_dt</b>"; my $s = Net::HTTP->new(HOST => "localhost:5000"); print "<b>THIRD:<br />Ticker: $ticker<br />Start date: $begin_dt<b +r />End date: $end_dt</b>"; $s->write_request(GET => "/$ticker&begin_dt=$beg +in_dt&end_dt=$end_dt", 'User-Agent' => "Mozilla/5.0"); ($code,$mess, %h) = $s->read_response_headers; while (1) { my $buf; my $n = $s->read_entity_body($buf,1024); last unless $n; print $buf; } }

But in the other cgi script, the following function works fine.

sub print_response { unless ($query->param) { print "<b>No data has been submitted</b>"; return; } $vdate = $query->param('vdate'); $edate = $query->param('edate'); $ot = $query->param('ot'); $ul = $query->param('underlying'); $strike = $query->param('strike'); $dy = $query->param('dividendyield'); $rfr = $query->param('riskfreerate'); $vol = $query->param('volatility'); use Net::HTTP; my $s = Net::HTTP->new(Host => "localhost:5000"); #my $s = Net::HTTP->new(Host => ""); $s->write_request(GET => "/$vdate&edate=$edate&optionty +pe=$ot&underlying=$ul&strike=$strike&dividendyield=$dy&riskfreerate=$ +rfr&vol=$vol", 'User-Agent' => "Mozilla/5.0"); my ($code,$mess, %h) = $s->read_response_headers; while (1) { my $buf; my $n = $s->read_entity_body($buf,1024); last unless $n; print $buf; } }

Apart from the name of the cgi scripts containing these two functions, and the details of these two functions, the scripts are mostly the same.

The scripts are on the same machine, on the same instance of Apache's httpd (the latest version build for Windows - and I use the latest version of Activestate's Perl)

What can possibly account for the difference int he behvaiour of these two functions.

Replies are listed 'Best First'.
Re: No Host Option provided in Net::HTTP::methods, line 43
by zwon (Abbot) on Sep 25, 2011 at 03:34 UTC

    Note, that HOST is not the same as Host.

      Thanks zwon. That was it.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://927698]
Approved by GrandFather
[Corion]: marioroy: Oh, that's always cool, having API-compatible modules. This makes testing and comparing things much easier
[marioroy]: IPC in MCE::Shared can handle 400k (sends) per second. That's seems a lot for being a pure-Perl module. After making the release, will come back and post a solution for a node by a fellow wanting faster logging.
[Corion]: While working on WWW::Mechanize:: Chrome, I had the suspicion that AnyEvent was doing something wrong, but I was able to swap it out for Mojolicious and the error persisted.
[Corion]: Of course, the error was in my own code ;)
[marioroy]: Corion, start and start_child in MCE::Hobo::Manager return a MCE::Hobo object, whereas P::FM returns the PID. I can have it return the PID though. I tried Hobo::Manager with several P::FM modules, just changed P::FM to MCE::Hobo::Manager and it works.
[marioroy]: I also have a Hobo driver for Forklift allowing folks to use in multiple classes, no conflicts with one another. That's not possible for P::FM.
[Discipulus]: congrats marioroy!
[marioroy]: CORE::wait works well eventhough multiple instances or classes using Hobo::Manager.
[Corion]: marioroy: I'm not sure what the normal use for the PID is in P:FM, but I guess that most programs just ignore or log it
[Corion]: Oh, yes, programs could call wait $pid, but if your $pid is an object, then you could add a ->wait method to it and wait $pid would call that automatically "thanks" to indirect object notation

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (6)
As of 2017-05-26 08:40 GMT
Find Nodes?
    Voting Booth?