Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I have written a program that I have used many times. It consists of a main script, a config script and an admin script.

The config script is not returning a true value

If I move the contents of the script into main script, the script runs. I rewrote the config file (called by both main and admin scripts) and it is correct without errors the main script runs perfectly.. The minute I do the require calling the config, POOF.

The call to the server is correct. And as I said, I have rewritten this config.pl four times, removed it from the server, reuploaded it and still, it is not being found - to wit returned a not true

It has me baffled. I am not using cgi.pm, just perl5. I am a software developer in perl, C and other languages, and this is the first time I have ever seen this error!

TIA, Doc

Replies are listed 'Best First'.
Re: WIERD ERROR
by davorg (Chancellor) on Jun 06, 2001 at 17:39 UTC

    You haven't said what the error is or shown any of your code. It would be far easier to help if you could cut the problem down to its basics and post simplified code demonstrating what's going wrong.

    <guess type="educated">Sounds to me like you've got problems with the difference between package and lexical variables.</guess>

    --
    <http://www.dave.org.uk>

    "Perl makes the fun jobs fun
    and the boring jobs bearable" - me

      The error on debug (as stated) config.pl did not return a true value My config.pl lists all the variables used by the two or three different scripts The variables work fine when placed inside each script. I have placed this program on 6 different servers - changing the server names . It works on 5. On the 6th one, I get an error on the require of the config.pl There is no code to show .. I have never seen this error before. the variables are database locations, url names, email names etal. Definitly not a variable problem.
Re: WIERD ERROR
by thpfft (Chaplain) on Jun 06, 2001 at 19:11 UTC

    Don't forget the 1 on the end.

    Sorry if this is too obvious, but you mention that the config component returns not true. A quick look at require will show that:

    The file must return TRUE as the last statement to indicate successful execution of any initialization code, so it's customary to end such a file with `` 1;'' unless you're sure it'll return TRUE otherwise. But it's better just to put the ``1;'', in case you add more statements."

    Which would be tricky to deduce, i agree, but not hard to look up...

      the require is a config.pl (pathed of course) and works on other machines, just not this one ... BSDI UNIX box
      Removing and adding back the 1; did the trick Works fine now Thanks! Doc