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

Re: [MacPerl] Refrencing resource fork from PERL



At 10:08 PM 5/26/96, Tim Judd wrote:
>I need to know if I can access a resource in a file to which I can
>manipulate data to make a TEXT file.

The answer is a qualified "yes".
You must be running MacPerl 5.06r1m or later on a PPC.
You must have the MacPerl Toolbox extensions prepared by Matthias Ulrich
Neeracher, specifically the Resources.pm and Memory.pm extensions.

>
>What the resouce fork that I need to access is in the form of:
>Resource:
>        :Identification:
>        :              :Text
>
>And the TEXT file is just in the file format of:
>Identification:
>              :Text
>
>The Identification is NOT going into the TEXT file.
>
>
>Is that at all possible?

If you have the above system, then

use Mac::Memory;
use Mac::Resources;

$res = OpenResFile($fileName) or die "Could not open resource file $fileName";
$ref = GetNamedResource("TEXT", $Identification)
        or die "Could not find TEXT resource $Identification";
# Do what you want with it

CloseResFile($res);    # release it

Bob Dalgleish   bob.dalgleish@sasknet.sk.ca
Web Page        http://www.sasknet.com/~dalgl/