source: tags/gsdl-2_30d-distribution/gsdl/bin/windows/build.bat@ 2308

Last change on this file since 2308 was 1198, checked in by sjboddie, 24 years ago

altered the build and build.bat scripts as the old build.bat didn't
seem to work on windows 98 -- build.bat now uses runperl.bat - this gives
the added advantage that the perl code only exists in build, there's
no duplication in build.bat

  • Property svn:executable set to *
  • Property svn:mime-type set to application/octet-stream
File size: 2.2 KB
Line 
1@rem = '--*-Perl-*--
2@echo off
3if "%OS%" == "Windows_NT" goto WinNT
4perl -x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9
5goto endofperl
6:WinNT
7perl -x -S "%0" %*
8if NOT "%COMSPEC%" == "%SystemRoot%\system32\cmd.exe" goto endofperl
9if %errorlevel% == 9009 echo You do not have Perl in your PATH.
10goto endofperl
11@rem ';
12#!perl -w
13#line 14
14$0 =~ s|\.bat||i;
15unless (-f $0) {
16 $0 =~ s|.*[/\\]||;
17 for (".", split ';', $ENV{PATH}) {
18 $_ = "." if $_ eq "";
19 $0 = "$_/$0" , goto doit if -f "$_/$0";
20 }
21 die "`$0' not found.\n";
22}
23doit: exec "perl", "-x", $0, @ARGV;
24die "Failed to exec `$0': $!";
25__END__
26
27=head1 NAME
28
29runperl.bat - "universal" batch file to run perl scripts
30
31=head1 SYNOPSIS
32
33 C:\> copy runperl.bat foo.bat
34 C:\> foo
35 [..runs the perl script `foo'..]
36
37 C:\> foo.bat
38 [..runs the perl script `foo'..]
39
40
41=head1 DESCRIPTION
42
43This file can be copied to any file name ending in the ".bat" suffix.
44When executed on a DOS-like operating system, it will invoke the perl
45script of the same name, but without the ".bat" suffix. It will
46look for the script in the same directory as itself, and then in
47the current directory, and then search the directories in your PATH.
48
49It relies on the C<exec()> operator, so you will need to make sure
50that works in your perl.
51
52This method of invoking perl scripts has some advantages over
53batch-file wrappers like C<pl2bat.bat>: it avoids duplication
54of all the code; it ensures C<$0> contains the same name as the
55executing file, without any egregious ".bat" suffix; it allows
56you to separate your perl scripts from the wrapper used to
57run them; since the wrapper is generic, you can use symbolic
58links to simply link to C<runperl.bat>, if you are serving your
59files on a filesystem that supports that.
60
61On the other hand, if the batch file is invoked with the ".bat"
62suffix, it does an extra C<exec()>. This may be a performance
63issue. You can avoid this by running it without specifying
64the ".bat" suffix.
65
66Perl is invoked with the -x flag, so the script must contain
67a C<#!perl> line. Any flags found on that line will be honored.
68
69=head1 BUGS
70
71Perl is invoked with the -S flag, so it will search the PATH to find
72the script. This may have undesirable effects.
73
74=head1 SEE ALSO
75
76perl, perlwin32, pl2bat.bat
77
78=cut
79
80__END__
81:endofperl
Note: See TracBrowser for help on using the repository browser.