in reply to Fetching a file path from a Perl 'rc' file

Cleaned up the code to include just the required part as suggested. So the question is: how would I fetch the contents of my 'rc' or configuration file which contains the path of the files I need to read from my Perl script? Thanks!

  • Comment on Re: Fetching a file path from a Perl 'rc' file

Replies are listed 'Best First'.
Re^2: Fetching a file path from a Perl 'rc' file
by CountZero (Bishop) on Feb 13, 2015 at 17:04 UTC
    Now you have cleaned it up too much.

    • What does the subroutine parse_cmdline () do? Does it work as expected and what variables are set by it? What is in those variables?
    • What does read_file($OPTS{rcfile}) do? what's in $OPTS{rcfile}? Where does this data come from?
    • The sub dynamo_check relies on a number of global variables. Where are these variables set? What is their content? Is their content as expected? You are reading from $log_file as if that is a file-handle. Is it indeed a valid filehandle (and not simply a file-path)? Did you check the open function that set the filehandle for errors?
    • I have the same questions about the open_for_reading subroutine.

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

    My blog: Imperial Deltronics
Re^2: Fetching a file path from a Perl 'rc' file
by Anonymous Monk on Feb 12, 2015 at 23:10 UTC