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

Re: [MacPerl] Portable code



At 11.29 -0400 1999.06.03, Kevin Reid wrote:
>BEGIN {
>  foreach (qw(TheModule Data::Dumper Mac::Nonexistent Mac::Windows)) {
>    $MOD_AVAIL{$_} = eval "use $_; 1";
>  }
>}
>
>Put it at the top of your program and put the modules you want inside
>the qw() list. The hash %MOD_AVAIL will tell you whether a particular
>module has been loaded.

That's pretty good.  Probably good to put "use vars '%MOD_AVAIL';" at the
top of, or before, the BEGIN block.

--
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])

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