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

Re: [MacPerl] Using Mac:: '...' Modules



Thanks Alan,

----------
>From: ajf@afco.demon.co.uk (Alan Fry)
>To: "Mark Yannuzzi" <myannuzzi@aya.yale.edu>
>Subject: Re: [MacPerl] Using Mac:: '...' Modules
>Date: Mon, Mar 29, 1999, 1:11 AM
>

> I sent (or at least attempted to send) the message below here to the
> MacPerl List but for some reason it bounced. I have no idea what's wrong
> but I thought I might send this copy to you in the hope it may be of
> interest in your work with Navigation.pm. The original may yet turn up: if
> so my apologies in advance for the duplication.
>
> Alan Fry
>
> ++++++++
>
> Mark Yannuzzi <myannuzzi@aya.yale.edu> writes Fri, 26 Mar 1999 09:14:06 -0800
>
>>I think your "bless({}, 'NavTypeListHandle')" parameter is on the right
>>track (it does show all TEXT files, independent of application) except for
>>the dialog box anamolies that I mentioned, which may be a bug, or perhaps
>>there is another way...I will experiment, and check the docs again.
>
> There is an error in in Navigation::new() in the line:
>
>     $handle = new Handle($_[0].pack("xxs", scalar(@{$_[1]}))."@{$_[1]}");
>
> which inserts white space between the items in the 'types' list. I am not
> sure if this is to be expected or is maybe a bug in MacPerl? Try running
> the line:
> $ref = ['a' ,'b', 'c', 'd']; print "@{$ref}".
>
> The upshot is that the handle is mal-formed and only the first item in the
> list is subsequently recognised. Suppose new() is given a 'creator' "MPS "
> and a list of 'types' "TEXT", "APPL" and "OBJ ", for instance.
> Handle->new() will then be offered a string:
>
>     'MPS 0003TEXT APPL OBJ '
>
> Navigation.pm considers the resultant handle to refer to a list of types
> 'TEXT', ' APP' and 'L OB', from which it accepts the first and silently
> ignores the rest.
>
> The 'new Handle' line should I think be rewritten:
>
>     $handle = new Handle(
>         $_[0].pack("xxs", scalar(@{$_[1]})).join('', @{$_[1]})
>     );

I will try this (first I need to work through it and undestand it :))...some
of the functions are foreign to me at the moment, but now is a good time to
broaden my Perl vocabulary.

>
> Another problem with Navigation.pm is that free memory seems to leak away
> continuously at the rate of about 240K per minute while the window is up
> and quiescent. The loss is not reclaimed until MacPerl is relaunched.

This might explain the "Out of memory" errors I was getting today...

> The script used to measure this (with Zone Ranger) is attached below so
> that anyone interested can try it to repeat the experiment. The problem may
> well lie in the script rather than in Navigation.pm of course.
>
> Alan Fry
>
> ==========
>
> #!perl
>
> use Mac::Navigation;
> use Mac::Files;
>
> $dir = FindFolder(kOnSystemDisk, kDesktopFolderType);
> $options = NavGetDefaultDialogOptions();
> $options->message("Try shift click or \360_AÉ");
> $options->windowTitle("WH3R3 R 7H3 F1L3Z???");
>
> $options->dialogOptionFlags(
>       kNavAllFilesInPopup      # ==  16
>     + kNavAllowPreviews        # ==  64
>     + kNavAllowMultipleFiles   # == 128
> #   + kNavNoTypePopup          # ==   1; same as NavChooseFile()
> );
>
> # dialogOptionFlags == 208; default is 228 -- presumably also
> # including kNavCtlGetFirstControlID (== 20) whatever that isÉ
>
> $creator = "MPS ";
> $types   = ["APPL", "OBJ ", "TEXT"];
> $list_h  = NavTypeListHandle->new($creator, $types);
>
> $reply   = NavGetFile(
>     $dir, $options, $list_h, sub{1}, sub{0}, \&noFolders
> ) or die $^E;
>
> for (1..$reply->count) { print $reply->file($_), "\n" }
>
> sub noFolders { $_[1]->isFolder ? 0 : 1 }
>
> END { NavDisposeReply $reply if defined $reply}
>
> ==========
>
>

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