in reply to Add directry to @INC system wide

Maybe, you can edit the system wide perl customization file?
Run the following one liner to see if your Perl installation was compiled supporting this hook:

perl -MConfig -e 'print $Config{usesitecustomize} ? "yes, edit $Confi +g{sitelib}/sitecustomize.pl" : "no luck", "\n"'

Then, in ..../sitecustomize.pl:

use lib qw(/my/preferred/dir); print "SITECUSTOMIZE: INC: @INC\n" if $ENV{DEBUG_SITECUSTOMIZE}; # j +ust for fun

However, users can prevent loading this file using the -f switch (see perlrun). If this is not acceptable, you need to compile your own perl executable as other monks already suggested.

Replies are listed 'Best First'.
Re^2: Add directry to @INC system wide
by Anonymous Monk on Mar 07, 2013 at 21:56 UTC

    Maybe, you can edit the system wide perl customization file?

    That can be disabled -- meaning not always passed through -- the only way to permanently add paths which cannot be disabled is to compile-them-in

    OTOH, simply installing modules in @INC to begin-with avoids the problem of needing to add paths to @INC

      Just in case anyone else should follow this node;
      It occurs to me that one could also create a module that "pre-pends" the desired
      additional directory the system' include path, which could then become a system
      wide include, by creating a wrapper for the Perl executable.
      If the module name were "prepend-lib-path.pm" the "wrapper" that disguises itself as
      Perl proper, would contain:
      use prepend-lib-path;
      While not an excuse to omit "lib" paths you might later decide you need;
      it might help in a pinch.

      HTH

      #!/usr/bin/perl -Tw
      use perl::always;
      my $perl_version = "5.12.4";
      print $perl_version;