473,569 Members | 2,762 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Run a Perl program from an HTML page without user intervention

13 New Member
Greetings!

I thought I'd add a little something to a web site, a "tip of the week," and wanted it automated so that if I get hit by a truck (or, more likely, am forgetful), the tip is updated automatically.

I learned enough Perl (read: just enough) to code a script that does what I want it to do. Now the question is: how to get it to run automatically.

I would like the program to be invoked when someone, anyone, hits my homepage. I know little about our environment -- I'm not a developer -- but know that I'm on a Windows box and that we're running IIS. Server-side includes work. Perl for use with forms works. Beyond that, I must offer my apologies for my cluelessness.

I've tried to use the #exec command on my HTML page to invoke the Perl script. Doesn't work. Here's the HTML to my test page:

Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
  2.  
  3. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4. <html xmlns="http://www.w3.org/1999/xhtml">
  5. <head>
  6. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  7.  
  8. <title>testing perl script from HTML page</title>
  9. </head>
  10.  
  11. <body>  
  12. <!--#exec "d:/webdocs/www/irm/training/CGI/tipweek.pl" -->
  13. <p>This page is to test to see whether I can run a Perl script from an HTML page.</p>
  14. <p>&nbsp;</p>
  15. <br>
  16. </p><p>Other stuff on the page, including a server-side include below this line.</p>
  17. <p>
  18.   <!--#include file="Tips/currenttip.txt" -->
  19. <br>
  20. </p>
  21. </body>
  22. </html>
  23.  
I do not get an error message, but the files that are supposed to be updated are not updated, so something isn't happening that should be happening.

If I enter the URL for the Perl script into my browser, the script runs; the files are updated.

I don't want the Perl script to create my homepage, as I'm not the only one who needs to be able to edit the page.

Is there some relatively painless way to invoke a Perl script (which doesn't use user input and doesn't need to return anything to the page) from an HTML page?

TIA!
Aug 30 '07 #1
22 5999
KevinADC
4,059 Recognized Expert Specialist
use the virtual SSI tag instead of exec and you need to use the relative url to the script, not an internal machine path:

<!--#include virtual="../CGI/tipweek.pl" -->

see how that works
Aug 30 '07 #2
owlice
13 New Member
Thanks! I tried that, and get "Error processing SSI file."

I also tried <!-- #exec virtual="CGI/tipweek.pl" -->, which gives me "Invalid SSI Tag."

And "<!-- #exec "CGI/tipweek.pl" -->", which doesn't give me an error message, but also doesn't update the files.

This latter made me think it might be a files permissions problem, as I've had that problem before (a Perl script apparently running, but no changes appearing in the file that should be changed), so I wrote a little test script to write to the files, and that worked, so the permissions are fine.

I'm open to suggestions! Heck, at this point, I'm desperate for suggestions! I'm at the point where I'm ready to burn black candles and sacrifice a goat, even! Oy!!
Aug 31 '07 #3
docdiesel
297 Recognized Expert Contributor
Hi,

try
Expand|Select|Wrap|Line Numbers
  1. <!-- #exec CGi="CGI/tipweek.pl" -->
  2.  
or
Expand|Select|Wrap|Line Numbers
  1. <!-- #exec CMD="D:\webdocs\www\irm\training\CGI\tipweek.pl" -->
  2.  
