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

Re: [MacPerl] Porting an Inside Mac QuickDraw example routine



At 03.16 -0500 1999.11.10, ilir topalli wrote:
>Snip complaints here --->
>Information for accessing functions such as QuickDraw is not easily
>accessible.  I must say
>that it has been an uphill battle.  There really needs to be some example
>code included with
>the modules for at least the basics such as how to call different functions.

There are.  First, there is the MacPerl book, which has bunches of
examples.  There are also the example files in ext:Mac:.


>This list of toolbox terms in the POD are as they are referred to in
>Inside Mac, decidedly un-Perl.
> It takes quite a while to figure out that  srcCopy ()  requres
>parenthesis after it

This is not a MacPerl thing, it is a Perl thing.  Constants in Perl are
created as subroutines, and in some contexts, you must use the () with the
constant in order for it to be parsed correctly by perl.

>or what exactly
>you put in Port when you do : SetPort PORT., or that WINDOW means
>$windowhandle->window.
> The examples are numerous.  The learning Curve is a cliffside.

Well, that is one of those things that relies on an understanding of the
Mac OS Toolbox itself.  For example, looking up SetPort in IM:

    PROCEDURE SetPort (port: GrafPtr);

        port
               A pointer to a GrafPort record. Typically, you pass a pointer to
    a GrafPort record that you previously saved with the GetPort procedure
    (described in the previous section).

And in the Mac::Windows, there is only one instance of "GrafPtr", when
describing the window() method.

I agree there could be better docs out there, but the info is all there, it
just requires some good knowledge of Perl and Mac OS programming.



>It would be nice if there was a module to do a lot of these functions (and
>group functions) in a More
>Perl like (and simple) way

I don't see how it is un-Perl like.  I think it is very Perl-like, aside
from the style of the names (perl names are usually lower case, not
UpLikeThis), but that is so it is easy to find documentation on stuff for
beginners, and so the learning curve is very very small for Mac OS
programmers.


>perhaps it would even make some of the routines more portable to other
>platforms.

I don't understand this ... it cannot be portable to other platforms,
because it depends on the Mac OS API (only available on Mac OS), and
changing the style would not change this.  Even if it were portable,
changing the style would not change this fact.


> All this toolbox stuff is so low level that it starts to feel like C (blech).

I don't see how to change it to be more "Perl-like."  What suggestions do
you have?

Do you mean just providing higher-level functions to hide some of the
details?  Well, yes, that does not mean changing anything about the
existing code, it just means writing new modules to sit on top of the
existing ones, like I did with Mac::AppleEvents::Simple, and I agree (if
that is what you mean) that there is certainly room for such modules, and
there even are some other modules to make such things simpler (though I
wish there were more, hint hint).

Sorry I don't have time to look at your code below, and I don't do a lot
with the GUI toolbox stuff anyway, so I don't know how much help I would
be.  Good luck,

-- 
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])

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