quick help for dumb problem

Ken Elliott's picture

They have: 358 posts

Joined: Jun 1999

You have to print that before everything you print. If you plan on printing multiple times from the same script, put it in a subroutine.

sub mime {
print "Content-type:text/html\n\n";
}

Then when you want to use it just use

&mime;

VulKen
Keepin' It Realistic

[This message has been edited by VulKen (edited 18 June 2000).]

Pimpin like a pimp with an electrofied pimpin machine!

They have: 314 posts

Joined: Nov 1999

ok, thanks Vulken

------------------
Thomas Minton
The JavaScript Place
Get paid $20 - $160 an hour for viewing adverts

They have: 850 posts

Joined: Jul 1999

Actually, I beleive that you only need to print out the html header one time. If you use "print "Content-type:text/html\n\n";" a second time, it will actually print "Content-type:text/html".

------------------
click here to help save lives
http://www.wiredstart.com : The Technology Start Page

They have: 314 posts

Joined: Nov 1999

Ok, I am learning perl and made a script to calculate the circumference of a circle with a radius of 12.5. The code is:

#!/usr/bin/perl

$pi = 3.121592654;
$result = 2 * $pi * 12.5;
print "radius 12.5 is circumference $result\n";

I uploaded it and it comes back with a internal server error 500. I chmoded to 777, 755 and the folder it is in to 777 and 755.

I do not know why such a simple script wont work. I thihnk it worked offline. I was using perl for windowws but I still dont know how to use it so I just double clicked on the file and when the window came up for about a tenth of a sec I slammed on pause break and the answer ws correcy.

Could someopne tell nme why I get this error.

Thanks

------------------
Thomas Minton
The JavaScript Place
Get paid $20 - $160 an hour for viewing adverts

They have: 850 posts

Joined: Jul 1999

Before printing the answer,
add
print "Content-type:text/html\n\n";

------------------
click here to help save lives
http://www.wiredstart.com : The Technology Start Page

They have: 314 posts

Joined: Nov 1999

Thanks! it worked. I was under the impression that that was only for programs with a cgi extension. Don't know where I picked that up from.

One thing though, Do I have to put that code at the bginning of each print or jyst once and then the perl will kow that all things with print in need to be text/html?

Thanks for your help.

I'm off to get stuck again

------------------
Thomas Minton
The JavaScript Place
Get paid $20 - $160 an hour for viewing adverts

They have: 324 posts

Joined: Dec 1999

Cheating on your homework, eh?

They have: 324 posts

Joined: Dec 1999

Oh.....yeah, it's summer lol forgot

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.