On Thu, 18 May 2000, Kenneth Lee wrote:

> i know that, but it doesn't work if i use "use", since the block 
> will be eval()'d at compile time:
> 
> eval {
>     die unless $ENV{MOD_PERL};
>     use Apache::Constants qw(:common);
>     ...
> };
> 
> it complains if Apache::Constants is not installed.

Since you didn't read the docs, here they are (relevant bit highlighted):

% perldoc -f use
=item use Module LIST

=item use Module

=item use Module VERSION LIST

=item use VERSION

Imports some semantics into the current package from the named module,
generally by aliasing certain subroutine or variable names into your
package.  It is exactly equivalent to

    BEGIN { require Module; import Module LIST; }
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

except that Module I<must> be a bareword.



-- 
<Matt/>

Fastnet Software Ltd. High Performance Web Specialists
Providing mod_perl, XML, Sybase and Oracle solutions
Email for training and consultancy availability.
http://sergeant.org http://xml.sergeant.org

Reply via email to