Forum Moderators: coopster & phranque

Message Too Old, No Replies

executing a perl script without the use of a form

Please help!

         

adni18

6:39 pm on Sep 18, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have a perl script that works when executed by a form. All it does is print a line of a files, but I need to know how I can execute this without the user having to submit a form, just have it automatically print the line inside the doc. Thanks!

IanKelley

5:04 am on Sep 20, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month




#!/usr/bin/perl
#(most common bash line)

print "Stuff";

Save in ascii as .cgi or .pl

marcs

5:15 am on Sep 20, 2004 (gmt 0)

10+ Year Member



Sounds like server side includes should work here. Use something like :

<!--#include virtual="scriptname.cgi" -->

You may need to change that, depending on the web server setup.

hiker_jjw

10:01 pm on Sep 20, 2004 (gmt 0)



I would look closely at the Form name/value pairs that are passed thru. You can then put together a GET (basically a URL) to submit the form process.

for example:

[domain.com...]

This is just an example, but most forms will have a trigger such as the action=submit_form name/value pair. You just have to did thru the existing form to find the values.

Cheers,
Jeff

lexipixel

5:56 pm on Sep 21, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



If i understand you correctly, you DO NOT want the user to have to do anything, (just have the server run the script when the visitor browses the page).

If this is correct, then you want to use the SSI (server side include) CGI script method and not the "GET" (URL) method which would require the user to click a link.

If your host allows SSI you may need to save the HTML page as "filename.shtml" and within the body of that document insert the code-


<!--#exec cgi="/cgi-bin/scriptname.pl" -->

This will run the script every time the page is loaded (note: it will also run if the user clicks "Refresh").

adni18

1:32 am on Sep 24, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks I'll get back to you on that.

adni18

1:37 am on Sep 24, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hey. I tried that and it doesn't do anything. Maybe is there a way to open and display a file in javascript? Is there something like

<script language=perl>
print "Why not?";
</script>

[edited by: jatar_k at 5:19 pm (utc) on Sep. 24, 2004]
[edit reason] removed url [/edit]

moltar

3:24 am on Sep 24, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If the script was written without the user of CGI.pm (manual query parsing), there could be a difference in GET and POST. This could be one of the reasons. I actually used to do it this way back in the day. In this case quite a few changes need to be made to the script.

adni18

11:30 am on Sep 24, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Huh?

I'm not going to use a form, right?

Ok, Iexipixel so now you've changed it, and i cant test it, because the server won't let me login.