Newsgroup: it.comp.lang.perl
Titolo: IIS & Perl

Hello,
I think this problem I have is a server issue rather than a programming one.
We've just installed a new server with IIS6 and Perl.
With the new encarnation of the server, when we run CGI scripts, 
"Content-type: text/html" is displayed at the top of every .cgi page.
What have I done wrong here and what do I need to do to correct it?
When the same scripts were run on the old server, this did not happen.
Any thoughts?
Thanks,
Gareth

 ha scritto:

When you create the CGI object (if you use CGI of course), try:
my $cgi = new CGI;
$cgi->nph(1);
From the CGI module documentation:
---
USING NPH SCRIPTS
NPH, or "no-parsed-header", scripts bypass the server completely by sending 
the complete HTTP header directly to the browser. This has slight 
performance benefits, but is of most use for taking advantage of HTTP 
extensions that are not directly supported by your server, such as server 
push and PICS headers.
Servers use a variety of conventions for designating CGI scripts as NPH. 
Many Unix servers look at the beginning of the script's name for the prefix 
"nph-". The Macintosh WebSTAR server and Microsoft's Internet Information 
Server, in contrast, try to decide whether a program is an NPH script by 
examining the first line of script output.
CGI.pm supports NPH scripts with a special NPH mode. When in this mode, 
CGI.pm will output the necessary extra header information when the header() 
and redirect() methods are called.
The Microsoft Internet Information Server requires NPH mode. As of version 
2.30, CGI.pm will automatically detect when the script is running under IIS 
and put itself into this mode. You do not need to do this manually, although 
it won't hurt anything if you do. However, note that if you have applied 
Service Pack 6, much of the functionality of NPH scripts, including the 
ability to redirect while setting a cookie, b<do not work at all> on IIS 
without a special patch from Microsoft. See 
http://support.microsoft.com/support/kb/articles/Q280/3/41.ASP
: Non-Parsed 
Headers Stripped From CGI Applications That Have nph- Prefix in Name.
- In the use statement
Simply add the "-nph" pragmato the list of symbols to be imported into your 
script:
      use CGI qw(:standard -nph)
- By calling the nph() method:
Call nph() with a non-zero parameter at any point after using CGI.pm in your 
program.
      CGI->nph(1)
- By using -nph parameters
in the header() and redirect() statements:
      print header(-nph=>1); 

 From the CGI module documentation:
Aspetta un attimo, questa è una cosa che cercavo da molto tempo, quando 
con questo script mando un output al client, inevitabilmente il server 
infila altri parametri nella response header http...e non sono mai 
riuscito a capire come impedire al server di aggiungere al mio header 
altri "key: value\n" che io non voglio...mi serve una response header 
personalizzata da me.
Come faccio?
#!/perl
use CGI;
use IO::Handle;
STDOUT->autoflush();
syswrite(STDOUT, "Content-Type: audio/mpeg\n");
syswrite(STDOUT, "Cache-Control: no-cache\n");
syswrite(STDOUT, "Connection: close\n");
syswrite(STDOUT, "\n");
...etc...
Grazie

 ...etc...
Mi pare un po' macchinoso il sistema. Puoi usare i metodi già esposti dal 
moduelo CGI per scrivere header e quant'altro invece di syswrite.