Solved [Solved] What is the PROPER shebang for a new perl port?

Greetings,

I get annoyed by the output generated by (type)script(1). That is; the output
  1. has windows line endings (CRLF)
  2. maintains the ANSI control sequences (for replay)
I whipped up a simple perl(1) script to clean up the offending items. Then thought it might be (especially) useful for the pointyhats (committers) that have to review all requisite the QA logs submitters send along with their port(s). Anyway. To the point; given this is a Perl script, and that I noticed some rebuttal on the lists, regarding bash(1), and the differences between Windows, OSX,Linux vs FreeBSD treatment of the shebang. I wanted to ask if there was an official [shebang] standard I could follow.

Thoughts that come to mind;
Use the trick that the Perl install uses. That creates a symlink in /usr/bin (my first choice) or do it within the script, itself, using one of the following;
Code:
#!/usr/bin/env perl
or
Code:
#!/usr/local/bin/perl    # requires creating a symlink in /usr/bin
or something fancier
Code:
 #!/usr/local/bin/perl
    eval 'exec /usr/local/bin/perl -S $0 ${1+"$@"}'
	if $running_under_some_shell;
#!/usr/bin/perl
or in the ports Makefile
Code:
USES_PERL5+= shebangfix

So many choices. What's a person to do?

I really want to get this right, the first time. As I fear I've really tested the patience of some of the commiters, on some of my other ports.

Thank you for all your time, and consideration.

--Chris
 
Re: What is the PROPER shebang for a new perl utility port?

The first one is the preferred one. It should work everywhere regardless of where the real perl executable is. The last one that uses the shebangfix trick is for software that stubbornly insist on hardcoding the path in the shebang line.
 
Re: What is the PROPER shebang for a new perl utility port?

kpa said:
The first one is the preferred one. It should work everywhere regardless of where the real perl executable is. The last one that uses the shebangfix trick is for software that stubbornly insist on hardcoding the path in the shebang line.
Greetings, @kpa, and thank you for your reply!

env perl, it is, then.

If there were a thanks button available. I'd have pressed it. :)

Greatly appreciated, @kpa!

--Chris

P.S. I can't append [SOLVED] (title too long) :(
 
Last edited by a moderator:
Back
Top