My OS is partially written in Perl. I naively installed, with a free and easy hand, many CPAN modules into library directories searched by my system perl, for which I was justly paddled. I have paid heavy penance for my foolishness by wiping my drive and reinstalling my OS, formerly polluted by oddball modules. I now plan to compile another development perl executable (and dump modules into its library space with a will).

However, tooling along the street and meditating about my plans, I stumbled upon an issue. My current project will be deployed on a remote web server. To make scripts run on it, I begin each with the hashbang #!/usr/bin/perl -T. Up to now, that's worked equally well when testing such scripts on my local machine, since that is where the system perl resides.

But if I compile another executable, it will require a different hashbang, say #!/lab/perl -T. Otherwise, dev perl present or no, my script will run on the system perl. Then, when I upload the script, I'll have to edit the hashbang.

I don't want to do this. What now?

Updates: Fascinating TMTOWTDI here!

MakeMaker schemes annoy me, sorry. When in the Wallow, I tend to edit one file, reupload, test, scratch my head, repeat. I want to tighten that inner loop, not obtrude extra steps. (I'm sure some better than I have got this down to single keystrokes invoking tar and make.)

I lied. (s/#!([^\/]+)/perl/#!\/\1\/perl -T/) I have been setting -Taint on all my uploaded scripts, for good and obvious reasons. Silly of me not to consider this context as related. I'd better pass on env. (Initiates may meditate on the pratfall I took through inadequate Laziness and false Hubris in not simply copying an actual hashbang line from one of my scripts instead of glossing it by hand.)

pl2bat is not intended for my OS, thank Torvalds. It's just as well; otherwise I'd spend an hour figuring out what that line does. Maybe I should anyway.

Debian alternatives would work well in this case, as Ubuntu is descended from it; but given my non-linear work habits, I would probably omit someday to switch perls and Encounter a Nasty Bit in my Soup. I have not yet discovered just how much of my system is written in Perl, nor do I care to commit to a strategy that forbids future developers of dancing bear desktop applets to write them in Perl. Nice idea, though.

Symlinks look good. I'd thought briefly in that direction but not in the right way. With respect, I think perhaps the more obvious solution is on localhost to install /lab/perl, on remotehost symlink /lab/perl to /usr/bin/perl, and write the hashbang line #!/lab/perl -T. This requires no Extended Study Hall on my part; I know how to work symlinks. I merely didn't think hard enough. scorpio17++

More or less idiotically, I forgot that /dev/ is used to incorporate devices into the Linux file system.


In reply to Dev Hashbang by Xiong

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.