Solved

.ASP calling Perl SSI

Posted on 2003-10-22
14
1,036 Views
Last Modified: 2007-12-19
I have a very complex Server Side Perl script stored in a file called "complex.pl".

I have a very simple Active Server Page (Server Side) called "helloworld.asp".

I run both on IIS 5.

I want my ASP to call my Perl script. I want both to be server side interpetted, ran, and then rendered.

I'm only getting as far as getting my ASP ran by the server, but the SSI command executing the Perl Script being printed in my output view source.

For instance, my source looks like this:

<%
response.write "Hello. Here is the output of my complex script below:<p>" & vbcrlf
%>
<!--#exec cgi="/cgi-bin/complex.pl"-->

Any my redered "view source" looks like this:

Hello. Here is the output of my complex script below:
<!--#exec cgi="/cgi-bin/complex.pl"-->

What's wrong here?

stephen@ufoundme.com
0
Comment
Question by:KennedyStephen
  • 9
14 Comments
 
LVL 15

Expert Comment

by:periwinkle
ID: 9602551
I'm not convinced that this will work.  The ASP will be parsed by the ASP parser/interpretter, not the Perl one...
0
 
LVL 15

Expert Comment

by:periwinkle
ID: 9602574
A little more detail on this thought - server side includes will not function, for instance, in the output of a Perl CGI Script.  This is because the Perl/CGI interpretter is producing the results, and the page produced is  not 'reparsed' by the server parser that interprets the server side includes.

I would expect that this would work in a similar fashion - that the ASP parser won't reparse the output of the ASP program.  

Instead, if this can be done, I would expect that you would need to call the Perl program from within the ASP code.
0
 
LVL 15

Expert Comment

by:periwinkle
ID: 9602598
Ah, I found the answer in the O'Reilly book 'ASP in a Nutshell'.  Only the #include directive is allowed in both HTML and ASP pages.
0
 
LVL 15

Expert Comment

by:periwinkle
ID: 9602652
Here's different thought - what about including an ASP script and a Perl script within a .shtml file, like:

<!-- #exec cgi="/cgi-bin/perscript.pl" -->
<!-- #exec cgi="/aspscript.asp"-->
0
 
LVL 15

Expert Comment

by:periwinkle
ID: 9602717
Hmmm - here's some more promising information.  Are you on a server that uses ActiveState's ActivePerl?  Then you can do perl from within ASP:

http://aspn.activestate.com/ASPN/docs/ActivePerl/Windows/ActiveServerPages.html
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

Author Comment

by:KennedyStephen
ID: 9603306
Wow. Thank you for a quick response! I really appreciate your help. I thank you so much.

I'm beginning to think this IS impossible.

We do use ActivePerl. But those instructions on the link you provided use a "special form" of Perl built inside an ASP. The "special form" of Perl is not very friendly and cannot produce the same results as my "complex" Perl script. I am looking to run a "normal" Perl script in an ASP.

Also, I pass FORM VARIABLES from one .ASP to another. When I build the .ASP inside the .SHTML I lose my ability to use the FORM VARIABLES that get passed from one .ASP to another.

This seems like something one SHOULD be able to do very easily. I couldn't imagine how hard this was going to be.
0
 
LVL 15

Expert Comment

by:periwinkle
ID: 9603450
You'd think it would be easy, but I haven't yet found any evidence that an external program can be run and return results to the asp one....

0
 
LVL 15

Expert Comment

by:periwinkle
ID: 9603472
Hmmm - could you use PerlScript to execute an external program?  I.e. can you do this:

$somevariable = `perl /path/to/program/yourscript.pl`;

or

system('perl /path/to/program/yourscript.pl');

or the like?
0
 
LVL 15

Expert Comment

by:periwinkle
ID: 9603521
Here's more on that idea:

AspExec™ - allows you to execute DOS and Windows apps. DOS programs which return results via stdio can be executed and the results are returned as a string. You can optionally set a timeout to wait for either Dos or Windows applications.

http://www.serverobjects.com/products.htm#free

(found this through the following conversations:

http://forums.aspfree.com/t9647/se87d57f437c46c352a7c2309633ba99f.html
http://www.aspfaqs.com/aspfaqs/ShowFAQ.asp?FAQID=67
 
which also mentions that there is a Microsoft-supplied component, "WScript.WShell" that you can use to do this, like:

Dim oShell, myShell
Set oShell = Server.CreateObject ("WScript.Shell")
oshell.run "command"

0
 
LVL 4

Accepted Solution

by:
hamidovt earned 30 total points
ID: 9605133
you can not run PERL in ASP,
but you can use frame/iframe in ASP page where you refer to perl file.

That is what I do when have some perl pages and I am too lazy to rewrite it in ASP or it is too difficult to make it in ASP
0
 
LVL 15

Expert Comment

by:periwinkle
ID: 11785614
PashaMod - I think that hamidovt  has the answer - i.e. that it really can't be done.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Set cookies HttpOnly and Secure 4 108
C# GridRow get Old/New Value 1 55
I need help embedding Base64 Images using VB.Net - When image is a .jpg 2 41
Animated .jpg? 13 57
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Developer portfolios can be a bit of an enigma—how do you present yourself to employers without burying them in lines of code?  A modern portfolio is more than just work samples, it’s also a statement of how you work.
This video teaches users how to migrate an existing Wordpress website to a new domain.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now