in reply to Re: 'Required' config file produces error if last entry sets variable to zero?
in thread 'Required' config file produces error if last entry sets variable to zero?

There's a few pitfalls with do:

See do in the documentation (do EXPR is what you're interested in).

  • Comment on Re^2: 'Required' config file produces error if last entry sets variable to zero?

Replies are listed 'Best First'.
Re^3: 'Required' config file produces error if last entry sets variable to zero?
by rblasch (Monk) on Jun 12, 2006 at 10:29 UTC

    Whether those pitfalls are a good or a bad thing probably depends on the requirements. For example, if one would like to support config reloading the second pitfall would actually be a good thing.

    I guess the issue is more a matter of style than any technical reason. It might be best to choose whatever one feels comfortable with.

    It may even depend on how you view the configuration: If the configuration feels like part of the program, require or use might be better because it's heaviliy associated with module loading. That way, the final 1; in the configuration won't feel awkward, too. If the configuration is more external, and Perl is mostly used for syntactic convenience, I'd prefer do.