Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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:

http://74.15.160.240:8080/cgi-bin/Aresults.cgi http://74.15.160.240:8080/cgi-bin/calculator.cgi

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 => "/Aresult.pl?ticker=$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 => "192.168.2.104:5000"); $s->write_request(GET => "/calc.pl?&vdate=$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.


In reply to No Host Option provided in Net::HTTP::methods, line 43 by ted.byers

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (4)
As of 2024-04-20 01:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found