in reply to PATH is not setting - PERL

Since you don't show the code in any sort of context, you're making us guess. So here's mine. Put in use strict; and use warnings;. I have a feeling that you're not modifying the %ENV that you think you are - i.e., it is not in the proper scope and you may be modifying the hash in a disjoint scope.

If you want real help, you'll have to show the code with enough context to show what is going on.

Replies are listed 'Best First'.
Re^2: PATH is not setting - PERL
by chromatic (Archbishop) on Oct 15, 2007 at 17:43 UTC
    have a feeling that you're not modifying the %ENV that you think you are - i.e., it is not in the proper scope and you may be modifying the hash in a disjoint scope.

    What other %ENV is there in Perl?

      What other %ENV is there in Perl?

      You could make a lexical named %ENV, and it would mask %main::ENV. That doesn't appear to be the case here, but that's another one.

Re^2: PATH is not setting - PERL
by srini_sun (Initiate) on Oct 15, 2007 at 15:21 UTC
    hi,
    below is my code 
    
    #!/usr/bin/perl
    
    
    use DBI;
    
    $ENV{'LD_LIBRARY_PATH'}= "/opt/instantclient_10_2/";
    $ENV{'ORACLE_HOME'}= "/opt/instantclient_10_2/";
    
    
    $database = "idm";
    $username = "idm";
    $password = "idm";
    $hostname = "host";
    
    $output = &connectCBMS(900010);
    print $output;
    
    sub connectCBMS {
    print "Connecting to Database for user $staffcode";
    $db = DBI->connect("DBI:Oracle:host=$hostname;sid=$database",$username,$password);
    unless($db) {
        print "(ERROR) Failed to connect to $hostname.";
        return;
      }
    
    my ($staffcode) = @_;
    # Execute a Query
    my $sql = qq{ SELECT REGISTRATIONDAY FROM CBMS WHERE STAFFCODE = ? };
    my $sth = $db->prepare( $sql );
    
    print $staffcode;
    $sth->bind_param( 1, $staffcode );
    $sth->execute();
    
    while ( $row = $sth->fetchrow_array()) {
       if (!$row) {
    
                  return;
    
                 }
            else {
    
              return ($row);
                  }
    }
    
    $sth->finish();
    $db->disconnect();
    return;
    }
    
    Thanks Sri