On Thu, Oct 12, 2006 at 12:15:55PM -0600, Gary V wrote:
> Should policyd-weight.conf have a defined return? I'm not a Perl
> person, but I have seen a defined return recommended for other
> external files like this.
> 
> [...stuff...]
> 
> 1; # return

This is generally true for packages/modules, files used via require() and so on.

We use (for scope and 'use strict'-reasons) a completely different approach: 
we slurp it into a string, and then eval that string. Perl reports eval errors 
in @$. So there is no need in checking the last execution result of the 
external file.

Or from http://perldoc.perl.org/functions/require.html:

"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."



We do not use require() but eval() which is described here:
http://perldoc.perl.org/functions/eval.html

"If there was no error, $@  is guaranteed to be a null string."


-- 
    Robert Felber (PGP: 896CF30B)
    Munich, Germany

____________________________________________________________
Policyd-weight Mailinglist - http://www.policyd-weight.org/

Reply via email to