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

Re: [MacPerl] Portable code



On Wed, Jun 02, 1999 at 04:48:38PM -0400, Chris Nandor wrote:
> There are various methods.  The Perl Cookbook goes over some of them.  One
> I use  is:
> 
>   if ($^O eq 'MacOS') {
>     require "Mac/Module.pm";  # yes, "/" does work here on a Mac
>     Mac::Module->import;
>   }
> 
> One drawback here is that subroutines are not seen at compile time, so you
> cannot use bareword names.  For instance, if you would normally use this
> code:
> 
>   use Mac::AppleEvents;
>   print typeType;
> 
> It now has to be:
> 
>   require "Mac/AppleEvents.pm";
>   Mac::AppleEvents->import;
>   print typeType();
> 
> etc.  But other than that, it works fine.
> 

Would this not work?

BEGIN {
  require "Mac/AppleEvents.pm";
  Mac::AppleEvents->import;
}

print typeType;

Ronald

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