Database Reference
In-Depth Information
C:> set ORACLE_HOME=C:\oracle\product\db10.2
C:> FTYPE PerlProgram="%ORACLE_HOME%\perl\5.8.3\bin\MSWin32-x86-multi-thread\perl.ex
e" %1 %*
PerlProgram="C:\oracle\product\db10.2\perl\5.8.3\bin\MSWin32-x86-multi-thread\perl.e
xe" %1 %*
The character strings %1 and %* represent the first and the second to last arguments to pass
to perl.exe respectively. The former ( %1 ) will contain the full path to the script file, while the
latter ( %* ) will pass the remaining arguments to perl.exe .
Second, Windows requires an association between the extension of a file name and a file
type. Associations are maintained through the command ASSOC . Since the file name extension
for Perl programs is .pl , we need to associate .pl with the file type PerlProgram that we defined
previously.
C:> ASSOC .pl=PerlProgram
.pl=PerlProgram
Now, instead of running Perl programs with perl filename . pl , it is sufficient to type just
filename . pl . To demonstrate that both methods are indeed equivalent, we will use the following
Perl program:
print "Script name: $0\n";
for ($i=0; $i < 10; $i++) {
if (defined $ARGV[$i]) {
printf "Argument %d: %s\n", $i, $ARGV[$i];
}
}
Here's the output of running args.pl the old fashioned way, which requires slightly
more typing:
C:> perl args.pl first second third fourth
Script name: args.pl
Argument 0: first
Argument 1: second
Argument 2: third
Argument 3: fourth
The directory where args.pl resides should be in the command search path variable PATH .
Capitalizing on the association defined previously, you may now run this:
C:> args.pl first second third fourth
Script name: C:\home\ndebes\it\perl\args.pl
Argument 0: first
Argument 1: second
Argument 2: third
Argument 3: fourth
 
Search WWH ::




Custom Search