punch_card_don has asked for the wisdom of the Perl Monks concerning the following question:
Putting my configuration variables into a separate config file and then 'requiring' it. Finding that if the last variable declaration sets a variable to zero, I get the error message:
"Error - config.pl did not return a true value"
But if I ensure that the last declaration sets a variable to something, anything but zero, it works just fine.
This seems like strange behaviour to me. What's up?
Main file:
config.pl#!/usr/bin/perl -w require 'config.pl'; print "Content-type:text/html\n\n"; print $variable;
This config.pl produces the error.$v1 = 'something'; ..... $variable = 'hello world'; $flag = 0;
This config.pl works just fine.$v1 = 'something'; ..... $variable = 'hello world'; $flag = 1;
It's not the value ofthe flag in the program - the program doesn't even run. It stops on loading because of this error.
|
|---|