Perl: Difference between revisions

imported>Nix
add link to Perl section of Nixpkgs manual
imported>Nix
→‎Invoking nix-shell on command-line: fix nix-shell commandline example
Line 28: Line 28:
=== Invoking nix-shell on command-line ===
=== Invoking nix-shell on command-line ===


<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>
If you run a perl script and encounter a dependency error like this:
 
<syntaxHighlight lang=shell>
Can't locate DB_File.pm in @INC (you may need to install the DB_File module)
</syntaxHighlight >
 
... use <code>nix-shell</code> to create a shell environment which includes the dependency. Here we searched NixOS packages and found an existing perl package which suits, [https://search.nixos.org/packages?channel=unstable&from=0&size=30&sort=relevance&type=packages&query=dbfile like so].
 
<syntaxHighlight lang=shell>
nix-shell -p perl perl534Packages.DBFile --run ./myscript.pl
</syntaxHighlight >


=== There is no /usr/bin/perl ===
=== There is no /usr/bin/perl ===