in reply to Re^7: How to call particular parameter from another configuration file in perl
in thread How to call particular parameter from another configuration file in perl

Thanks for your response. Now i able to narrow down the issue. I am getting desired output if i execute the script under /amex/lcd directory. If i copy the script to /amex/log/ directory and execute the script, i am getting below error.
$pwd /amex/lcd $./CA.pl <password> ## printing password as expected $cd /amex/log $./CA.pl ## not printing the password from different location other + than /amex/lcd Can't call method "param" on an undefined value at /ontw/etc/lcd/PWCCAauth_succ.pl line 108 (#1) (F) You used the syntax of a method call, but the slot filled by t +he object reference or package name contains an undefined value. Som +ething like this will reproduce the error: $BADREF = undef; process $BADREF 1,2,3; $BADREF->process(1,2,3);
Am i missing something that you can help me with ? If i sort out this issue of getting the password executed from all directory other than /amex/lcd, then i will able to get main.pl executed without issue. Thanks in advance.
  • Comment on Re^8: How to call particular parameter from another configuration file in perl
  • Download Code

Replies are listed 'Best First'.
Re^9: How to call particular parameter from another configuration file in perl
by Corion (Patriarch) on Jun 17, 2021 at 08:03 UTC

    The path you give to Config::Simple is relative to the current directory. It is not relative to where your script sits.

    If you want to use a config file from a given directory, you need to specify that directory explicitly in the name of the config file, like:

    my $config = Config::Simple->new("/path/to/config.ini");