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

Reference
ActivePerl 5.6
Programs
GET
HEAD
POST
SOAPsh
XMLRPCsh
c2ph
cpan
dprofpp
enc2xs
exetype
find2perl
h2ph
h2xs
libnetcfg
lwp-download
lwp-mirror
lwp-request
lwp-rget
perlbug
perlcc
perlglob
perlivp
piconv
pl2bat
pl2pm
pod2html
pod2latex
pod2man
pod2text
pod2usage
podchecker
podselect
ppm
ppm3
ppm3-bin
psed
pstruct
ptked
ptksh
reloc perl
runperl
s2p
splain
widget
xsubpp

MyASPN >> Reference >> ActivePerl 5.6 >> Programs

 runperl.bat - "universal" batch file to run perl scripts


NAME

runperl.bat - ``universal'' batch file to run perl scripts


SYNOPSIS

        C:\> copy runperl.bat foo.bat
        C:\> foo
        [..runs the perl script `foo'..]

        C:\> foo.bat
        [..runs the perl script `foo'..]


DESCRIPTION

This file can be copied to any file name ending in the ``.bat'' suffix. When executed on a DOS-like operating system, it will invoke the perl script of the same name, but without the ``.bat'' suffix. It will look for the script in the same directory as itself, and then in the current directory, and then search the directories in your PATH.

It relies on the exec() operator, so you will need to make sure that works in your perl.

This method of invoking perl scripts has some advantages over batch-file wrappers like pl2bat.bat: it avoids duplication of all the code; it ensures $0 contains the same name as the executing file, without any egregious ``.bat'' suffix; it allows you to separate your perl scripts from the wrapper used to run them; since the wrapper is generic, you can use symbolic links to simply link to runperl.bat, if you are serving your files on a filesystem that supports that.

On the other hand, if the batch file is invoked with the ``.bat'' suffix, it does an extra exec(). This may be a performance issue. You can avoid this by running it without specifying the ``.bat'' suffix.

Perl is invoked with the -x flag, so the script must contain a #!perl line. Any flags found on that line will be honored.


BUGS

Perl is invoked with the -S flag, so it will search the PATH to find the script. This may have undesirable effects.


SEE ALSO

perl, perlwin32, pl2bat.bat

 runperl.bat - "universal" batch file to run perl scripts


Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState 2004 All rights reserved