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

Re: [MacPerl-AnyPerl] Multi Platform Scripts



On Mon, Aug 09, 1999 at 11:30:00AM -0400, Chris Nandor wrote:
> At 11:07 -0400 1999.08.09, Ronald J Kimball wrote:
> >On Mon, Aug 09, 1999 at 10:56:28AM -0400, Chris Nandor wrote:
> >>
> >> This isn't always ideal, because require/import is not exactly the same as
> >> use
> >
> >Could you clarify that statement?  I believe that use is exactly the same
> >as require/import in a BEGIN block.
> 
> Anything that needs to be done at compile time in the module won't be done
> at compile time.

Well, if you need conditional use at compile time, that's easy enough to
do:

BEGIN {
  if ($^O eq 'MacOS') {
    require Mac::StandardFile;
    import Mac::StandardFile;
  }
}

> Further, if the module does anything weird in its
> import(), it might be insufficient to call it that way.  I can't think of a
> good example off the top opf my head, but I've seen some in the past where
> require/import was not the same as use, but I have seen some in the past.

use Module is documented to be exactly equivalent to

BEGIN { require Module; import Module }

I'm skeptical that anything could be done with use that could not be done
with require/import.

Ronald



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