Perl: Difference between revisions

imported>Nix
example using nix-shell in script
imported>Nix
create a "no /usr/bin/perl" section
Line 30: Line 30:
<code>Can't locate DB_File.pm in @INC (you may need to install the DB_File module)</code>: run it with <code>nix-shell -p perl -p perlPackages.DBFile --run ./myscript.pl</code>
<code>Can't locate DB_File.pm in @INC (you may need to install the DB_File module)</code>: run it with <code>nix-shell -p perl -p perlPackages.DBFile --run ./myscript.pl</code>


<code>./myscript.pl: bad interpreter: /usr/bin/perl: no such file or directory</code>: change the first line of the script to <code>#!/usr/bin/env -S perl</code> or start it with <code>perl ./myscript.pl</code>
=== There is no /usr/bin/perl ===
By design, there is no <code>/usr/bin/perl</code> in Nix. So you may encounter messages like:
 
<syntaxHighlight lang=shell>
./myscript.pl: bad interpreter: /usr/bin/perl: no such file or directory
</syntaxHighlight>
Change the first line of the script to
<syntaxHighlight lang=shell>
#!/usr/bin/env -S perl
</syntaxHighlight>
 
or start it with <code>perl ./myscript.pl</code>


==Adding something from CPAN to nixpkgs==
==Adding something from CPAN to nixpkgs==