|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|||
|
NT Batch - Help me understand this batch feature
While looking for ways to automate some things in ClearCase (ibm's source control), i found following file, and it works fine in regular command prompt (WinXP). but I don't understand HOW!
I know what perl code there does, i understand why it jumps over it with goto. what I don't understand how does "ccperl" command knows to take input from that section! Code:
@echo off
ccperl %0 %1 %2 %3 %4 %5 %6 %7 %8 %9
goto endofperl
@rem ';
my @priv = `cleartool lsprivate -tag $ARGV[0]`;
foreach $priv (@priv)
{
print $priv;
}
__END__
:endofperl
|
|
|||
|
ah! ok, that kinda makes sense. thank you!
so basically it will execute "ccperl mybatch.bat", and I'm guessing this clearcase version of perl knows how to ignore the batch commands and interpret only the perl code. i'll look for ccperl docs.. Thanks! |
|
||||
|
Okay, I understand it a little better now. The @echo off line plays double duty. In addition to it's normal dos batch behavior, the initial @ sign means when perl starts it things you're declaring an array variable named echo. So that line is valid batch and valid perl at the same time. With no line terminator (; character), everything up to @rem '; is part of that declaration. You need @rem on the end so batch interprets the line as a comment and doesn't complain.
-- sort of. The other examples I saw all used something like this on the first line: @rem= 'PERL for Windows NT - ccperl must be in search path That makes a lot more sense, because you're actually initializing a string variable, and batch will still ignore it. I don't know how the perl interpreter handles things with just the @echo off, since you never told it you were starting a string. Are you maybe missing a line? |
|
|||
|
yes, you're absolutelly right! i took it out before posting here trying to keep it simple w/o realizing its purpose. thank you!
and the purpose would be keeping it all in one file. |
![]() |
| Viewing: Dev Hardware Forums > SOFTWARE > Programming > NT Batch - Help me understand this batch feature |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|