[Melbourne-pm] Perl stuff

Ben Hare benhare at gmail.com
Fri Aug 22 04:13:30 PDT 2008


well done my friend! heheh!

but it is important you understand why that worked - the 'magic line'
shall we say of:

print "Context-type: text/html\n\n";

is a line that is required to display a Perl script's content in a web
browser. It is telling the browser how to interpret the content your
web server is sending it.

for example, if you had run your script on the command line, 'perl
<script_name.cgi>', it would have printed hello world to your
terminal.

browsers need headers to determine what to do with content.

anyway, welcome to Perl..

it's not as hard as you thought.. is it? :)

Ben.

On Fri, Aug 22, 2008 at 9:03 PM, John Thornton
<jdthornton at ozemail.com.au> wrote:
>
>
> That worked!!!!!!!!!!!!!!!!!!!!!!!
> Hello World in my firefox browser appears!!!!!
>
> Wooooooooooooo!Yipeeeeeeeeeeeeeee!
>
> At this pt I concede that as a graphics student my photoshop and indesign
> skills do not extent to ascii art :) If they did I would draw a guy leaping
> in the air like those car ads:
>
> "What a feeling! Perl!"
>
> Thanks to everyone who helped! In particular Ben Hare should get a
> bookprize/book voucher or something from perlmongers.
>
> What this now enables me to do that is fantastic is to go through the rest
> of the perl tutes on vtc, read books etc BEING ABLE TO SEE THE END RESULT :
> that juicy message in the browser.
>
> To make everyone shudder I know so little about computers that it is not
> funny. I am certainly the most computer illiterate person to have ever got
> apache etc to work with perl.
>
> What a feeling! Perl!
>
> hee hee
> John
>
> -----Original Message-----
> From: Ben Hare [mailto:benhare at gmail.com]
> Sent: Friday, 22 August 2008 8:47 PM
> To: John Thornton
> Cc: melbourne-pm at pm.org
> Subject: Re: [Melbourne-pm] Perl stuff
>
> hey mate,
>
> for now, don't worry about modules, get up and running:
>
> change your code to this:
>
> ---
>
> #!"C:\xampp\perl\bin\perl.exe" -w
>
> print "Content-type: text/html\n\n";
>
> print  "Hello World!\n";
>
> __END__
>
> ---
>
> there you go.. you can learn about modules later :)
>
> Ben.
>
>
>
> On Fri, Aug 22, 2008 at 8:39 PM, John Thornton
> <jdthornton at ozemail.com.au> wrote:
>>
>>
>>      Now I have got this error message in the last 3 attempts:
>>
>>       Server error!
>>
>> The server encountered an internal error and was unable to complete your
>> request.
>>
>> Error message:
>> Premature end of script headers: hello88.cgi
>>
>> If you think this is a server error, please contact the webmaster.
>> Error 500
>> localhost
>> 08/22/08 20:33:53
>> Apache/2.2.9 (Win32) DAV/2 mod_ssl/2.2.9 OpenSSL/0.9.8h
> mod_autoindex_color
>> PHP/5.2.6
>>
>> ******
>>
>> I tried these 3 versions:
>>
>> #!"C:\xampp\perl\bin\perl.exe" -w
>>
>> use CGI;
>>
>> print  "Hello World!";
>>
>> *************
>>
>> and varying the last line with CGI-> header or CGI->headers or whatever it
>> was that was suggested.
>>
>> Try changing this line:
>>
>> print CGI->headers(), "Hello";
>>
>> To
>>
>> print CGI->header(), "Hello";
>>
>>
>> (ie drop the 's' off the word 'headers').
>> ******
>>
>> That was it.
>> ******
>> All three attempts made the error message above.
>>
>> John
>>
>> _______________________________________________
>> Melbourne-pm mailing list
>> Melbourne-pm at pm.org
>> http://mail.pm.org/mailman/listinfo/melbourne-pm
>>
>


More information about the Melbourne-pm mailing list