[sf-perl] dynamic #! line
Chris Weyl
cweyl at alumni.drew.edu
Tue Mar 24 12:28:14 PDT 2009
On Mon, Mar 23, 2009 at 5:48 PM, Matthew Lanier <matt at lanier.org> wrote:
>
> long story, i'm trying to not modify the startup context if i don't need
> to.
>
> as dfetter suggested, '/usr/bin/env perl' works, though it appears to work
> via perl being in the path.
>
On some boxes at $work, we have very old or otherwise wonky Perl
installations as the system Perl. I've built and installed a newer Perl on
these boxes; to use the new Perl transparently I created a small module that
checks $^X to see what's currently executing the script. If it's the old
system Perl and the new Perl is available, we exec ourself under the new
Perl; if we're running under the new Perl (or it's unavailable), it's a
no-op.
This works nicely as it's use'd, and so gets run nice and early. I'd
imagine if you had to, you could rig it to reexec with more command-line
parameters...
-Chris
--
Chris Weyl
Ex astris, scientia
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/sanfrancisco-pm/attachments/20090324/5d5be0f0/attachment.html>
More information about the SanFrancisco-pm
mailing list