in reply to How to manipulate @INC in a script?

use lib '/home/me/lib';
adds the directory to the front of @INC at compile time.

Replies are listed 'Best First'.
Re^2: How to manipulate @INC in a script?
by radiantmatrix (Parson) on Sep 21, 2004 at 15:56 UTC
    In addition to use lib, you can also use -I<path> on the command line like:
    $ /usr/bin/perl -I"/home/me/lib" myscript.pl
    or in your shebang line like:
    #!/usr/bin/perl -I"/home/me/lib"
    --
    $me = rand($hacker{perl});

    All code, unless otherwise noted, is untested

      Don't know if this is true just of Win32 (running ActivePerl 5.6.1 (633)) but if you use quotes in the shebang line it doesn't work.

      i.e.

      #!/usr/bin/perl -I"/somedir/"

      ..won't work but

      #!/usr/bin/perl -I/somedir/

      .. will.

      The /usr/bin/perl wouldn't be strictly correct on Win32, but under ActivePerl it doesn't seem to matter (could set it to the proper DOS path if required).

Re^2: How to manipulate @INC in a script?
by Seventh (Beadle) on Sep 21, 2004 at 14:42 UTC
    Well, I feel silly now. :) Thank you very much!