Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

calling a .pl script from .asp page to display HTML

Status
Not open for further replies.

wrbodine

Programmer
Aug 24, 2000
302
US
Hi,

I have a .pl script that I want to call from an .asp page, and have the script display HTML content (ultimately this script will perform some calculations on data received from the first .asp page).

Right now in the form tag of the .asp page I'm calling the script when the user clicks a submit button:

<FORM NAME=&quot;Geocode&quot; ACTION=&quot; METHOD=&quot;GET&quot; onSubmit=&quot;return validate_data(Geocode)&quot;>

The script has the following code (I'm just trying to get something simple to run first):

#!/usr/bin/perl -w

print &quot;Content-Type: text/html\n\n&quot;;

print &quot;<HTML>\n&quot;;
print &quot;<head>\n&quot;;
print &quot;</head>\n&quot;;
print &quot;<body>\n&quot;;

print &quot;<H1>Test message</H1>\n&quot;;
print &quot;<H3>test test test</H3>\n&quot;;

print &quot;</body>\n&quot;;
print &quot;</HTML>\n&quot;;


Instead of executing, the script just displays its entire content, showing the words print and the ;'s on the screen, etc.

I tried just using the following lines in the script:

#!/usr/bin/perl -w
print &quot;Content-Type: text/html\n\n&quot;;
print &quot;<H1>Test message</H1>\n&quot;;
print &quot;<H3>test test test</H3>\n&quot;;

and in this case the script ran as an executable, without showing anything on the .asp page (just bringing up a DOS window for a second after dispalying a message did we want to open or save, etc. I chose open for this message).

I'm wanting to figure out how to call a perl script that will be able to display HTML content back to the screen, without doing either of these 2 things (just displaying everything and not running as a script, or giving a warning message before running and not affecting the browser screen)

Any ideas?
Thanks,
Ray

ps - I'm not sure if this is even the right forum to post in for running perl from an .asp page, using the CGI bin. Would that be the Perl forum, the ASP one or the CGI one?
 
I once had problems where the script would download instead of actually running, and then once it downloaded a dos window would open. I was never quite clear exactly how to fix it, but somehow it always ended up fixing itself. Anyway, if I were in your shoes, heres what i'd do:

Change your shebang line (Change compiler locations, change arguments, etc). Is the server platform you are running on windows nt?

Try your Content-type out as something different (text-plain?)


I'm also not seeing where the ASP comes in. Is the page an actual ASP page? I dont think it would make any difference if it was, but I'm not exactly a professional.

Hope that helps.
 
Your webserver isn't configured to run Perl scripts, have a look in the FAQ section here - Barbies FAQ on IIS is probably what you're looking for

HTH
Paul

It's important in life to always strike a happy medium, so if you see someone with a crystal ball, and a smile on their face ...
 
Have you thought of just using PERLscript in your ASP page? Check Activestates website the install FAQ are there.


haunter@battlestrata.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top