Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Comment on

( #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":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • 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, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            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.
  • Log In?
    Username:
    Password:

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

    How do I use this? | Other CB clients
    Other Users?
    Others wandering the Monastery: (16)
    As of 2014-08-22 15:40 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      The best computer themed movie is:











      Results (159 votes), past polls