Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

comment on

( [id://3333] : superdoc . print w/replies, xml ) Need Help??
You have a couple of choices:
  • create a custom perl binary (embed perl, easier on win32 than most), which does the neccessary mojo to show the script filename on win32
  • compile the script with pp
  • compile the script with perlbin (development of which is kind of stalled though, but it does work on win32)
update: Heard of runperl.bat? Just write a compiled program to do this.
update: or just modify runperl (add title perl %0) and it will show up in task manager under applications as perl "some/path.bat"
update: has the ability to show how perl was invoked (better than task manager).
@rem = '--*-Perl-*-- @echo off title perl %0 if "%OS%" == "Windows_NT" goto WinNT perl -x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9 goto endofperl :WinNT perl -x -S %0 %* if NOT "%COMSPEC%" == "%SystemRoot%\system32\cmd.exe" goto endofperl if %errorlevel% == 9009 echo You do not have Perl in your PATH. if errorlevel 1 goto script_failed_so_exit_with_non_zero_val 2>nul goto endofperl @rem '; #!perl -w #line 15 $0 =~ s|\.bat||i; unless (-f $0) { $0 =~ s|.*[/\\]||; for (".", split ';', $ENV{PATH}) { $_ = "." if $_ eq ""; $0 = "$_/$0" , goto doit if -f "$_/$0"; } die "`$0' not found.\n"; } doit: exec "perl", "-x", $0, @ARGV; die "Failed to exec `$0': $!"; __END__ =head1 NAME runperl.bat - "universal" batch file to run perl scripts =head1 SYNOPSIS C:\> copy runperl.bat foo.bat C:\> foo [..runs the perl script `foo'..] C:\> foo.bat [..runs the perl script `foo'..] =head1 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 C<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 C<pl2bat.bat>: it avoids duplication of all the code; it ensures C<$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 C<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 C<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 C<#!perl> line. Any flags found on that line will be honored. =head1 BUGS Perl is invoked with the -S flag, so it will search the PATH to find the script. This may have undesirable effects. =head1 SEE ALSO perl, perlwin32, pl2bat.bat =cut __END__ :endofperl

MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
** The third rule of perl club is a statement of fact: pod is sexy.

In reply to Re: How can I check which perl script is running in Windows? by PodMaster
in thread How can I check which perl script is running in Windows? by pijush

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.