Perl Cgi Problem

liunx

Guest
hi there,<br /><br />simple question: what is the perl equivalent of the following lines?<br /><br /><?php<br /><!--coloro:red--><span style="color:red"><!--/coloro-->header('Content-type: text/plain; charset=utf-8');<br />header('Content-disposition: attachment; filename=output.txt');<br />print 'hello world';<!--colorc--></span><!--/colorc--><br />?><br /><br />actually, to be more specific, what's the perl equivalent of the second line? in the actual code that is<br /><br /><br />i've looked in a couple of places on the net but came up with nothing so far..... <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/unsure.gif" style="vertical-align:middle" emoid=":unsure:" border="0" alt="unsure.gif" /> <br /><br />thanks and have a great new year<!--content-->
I'll try to help ... but forgive me if I'm not answering your question exactly.<br /><br />This is, I think, what you are looking for.<br /><br /><br />#!/usr/bin/perl<br /><br />use CGI;<br /><!--coloro:blue--><span style="color:blue"><!--/coloro-->use CGI::Carp qw(fatalsToBrowser);<!--colorc--></span><!--/colorc--><br /><br />print "Content-type: text/html\n\n";<br />print "Hello World";<br /><br /><!--coloro:blue--><span style="color:blue"><!--/coloro-->exit;<!--colorc--></span><!--/colorc--><br /><br />The lines in <!--coloro:blue--><span style="color:blue"><!--/coloro-->blue<!--colorc--></span><!--/colorc--> are optional but recommended. Be sure your script has been uploaded in ASCII format (v.s. binary) and that the permissions are set to 755.<br /><br />If you need more clarification on this, send me an e-mail to be sure I see it.<br /><br />Good luck!<!--content-->
thanks for the reply, but that's not what i'm looking for unfortunately.<br /><br />your code will print the text to the browser, but that's not what i want. if you try the php code, the output should be in a file called 'output.txt' and the user will be prompted to either save the file or open it.<br /><br />i thought there'd be a way using the CGI header, perhaps something like this....<br /><!--coloro:red--><span style="color:red"><!--/coloro-->print header(-type=>'text/plain',<br />charset=>'utf-8',<br />disposition=>'attachment',<br />filename=>'output.txt');<!--colorc--></span><!--/colorc--><br />but i haven't found it so far.<br /><br />basically i'm too lazy to select, copy, paste and save the output and i want to just be able to save it all in one step. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/tongue.gif" style="vertical-align:middle" emoid=":P" border="0" alt="tongue.gif" /><!--content-->
 
Back
Top