CFEXECUTE to run a Perl script not returning anything
Copy link to clipboard
Copied
<CFEXECUTE NAME="/var/www/cgi-bin/something.pl" TIMEOUT="60"/>
but there is no output. This works from the command line and from the browser (running CFHTTP is not a great substitute here).
I've read on the forums that this could be a permission issue, but I'm not getting an error. The documentation for CFEXECUTE says "If the effective user of the ColdFusion executing thread does not have permissions to execute the process: a security exception." So why no exception? FYI, I'm running ColdFusion 7 on Linux.
I know that CFEXECUTE by itself works because this tag works and returns the date/time: <CFEXECUTE NAME="date" TIMEOUT="60"/>
If ColdFusion does need to have different permissions and/or run as a different user in order to run a Perl script, how do you set this up? And is this a big security issue if it's on a public web server?
Thanks for any input.

Copy link to clipboard
Copied
I've executed perl on a Windows server by putting the perl executable itself as the name, and the script name as the first argument. May or may not address your issue, but could be worth a try...
James
<cfexecute name="C:\Perl\bin\perl.exe" timeout="60"
arguments="#ExpandPath('script.pl')# #otherArgs#"/>
Copy link to clipboard
Copied
However, if I put in a script name that doesn't exist:
<CFEXECUTE NAME="/usr/bin/perl" ARGUMENTS="doesntexist.pl" TIMEOUT="60"/>
I don't get an error. It's just not attempting to execute anything.

Copy link to clipboard
Copied
What happens if you give a full pathname to the script? In your example, you just had doesntexist.pl without a full path.
Seems like perl is running, but it might be outputting an error to stderr. Does CFEXECUTE capture stderr output, or only stdout? (I don't know offhand.)
James
Copy link to clipboard
Copied
I don't think CFEXECUTE captures stderr output.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
I had a similar problem a while back that drove me mad for days, related to attempting to execute svn.exe with various parameters. The cleanup and info actions worked fine, but the update action would fail (and hang the cmd.exe process). Turns out I found a command line switch to explicitly pass along my svn credentials, and that did the trick.
Have you successfully CFExecuted ANY Perl script? If you try one that simply echoes a hello, does that work?
Copy link to clipboard
Copied
Hi,
The perl script runs fine from the command line but when I execute the same perl script using the coldfusion cfexecute it fails to run.
It cannot find the methods/functions used in the perl script like SelectAllEditableRanges, Bookmarks, InsertAfter. The script fails whereever this functions are called in the perl script.
How do I run the perl script using cfexecute.
Thanks.
Copy link to clipboard
Copied
Show us what you're using for the cfexecute attributes, and the command you use at the command line.
Also, I'm not sure it's wise to just drop a reply into a 12 year old thread like this. It's possible the previous participants either are no longer involved, not able to help, or may even not want to hear from us (if they're setup to receive amail notifications of replies in this thread).
/Charlie (troubleshooter, carehart. org)
Copy link to clipboard
Copied
I have a perl script which runs fine from the command prompt but fails to run the coldfusion using cfexecute
<CFEXECUTE NAME="c:\perl64\perl.exe" ARGUMENTS="c:\temp\test.pl #filename# #empno#" TIMEOUT="100"> </CFEXECUTE>
In the test.pl I open the #filename# word document and find the bookmark employee number and update the bookmark with the #empno# value.
The script runs with out any errors from command prompt. But, when I run from coldfusion the word running in the background and the only way to fix the stalling is to terminate the process.
I have tested the hello.pl using the cfexecute and it works fine from the coldfusion.
Copy link to clipboard
Copied
What's the value of #filename#? If it's a relative vs absolute path, that may be your problem.
If that's not it, simplify things to find what perhaps DOES work if you make changes, such as calling a simpler pl file, or something other than perl, etc.
/Charlie (troubleshooter, carehart. org)
Copy link to clipboard
Copied
The #filename# is c:\temp\test.doc. cfexecute opens the word document fine.
In the perl script I call other methods like bookmark and cfexecute fails to find the methods in the word.
Any idea if I need to use the cf_exec tag?
Copy link to clipboard
Copied
I'm out of ideas for now. Have only been answering off the top of my head not testing things. Maybe someone else (or I, later) may see the solution for you. There must be one, or a clear explanation why what you want to do doesn't work.
But as that other option was indeed offered in the other thread you opened on the cf portal, it's worth a shot if you're pressed for time.
/Charlie (troubleshooter, carehart. org)
Copy link to clipboard
Copied
I did a quick search for SelectAllEditableRanges, and it seems your perl script is possibly using Microsoft Office Automation to process the document. It's probably trying to execute MS Word and that's where it could be failing. This article may be of use to you:
http://shamcf.blogspot.com/2014/08/not-able-to-run-vbscript-using.html

