<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:DengXian;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"\@DengXian";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-AU link="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoNormal>Hi all,<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I was looking at “Bug 20582 - Turn Koha into a Mojolicious application” when I noticed that some of the scripts were using “#!/usr/bin/env perl” instead of “#!/usr/bin/perl”. While there is no requirement in the Coding Guidelines to use “#!/usr/bin/perl”, I thought it would be best for all our Perl scripts to be consistent.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>However, now I’m weighing up the options.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Conceptually, using “#!/usr/bin/env perl” means that we can use perlbrew/plenv (or manually provide a different Perl in our $PATH) when running these scripts, so that we don’t have to use the system Perl located at /usr/bin/perl. <o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>That said, I was concerned about how most CGI scripts have “#!/usr/bin/perl” in them and the implications that might have if we invoked Starman/Morbo/Hypnotoad with a different Perl, but looking at Plack::App::CGIBin, CGI::Emulate::PSGI, Plack::App::WrapCGI, CGI::Compile, and Koha::App::Plugin::CGIBinKoha makes me think that the shebang in CGI scripts is ignored when using these Perl application servers, since they’re just read as Perl code and not handed to the exec() family of kernel syscalls. <o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Starman/Morbo/Hypnotoad have been installed with /usr/bin/perl shebangs, so they’ll use the system Perl by default, but I think if they were installed using plenv and Carton for instance that they’d have their shebangs rewritten appropriately. We could also invoke Starman/Morbo/Hypnotoad with the version of Perl that we desire. <o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>So ultimately… I suppose the most reasonable thing to do is probably to mandate “#!/usr/bin/perl” for all Koha Perl scripts? If someone does want to use a different Perl, I suppose the onus is on them to make sure they execute Koha Perl scripts with a different Perl binary? <o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Also, do people think there is a point in repairing existing Koha Perl scripts that have ‘#!/usr/bin/env perl’ instead of ‘#!/usr/bin/perl’?<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Cheers,<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>David Cook<o:p></o:p></p><p class=MsoNormal>Software Engineer<o:p></o:p></p><p class=MsoNormal>Prosentient Systems<o:p></o:p></p><p class=MsoNormal>72/330 Wattle St<o:p></o:p></p><p class=MsoNormal>Ultimo, NSW 2007<o:p></o:p></p><p class=MsoNormal>Australia<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Office: 02 9212 0899<o:p></o:p></p><p class=MsoNormal>Online: 02 8005 0595<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p></div></body></html>