Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Perl CGI, IIS and other unholy unions

by mush4brains (Acolyte)
on May 01, 2002 at 19:21 UTC ( [id://163350]=perlquestion: print w/replies, xml ) Need Help??

mush4brains has asked for the wisdom of the Perl Monks concerning the following question:

I'm getting an apparent error in a Perl CGI script I'm running from IIS. The code:
print '<!DOCTYPE html> <html> <body> '; print "1<br>"; print "2<br>"; print "3<br>", "4<br>"; print "5<br>". "6<br>"; print "</body></html>"
This gives the result, in the browser (IE):
1 2 3 5 6
Note that the "4" is missing -- the comma-delimited arg's to the 4th print apparently aren't working here.
This IIS server is running ActiveState Perl "5.006001" (from $]).

If I run this script from browser on a different IIS box with ActiveState Perl 5.006, the 4 is *not* missing, so the comma apparently "works".
And... If I run this script from command line on yet another box with AS Perl 5.006001, the 4 is *not* missing, again.

Actually, I suspect this has nothing to do with IIS/CGI/etc., but rather something to do with print and commas. I've searched the web, perldelta, PerlMonks, but I'm not sure exactly what I should be searching for...
Anyone got an idea? (I'm willing to accept I made a dumb mistake.)

TIA, oh Mighty Monks.

Signed,
Mush4brains

Replies are listed 'Best First'.
Re(Amel): Perl CGI, IIS and other unholy unions
by dsb (Chaplain) on May 01, 2002 at 19:48 UTC
    Umm,
    I'm running your code and getting no problems at all, and syntactically the code looks sound.

    Maybe double check that you didn't make an error on the box in question that is not showing here. Or that that server is configured to execute cgi scripts.

    As for info on the Comma operator:




    Amel
      Thanks for the tips, Amel.

      What's particularly troubling is that running this from the command line on an AS Perl 5.006001 box *does* give the correct results, including the "4". (I know there could be differences in installation, etc., but one step at a time...)

      This just in:
      I asked the admins to run this script from the command line on the IIS server, and they got:
      <!DOCTYPE html> <html> <body> 1<br>2<br>3<br>4<br>5<br>6<br></body></html>
      So... the difference *seems* to be in the CGI-serving of the results to the client via the browser. (A fair assessment?)
      Some difference in the Perl environment running under IIS, or similar???

      Thanks again. - Mush
Re: Perl CGI, IIS and other unholy unions
by dws (Chancellor) on May 01, 2002 at 19:47 UTC
    Wild guess:

    Your script uses such a simple subset of Perl that it's concievable that other languages (e.g., JScript) might be able to execute it. Is it possible that the IIS server you're having problems with doesn't have .cgi mapped to Perl? Do other, more complicated Perl scripts work on that box?

      This script is labeled *.pl, and the server (I'm told) is mapping .pl to Perl. I'm fairly confident it's Perl.exe running it.
      If I use CGI.pm to build a simple form, it does work (unless I use commas to delimit my parts in the "print()").
Re: Perl CGI, IIS and other unholy unions
by buckaduck (Chaplain) on May 01, 2002 at 20:24 UTC
    Can you run the program from the command line on the server in question?

    I hardly know what to think, except that perhaps the "4<br>" is not quoted correctly on the copy of the program on this server...

    buckaduck

      (See my reply to Amel. From the command line on the IIS server, assuming my admins did this correctly, it does give the "4"... the thlot pickens...)
Re: Perl CGI, IIS and other unholy unions
by gt8073a (Hermit) on May 02, 2002 at 00:27 UTC

    If the "4" appears when run from the command line, AND it appears when you view the script on another box, make sure your browser is not displaying a cached copy. That may sound silly, but..

    Will perl for money
    JJ Knitis
    (901) 756-7693
    gt8073a@industrialmusic.com

      Replying to jotti and JJ --

      The "view source" from IE gives:
      <body> 1<br>2<br>3<br>5<br>6<br></body></html>
      (And did you mean "comma" instead of "dash", jotti?)

      I've cleared my browser cache (no, you're right, that's not silly), verified the cache is cleared, hit F5, Ctrl-F5, and still get the same result, without the "4".

      I'll probably just move on, at this point, but I was concerned I might have some type of installation/configuration problem on the server (which I don't admin) that could be a more serious issue later...

      It's a bit troubling, that the IIS server seems to give different results from the command line vs. web-served. I don't know enough about that area to imagine why that would be.

      - Mush
Re: Perl CGI, IIS and other unholy unions
by jotti (Scribe) on May 01, 2002 at 22:17 UTC
    You have the line

    print "5<br>". "6<br>;";

    with a period, not a dash. But that is only after the 4<br> that causes trouble, so that may not explain your problem.

    Check the source code of the output in your IE browser, not the final output. There you might see something that explains the unwanted behaviour.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://163350]
Approved by dws
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (2)
As of 2024-04-25 19:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found