ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl-win32-users
perl-win32-users
Re: Back-slashes & calling a batch file from perl ???
by $Bill Luebkert other posts by this author
Oct 28 2005 10:07PM messages near this date
view in the new Beta List Site
Re: Back-slashes & calling a batch file from perl ??? | Re: Back-slashes & calling a batch file from perl ???
Michael D Schleif wrote:
>  
>  One more way to explain this:
>  
>  [A] Using Code #1, the Perl mkdir successfully creates $dir/$dest, and
>  goes on to call $prog.  $prog fails, because it will not accept $dir as
>  a valid directory while using forward-slashes (/).  At one trial, the
>  stderr returned was this:
>  
>      Invalid switch - "backup\20051028070933".

Stop right there.  That tells me you want to use /'s for the mkdir and
that part is solved.  Now let's go to the calling of the $prog.  If you
than reverse the slashes and call $prog with the \'s (from part #2),
the bat file should be satisfied.  So use the top of #1 and the do_prog
of #2 and you should be fine per your descriptions.

>  [B] Using Code #2, the Perl mkdir does *NOT* create $dir/$dest; nor does
>  it croak, nor does it die !?!?  Nevertheless, the Perl code goes into
>  $prog; but, the BAT code cannot copy files into %1\%2, because that
>  directory does *NOT* exist, because the Perl code somehow did *NOT*
>  mkdir it !?!?

That doesn't make any sense.  The mkdir code is the same.  Did you
rmdir the created dir after running #1 so #2 had the same situation ?

>  I know that this is bizarre behavior.  I cannot explain it -- hence, my
>  series of incomprehensible posts ;<
>  
>  Is this explication any clearer?

Yes - it's clearer, but can't be true since the code is identical
except for the s///.  Try putting an else on the mkdir ifs and
do a print out if the mkdir is bypassed.  That should help clear
up what's going on there.

EG:

if (not -d $dir) {
	mkdir $dir or die "mkdir $dir: $! ($^E)";
	print "mkdir $dir completed\n";
} else {
	print "mkdir $dir not needed\n";
}

And the same for the other ones.
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
Michael D Schleif
Michael D Schleif
Chris Wagner
$Bill Luebkert
$Bill Luebkert
Michael D Schleif
$Bill Luebkert
Michael D Schleif
$Bill Luebkert
Michael D Schleif
$Bill Luebkert
James Sluka
Ted Zeng
$Bill Luebkert
Ted Zeng
Paul
Peter Eisengrein
Trevor Joerges
Jim Guion
$Bill Luebkert
James Sluka
$Bill Luebkert
Chris Wagner

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved