Clean shell runtime to start Perl system?

I need to create several Perl programs in a Solaris 9 SPARC environment using Oracle EBS, one of which will be run by cron. The UNIX account that Perl will run on has all the environment variables configured to run Oracle-oriented programs, so when I run "/ usr / bin / perl -V", I get the following compilation error. Fortunately, Perl on Cron is not affected by the settings of the Oracle environment.

bash-2.05$ /usr/bin/perl -V Perl lib version (5.00503) doesn't match executable version (5.008) at /u01/app/applmgr/pr/iAS/Apache/perl/lib/5.00503/sun4-solaris/Config.pm line 7. Compilation failed in require. BEGIN failed--compilation aborted. 

My first thought was to use the BEGIN block to clean some houses, so I can use the Perl system rather than the supplied version of Oracle EBS.

 #!/usr/bin/perl BEGIN { delete $ENV{PERL5LIB}; delete @INC[0..$#INC]; push @INC, map { "/usr/local/lib/perl5/$_" } ( '5.8.0','5.8.0/sun4-solaris', 'site_perl','site_perl/5.8.0','site_perl/5.8.0/sun4-solaris' ); } print "Hello clean Perl environment! :)\n"; 

Am I not allowed to change the local UNIX account profile, so is this the right way to handle this script?

+4
source share
1 answer

The -i option to the env command allows programs to run in a clean environment. From now on, env manpage:

  -i, --ignore-environment start with an empty environment 

For perl example:

 env -i perl -V 
+4
source

Source: https://habr.com/ru/post/1486121/


All Articles