Perl for Win32

A

Armando Torres

I am learning Perl, and I have never programed before.
I wrote a script that uses a Network path, but in the network path
thee is a space, and it's not working; this is a sample:

$PVCSDatabase = "\\\\PC\\Vault\\temp\\my folder";
$SVRWEB = "C:/temp/eMitchell";
print " --- Getting Source Code...\n";
system("$PVCSClient get -pr$PVCSDatabase -a$SVRWEB -o -z -w
/archives")

It gives me an error becuse my folder.
If someone can give some ideas, or the place to get some info.

Thanks
 
T

Tassilo v. Parseval

[ f'up set to comp.lang.perl.misc ]

Also sprach Armando Torres:
I am learning Perl, and I have never programed before.
I wrote a script that uses a Network path, but in the network path
thee is a space, and it's not working; this is a sample:

$PVCSDatabase = "\\\\PC\\Vault\\temp\\my folder";
$SVRWEB = "C:/temp/eMitchell";
print " --- Getting Source Code...\n";
system("$PVCSClient get -pr$PVCSDatabase -a$SVRWEB -o -z -w
/archives")

It gives me an error becuse my folder.

This is because you pass one large string to system() in which case the
shell gets to see the command with the space in the path. You can use
system either with a list:

$PVCSDatabase = "\\\\PC\\Vault\\temp\\my folder";
$SVRWEB = "C:/temp/eMitchell";

my @args = "get", "-pr", $PVCSDatabase, "-a", $SVRWEB,
"-o", "-z", "-w", "/archives";
system($PVCSClient, @args);

or turn the path into something the shell will understand manually:

$PVCSDatabase = '\\\\PC\Vault\temp\"my folder"';

Better use single quotes here because it saves you some escaping. The
only thing that needs escaping then are the two backslashes of an UNC-path.

Tassilo
 
M

Mark Grimes

$PVCSDatabase = "\\\\PC\\Vault\\temp\\my folder";
system("$PVCSClient get -pr$PVCSDatabase -a$SVRWEB -o -z -w
/archives")

You want the system command to see something like this once it is all
evaluated:

pvcsclient get -pr"\\PC\Vault\temp\my folder" -ac:/temp/eMitchell -o -z
-w /archives

So, try something like:

system("$PVCSClient get -pr\"$PVCSDatabase\" -a$SVRWEB -o -z -w
/archives")
 
D

Dan Ayers

There is a space in $PVCSDatabase - the shell won't like that.
Try including quotes (\") in the string passed into the system() function

Dan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top