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

Re: [MacPerl] Including req'd files within Droplets?



At 09:48 96-05-14, Sam Choukri wrote:

>John Peterson wrote:
>>XFCN resources can be added to scripts, no problem.  If you added
>>something like FindFoler.pl as a TEXT resource, how would you 'require'
>>it?  Perhaps something like:
>>
>>require 'Dev:pseudo:FindFolder.pl';

Not that hard -- from my archive:
> ------ Response From: Matthias Ulrich Neeracher, Wed, Jun 21, 1995 ------
>
>
>There is an undocumented feature: Text resources in scripts and runtimes are
>treated as a "hidden library directory". That is, if you do:
>
>require "ftp.pl";
>
>You can put the file into a text resource named "ftp.pl" in the script and it
>will be found. There is no interface for this because life is too short.
>   A "require xxx.pl" statement will look for a resource of type TEXT and
>   name "xxx.pl" when all library search paths are exhausted. This feature
>   has never been given a proper user interface, so it remains largely unused.
>
>Matthias

>I'm a bit confused as to how this would work. I know I can easily add the
>XCFN resource to my droplet, but do you know how I would refer to it? Let's
>assume that I add FindFolder.pl as a TEXT resource and require it as you
>suggested. When it is loaded, it calls MacPerl'LoadExternals(FindFolder.pl)
>to load the XCFN. But this probably won't work since the XCFN resource is
>no longer actually a part of the FindFolder.pl file. Do you see what I
>mean?

Give it a try -- just remember to take the "real" file FindFolder.pl
out of you @INC directories first -- the TEXT resource gets looked at
last....

--Hal
Hal Wine <hal@dtor.com>     voice: 510/482-0597