On Jul 28, 10:59 pm, nora.hac...@stgkk.at ("HACKER Nora") wrote: > Hi list, > > Maybe one of you has a clue why I get a false error message when using > Env::Sourced. My (test-)script is as follows: > > #!/usr/bin/perl -w > use strict; > use warnings; > require Env::Sourced; # "require" necessary in main programme, just not > changed for testing > > my $w_conf = $ENV{'W_UMG_CONFIG_PFAD'}; > my $oraenv; > my $orapat = '9208'; > > print "Environment BEFORE:\n", `env |grep ORA`, "\n"; > > if ( $orapat ne 'D' ) { > $oraenv = "$w_conf/ora$orapat.env"; # coalesce path + filename > print "OraEnv: $oraenv\n"; # check absolute file name > Env::Sourced->import($oraenv) or warn "Fehler beim Setzen des > Oracle-Environments: $!\n"; # set environment > > } > > print "\nEnvironment AFTER:\n", `env |grep ORA`, "\n"; > > BUT I get the following output: > > oracle:/opt/data/magna/wartung/work/nora>./test.pl > Environment BEFORE: > ... > > OraEnv: /opt/data/magna/umgebungen/config/ora9208.env > Fehler beim Setzen des Oracle-Environments:
The Env::Sourced import method only looks at the files passed to the constructor and sets variables it finds in ENV. IIUC, couldn't you just set oraenv directly at runtime: $oraenv = "$w_conf/ora$orapat.env"; # coalesce path + filename ^^^^^^^^^ $ENV{ oraenv } = "$w_conf/ora$orapat.env"; > ... > > The absolut path to the environment file is ok, and judging from the > "Environment AFTER" output it is also being read/sourced, nevertheless I > get the warning that there was an error when sourcing the file (and even > an incomplete one, it does not give me the $!). Anybody got an idea? > -- Charles DeRykus -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/