At least one of them should work. (See also Web Development Developer Center, http://msdn2.microsoft.com/en-us/library/ms525620.aspx .)

Regards, Bernd
Aug 31 '07 #4
KevinADC
4,059 Recognized Expert Specialist

I'm open to suggestions!
Check the server errror log and see if there is anything related to the script you are trying to run via the SSI tags. Probably not but it's worth a look. Post the script here if it's not too long or attach it to a post.
Sep 1 '07 #5
owlice
13 New Member
Thank you!!

Hi,

try
Expand|Select|Wrap|Line Numbers
  1. <!-- #exec CGi="CGI/tipweek.pl" -->
  2.  
I got "Failed to execute CGI : Win32 Error Code = 3" in response.

or
Expand|Select|Wrap|Line Numbers
  1. <!-- #exec CMD="D:\webdocs\www\irm\training\CGI\tipweek.pl" -->
  2.  
And for this, I got "The CMD option is not enabled for #EXEC calls" in response.

That banging you hear is my head against my desk!

The good thing is that the script DOES run when I enter the URL for it into the browser location. At least I have that!

I don't even know who to talk to here about this, but I guess I'm about to find out! :-D
Sep 4 '07 #6
owlice
13 New Member
And things aren't looking too good for the goat....!
Sep 4 '07 #7
numberwhun
3,509 Recognized Expert Moderator Specialist
I got "Failed to execute CGI : Win32 Error Code = 3" in response.
This is just a complete shot in the dark, but have you tried adding the onload="" option to your body tag in your HTML and specifying your Perl script after the equals sign in the double quotes?

ie:
Expand|Select|Wrap|Line Numbers
  1. <body onload="/path/to/perl_script.pl">
  2.  
Just a thought.

Regards,

Jeff
Sep 4 '07 #8
KevinADC
4,059 Recognized Expert Specialist
hehehe.... good try. That would be for javascript. The browser would have no clue what to do with perl code.

The OP just needs to hit on the correct SSI tag and the correct path to his perl code to get it working.
Sep 4 '07 #9
numberwhun
3,509 Recognized Expert Moderator Specialist
He he, it was worth a shot. I didn't know if it was possible or not. Oh well.

Regards,

Jeff
Sep 4 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

41
3508
by: Xah Lee | last post by:
here's another interesting algorithmic exercise, again from part of a larger program in the previous series. Here's the original Perl documentation: =pod merge($pairings) takes a list of pairs, each pair indicates the sameness of the two indexes. Returns a partitioned list of same indexes.
6
10508
by: Pierre-Yves | last post by:
Hello, I would like to prevent my perl program to be executed several times simultaneously (if the program is already running, I would like to display a message like "another instance of this program is already running, please try again in a couple of minutes). For doing this, I guess I have to check the running processes... but I don't...
12
1721
by: SStory | last post by:
Doing pages for contract..... If I make an ASPX file that does certain things, how simple would it be for a person who know nothing about it to modify the user interface without bothering the ASPX interaction? How would I best build such pages. Many people of course don't want a page that they can't modify at all without programmer...
0
9736
by: Kirt Loki Dankmyer | last post by:
So, I download the latest "stable" tar for perl (5.8.7) and try to compile it on the Solaris 8 (SPARC) box that I administrate. I try all sorts of different switches, but I can't get it to compile. I need it to be compiled with threads. Anyone have any wisdom on how best to do this? Here's a transcript of my latest attempt. It's long; you...
21
34360
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Uploading files from a local computer to a remote web server has many useful purposes, the most obvious of which is the sharing of files. For example, you upload images to a server to share them with other people over the Internet. Perl comes ready...
5
2323
by: Robert Latest | last post by:
Hello, if HTML authoring includes HTML autogeneration, this request is on-topic. Otherwise please forgive me and point me in the right direction. I'd like to make a bunch of dirs full of files available on a web server. Of course I could just leave them like they are and have the server take care of the listings. I don't like that because...
22
2872
by: Dan Rumney | last post by:
Hi all, I've been writing Javascript for quite a while now and have, of late, been writing quite a lot of AJAX and AJAX-related code. In the main, my dynamically generated pages are created using Perl on the backend, with Javascript providing limited frontend functionality. As an example, an expanding tree would be fully populated on the...
10
6944
by: happyse27 | last post by:
Hi All, I got this apache errors(see section A1 and A2 below) when I used a html(see section b below) to activate acctman.pl(see section c below). Section D below is part of the configuration of section c. Not sure where went wrong as the web page displayed internal server error. Also, what is the error 543? and error 2114....
1
47386
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click on a link and after a moment or two a file download dialog box pops-up in your web browser and prompts you for some instructions, such as “open” or...
0
7609
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8118
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6278
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5504
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5217
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3636
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2107
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1208
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.