SUPPORT > SCRIPTING FAQ
Send us a question or comment

   

Can I write CRT™ scripts in Perl?

Yes. If you have installed the PerlScript engine then you can run CRT scripts written in Perl. You can download and find information regarding Perlscript from:

http://www.activestate.com

When using Perlscript there are a couple of issues you should be aware of that will make debugging your scripts easier:

By default runtime errors in your Perlscript won't be reported unless you enable warnings about these errors. Be sure you include these lines in your script if you want to be informed of errors:

# Perl doesn't warn about errors by default. Enable errors.
use Win32::OLE;
Win32::OLE->Option(Warn => 3);

Another problem you may find with Perlscript is that runtime errors that occur within the "main" routine invoked by CRT aren't reported back to CRT in an informative manner. This is believed to be a bug that was present in the latest implementation of Perlscript (build 518). The following simple script demonstrates the problem:

# $language = "PerlScript"
# $interface = "1.0"

# Perl doesn't warn about errors by default. Enable errors.
use Win32::OLE;
Win32::OLE->Option(Warn => 3);

# display the version
$crt->Dialog->MessageBox($crt->{'Version'});

# 1. generate an error: invalid property $crt->Dialog->MessageBox($crt->{'XYZZY'});

sub main {

# display the version
$crt->Dialog->MessageBox($crt->{'Version'});

# 2. generate an error: invalid property
$crt->Dialog->MessageBox($crt->{'XYZZY'});

}

This script gets a runtime error when it tries to fetch an invalid property both at the global level and within the "main" routine. The first runtime error should display some verbose information indicating the line and the nature of the problem, however the second runtime error will simply be reported as "main failed..." with no indication why. CRT will invoke your main subroutine if it exists, but you are not required to have one. In order to work around this problem you may want to develop your Perlscript code outside of a main subroutine.

Was this information helpful?
Yes No
Thank you!
Send your comments and questions to VanDyke Software Support,
or join the discussion in the VanDyke Software Forums.
Can't find the answer you're looking for?
Ask VanDyke Software Support directly
and we will get back to you as soon as possible.
1.  Read or download one of our secure solutions white papers. 2.  Download a free
30-day evaluation copy of our products.
3.  Let us help define the right Secure Shell solution for your company. 4.  Subscribe to our What's New page for tips, solution ideas, and product news.