in reply to Re: Check if DBI is installed
in thread Check if DBI is installed

autouse apparently has the same effect as require / import

use warnings ; use strict; use autouse 'foo'; # perldoc autouse eval {foo::not_here();}; # perldoc -f eval my $we_care=0; warn $@ if ($@ && $we_care);
Update: changed
 use autouse foo
to
 use autouse 'foo' (thanks tachyon)

--mandog

Replies are listed 'Best First'.
Re: Re: Check if DBI is installed (eval to check module is installed)
by tachyon (Chancellor) on Sep 02, 2001 at 16:19 UTC
    C:\>type test.pl use warnings ; use strict; use autouse foo; # perldoc autouse eval {foo::not_here();}; # perldoc -f eval my $we_care=0; warn $@ if ($@ && $we_care); C:\>perl test.pl Bareword "foo" not allowed while "strict subs" in use at test.pl line +5. Execution of test.pl aborted due to compilation errors. C:\>type test.pl use warnings ; use strict; use autouse 'foo'; # perldoc autouse eval {foo::not_here();}; # perldoc -f eval my $we_care=0; warn $@ if ($@ && $we_care); C:\>perl test.pl C:\> C:\>type test.pl use warnings ; use strict; use autouse 'foo'; # perldoc autouse eval {foo::not_here();}; # perldoc -f eval warn $@ if $@; C:\>perl test.pl Undefined subroutine &foo::not_here called at test.pl line 6. C:\>

    I presume you mean something like the last example? cheers

    tachyon

    s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print