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

Re: [MacPerl] Mac::Navigation glue



At 13.55 -0400 1999.04.09, Mark Yannuzzi wrote:
>I did place use Mac::Events at the top of my file, along with
>Mac::Navigation, and others. I used DispatchEvent($_[1]->event) when I got
>the error, since according to footnote 4 on pg. 181 of the MacPerl book
>("Because they are explicitly exported, the toolbox functions and constants
>do not need to be prefixed with Mac:: before each use. ..."), I thought is
>was unnecessary to use Mac::Events as a prefix.

The symbols (functions, constants, variables) are exported only into the
current namespace.  Your sub is being used in another namespace.  That's
the problem.


>Theoretically then ( ;) ), placing use Some::Module at the beginning of a
>file will allow that module's exported entities to act like global variables
>do.  Namely, that they will be 'visible' not only within the Main package of
>the current file, but all other namespaces referenced from within Main.  Is
>this accurate?

No.  Each namespace is an island.  You need to explicitly import/export
symbols into each namespace, or fully qualify them from namespaces that
don't have them imported in.  So if you want to use DispatchEvent(),
unqualified, in Some::Package, you need to somehow get those symbols
explicitly put into the SOme::Package namespace.

--
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