in reply to Trying to be stricter...

You could either make a module out of your include file with its own package, or you could just make sure that the file ended with something that returns true ( 1; is often seen), and use use:
(in myIncludeFile.pm)
use constant SOME_CONSTANT => 1; sub whatever { 123 } 1;
(in your CGI file:)
use myIncludeFile ();
Since use xyz; is equivalent to BEGIN { require xyz }, this loads the included stuff at the right time.

updated: used bareword form of use (oops!)

Replies are listed 'Best First'.
Re: Re: Trying to be stricter...
by stephen (Priest) on Jun 01, 2001 at 05:04 UTC
    Trying to use a filename (as opposed to a module name) doesn't work on my Perl (5.005 on Linux). It throws a syntax error. The man page on use offers some insight as to why:
    It is exactly equivalent to
    BEGIN { require Module; import Module LIST; }
    except that Module must be a bareword.
    Therefore, to use use, the constants file must be a proper module ending in .pm, and the above use 'myIncludeFile.pl' (); syntax is a syntax error.

    stephen