I've seen I/O redirection broken by file associations on some systems, but not recently. I've never seen an answer as to why it is broken on some systems (but seems to work on most systems -- no obvious differences found between systems where it works vs where it doesn't). Though, it was badly broken on all systems for some early version of WindowNT (as I recall).

So you can probably stop using pl2bat, unless you have one of the rare systems that strangely still exhibit this problem.

I've put pl2bat to some good uses (CleanPath, editd, SSH Agency, vienv - Edit local environment variables on Win32, etc.), uses that wouldn't work with a *.pl file.

I never claimed that everybody would find jumping through the pl2bat hoop less painful than jumping though the PATHEXT hoop. There is already boilerplate that I include when I start a new Perl script so the extra boilerplate from pl2bat doesn't really add anything to the amount of work required to write a new Perl script (perhaps some people are just doing it wrong).

I have a lot of experience with writing Perl scripts that I want to use on lots of different (Windows) computer systems or that other people want to use on other computers. So jumping through the PATHEXT hoop over and over and over again gets old pretty fast. And using pl2bat meant that it was trivial to detect that perl.exe wasn't in the path and then to mount my network share that has Perl on it and distribute a Perl script as a *.bat file that would work on any computer in our intranet.

Running pl2bat couldn't be simpler (no options to specify, just enter the filename via tab completion), but I rarely run it anyway, at least not by hand. Most of my Perl scripts are either single-copy scripts that I just keep on my primary system as *.bat files or are in a source code repository and so there are scripts that know how to "install" them (steps such as some subset of: copy them to a directory in my $ENV{PATH}, "chmod +x" them, set the path to Perl on the #! line to work on the current system, run pl2bat, etc.).

The only thing about pl2bat that bothers me, is that sometimes I initially forget to use "call" when dealing with *.bat files calling other *.bat files.

- tye        


In reply to Re^4: .pl or shebang (.bat) by tye
in thread .pl or shebang by targetsmart

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.