[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl-AnyPerl] Multi Platform Scripts



At 10:56 -0400 8/9/99, Chris Nandor wrote:
> use is executed at compile time, regardless of where it is in a program
> (unless it is in an eval() (which is different than an eval{}).

> There are lots of ways to do this, and Perl Cookbook lists several of
>them.

OK, this works on my Mac:

BEGIN {
    unless ($^O eq 'MacOS') {
        unless (eval "use DBI") {
            warn "Couldn't load module DBI\n";
        }
    }
}

It doesn't try to load DBI and the syntax checking works. (Actually I've
installed DBI on the Mac at work but not yet at home, so...)

The above code looks like the examples in the Cookbook (p. 403)

but on the Unix box I see

   Couldn't load module DBI

even though it actually seems to be loading.

I assume I've missed something obvious / done something stupid :-)
But I don't see it. Please tell me what it is so I can say "Duh". :-/
-- --
       |\      _,,,---,,_       Vicki Brown <vlb@cfcl.com>
 ZZZzz /,`.-'`'    -.  ;-;;,_   Journeyman Sourceror: Scripts & Philtres
      |,4-  ) )-,_. ,\ (  `'-'  P.O. Box 1269  San Bruno  CA  94066
     '---''(_/--'  `-'\_) http://www.cfcl.com/~vlb  http://www.macperl.com

==== Want to unsubscribe from this list?
==== Send mail with body "unsubscribe" to macperl-anyperl-request@macperl.org