Connecting to server from perl scripts

Hi,

I'm trying to run a simple protocol from a perl script.  If I run my scripts from within Discovery Studio, these scripts work fine.  I'm having trouble when I try to to run these under linux using perl (i.e. from the command-line).  The scripts fail to establish a connection to the pipeline pilot server.

Here's my script:

#!/usr/bin/env perl

use strict;

use DSCommands;

use VisProtocolCommands;

use Getopt::Std;

my %options=();

getopts("p:", \%options);

my \$pdbfile = 0;

if (\$options{p}) {

        \$pdbfile = \$options{p};

} else {

        die "usage: -p pdbfile\n";

}

my \$parameterMap = Protocol::ParameterMap::Create();

my \$server = "localhost:9943";

\$parameterMap->AddItem("Input Protein", \$pdbfile);

my \$runpath = LaunchProtocol("Protein Preparation", \$parameterMap, \$server);

print "\$pdbfile\n";

======================

Here's my output:

/opt/software/DiscoveryStudio40/bin/perl.sh proteinPrep.pl -p ~/mypdb.pdb

Connecting to server...

Warning: Failed to establish a connection with host localhost:9943. Please select another Pipeline Pilot Server to connect to.

        at VisProtocolCommands.pm line 71 in static function call Create

No server connection.

mypdb.pdb

===============================

Are there any environment parameters that I need to set, such as the location of the license file?  Here's the environment variables that I have set currently:

export ACCELRYS_LICENSE_USERNAME=\$USER

export ACCELRYS_LICENSE_PLATFORM="linux"

export AccelrysRoot=/opt/software/DiscoveryStudio40

export ACCELRYS_ROOT=\$AccelrysRoot

export LD_LIBRARY_PATH=\$AccelrysRoot/lib:\$LD_LIBRARY_PATH

export PERL5LIB=\$AccelrysRoot/lib/vendor_perl/5.8.9:\$AccelrysRoot/bin:\$AccelrysRoot/lib/5.8.9:\$PERL5LIB

export PERL5LIB=\$scriptsDir/DStudio:\$PERL5LIB

export PATH=\$AccelrysRoot/bin:\$PATH

Thanks.