Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
WSH and PerlScript
I thought it would be nice to use Perl in QM. I have no experience with COM or WSH, but I managed to hack together these functions for the ActiveState PerlScript engine using Gintaras' VBScript functions as a template.

They seem to work fine so far, though I haven't thrown anything too complex at them yet. The one problem I am having though, is that if there is an error in the perl code, it isn't returned. It looks as if it is always returning positive, so it never gets to err, and I'm not sure why. Fortunately though, when your syntax is correct, everything runs fine.

If anyone can shed some light on this, I'd appreciate it. When its finished, I figured I would post it in the Resources area, in case anyone else would like it. Or maybe Gintaras would want to include it in the next QM release.

Here is what I have so far:
Thank you, but

Quote:Error (RT) in PerlExec: 0x800A017C,
A script engine for the specified language can not be created.

Where I can get the Perl script engine?
Downloaded from

As you said, works well, but does not throw errors.

PerlExec2: use pls extension, because pl opens in notepad.
Probably throwing errors is not implemented in PerlScript, or needs to change some setting within Perl code.

Would be nice to see this in the Resources forum.
.pl is the standard extension for perl scripts, I have *.pl files associated with perl.exe, which is why it worked for me. In fact, .pls doesn't work on my PC because that extension is for a music playlist. I guess the vbs and js files never have this problem because they are automatically registered when you install Windows.

I made an alternative that executes the file by running perl.exe directly, but I don't think it can share variables because it isn't going through WSH.

As for the error reporting, I'll poke around a little more to see if I can learn anything. If not, then I guess it'll just have to go without until they update it.

I'm also anxious to see if this can be used to gain added functionality in QM from the many perl modules available.
Sorry for the slow reply, I was looking further through the docs and came across another way of possibly doing this using PerlEZ, which creates the Perl Interpreter through a DLL file. I will try this when I get a chance. ... erlEz.html
Although ExecuteStatement etc does not throw error, but it sets Error.Number to a nonzero value. Change two last lines to:

In PerlExec:
Copy      Help
_PerlScript.ExecuteStatement(statement); err end _error
if(_PerlScript.Error.Number) end VbsError(_PerlScript)

In PerlEval:
Copy      Help
VARIANT v=_PerlScript.Eval(expression); err end _error
if(_PerlScript.Error.Number) end VbsError(_PerlScript)
ret v

In PerlAddCode:
Copy      Help
_PerlScript.AddCode(code); err end _error
if(_PerlScript.Error.Number) end VbsError(_PerlScript)

In PerlFunc:
Copy      Help
VARIANT v=_PerlScript.Run(func &a); err end _error
if(_PerlScript.Error.Number) end VbsError(_PerlScript)
ret v

Forum Jump:

Users browsing this thread: 1 Guest(s)