×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Executing Perl from HTML

Executing Perl from HTML

Executing Perl from HTML

(OP)
Hello,

This is a basic question but I could not find any other post answering this and hence I am posting it.

I know that either of the following could be used to execute Perl script from HTML :

1. <!--#include virtual="/cgi-bin/test.pl" -->
2. <!--#exec cgi="/cgi-bin/test.pl" -->

My perl script is simple and it looks like this:
====
#!/usr/bin/perl -w
print "Content-type: text/html\n\n";  
print "banana";
====

The HTML file looks like this:
=======
<html>  
  <body>  
    apple <br>  
    <!--#exec cgi="/cgi-bin/test.pl"-->  
    orange <br>  
  </body>  
</html>
========

However, when the HTML file is rendered on a browser, it does not display the "banana" part.

The strange part is that when the perl script is run standalone on the browser using the following URL, it works:
http://www.domain.com/cgi-bin/test.pl


My question is:

1. Do I need any Apache webserver settings to make this happen? What settings are they?
2. Does it need any perl module to be installed at the webserver to make this happen? What are they?
3. Are there any other issues that will make this run?

I have been struggling with this for quiet some time. Any help would be much appreciated.

Regards
Shantanu

RE: Executing Perl from HTML

Quote (sbhatta):

I know that either of the following could be used to execute Perl script from HTML :

1. <!--#include virtual="/cgi-bin/test.pl" -->
2. <!--#exec cgi="/cgi-bin/test.pl" -->

How do you know this?  What type of web server understands that #exec syntax?  Are you sure it's supported by Apache?

This isn't really a question about perl, but more about the type of web server and the way it understands that syntax.  Perhaps a post in the Apache forum may be more appropriate?  

Annihilannic
tgmlify - code syntax highlighting for your tek-tips posts

RE: Executing Perl from HTML

(OP)
I got to know both the methods from various other forums which stated that they work. I just wanted to provide as much information as I could.  

RE: Executing Perl from HTML

(OP)
thanks.  

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close