execute perl script from html file

Ken Elliott's picture

They have: 358 posts

Joined: Jun 1999

Hello,
I want to execute a perl script from a html file and the problem is it is not possible to use SSI for this project.

I have heard, but have not been able to figure out, that I can use an image tag (img src=thiscgi.cgi) but I have to 'slurp' in the jpeg file into a variable and output it in binmode.

Is there possibly an easier way? If not could someone take the extra step and explain to me how to read an image in and output it to the browser? I've tried outputing the url of the image but that has only resulted in a broken link and it didn't even appear that the script ran. (I set it to write to an external file and it never happened)

Is it possible to embed some javascript into my html that will execute my perl script?

thanks for any help.
Ken Elliott
webdood

Pimpin like a pimp with an electrofied pimpin machine!

dk01's picture

He has: 516 posts

Joined: Mar 2002

Yes you can embed javascript to run your perl script.

<script language="Javascript" src="http://www.mydomain.com/script.pl">
</script>

Remember though. Although you are embedding using html. You are still writting html code and therefor all your perl outputs must be javascript. That is not too bad i guess since you can use document.write to print out any information.

-dk

Ken Elliott's picture

They have: 358 posts

Joined: Jun 1999

I don't want it to show any output on the page, I just want it to execute in the background, a counter type thing. It just increments a file by 1.

gonna try that out now. I believe I tried it earlier.

ken

Pimpin like a pimp with an electrofied pimpin machine!

Ken Elliott's picture

They have: 358 posts

Joined: Jun 1999

BooYa! You da man! It worked like a charm. Sweet. thx again, this place rocks!

ken elliott
member for life

They have: 601 posts

Joined: Nov 2001

Just notes that many people browse with Javascript disabled (me included), so if an user hits your site without javascript, then it won't execute your script.

- wil

dk01's picture

He has: 516 posts

Joined: Mar 2002

Then run it as a css file then.
-dk

They have: 447 posts

Joined: Oct 1999

i dont think IE loads stylesheets if JavaScript is disabled, which doesnt make much sense to me.

anywho, it may be worth a shot. i have no idea if this would work and dont have time to test it right now, but you can try:

dk01's picture

He has: 516 posts

Joined: Mar 2002

I am pretty sure it still does. Otherwise people with it turned off (Will maybe you can help us on this) would not be able to see many of the pages on the internet. Anyways if you are going to use a link then that would be the correct syntax I beleive.
-dk

P.S. Obviously add /> for xhtml.

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.