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

[MacPerl] & Usage and Misc. ?'s



Greetings All:

I am new to MacPerl and have just read the bulk of "MacPerl Power and
Ease" and found it very useful.  However, I have a few simple questions
(I hope) that I have not been able to find in the book, or on the FAQs
that I have been able to find.  I hope someone can help.

1) The "StandardFile.pl" library has a very useful function called
"GetFolder" that lets a user select a directory instead of a file.  I
understand that modules have replaced libraries in version 5, but I
cannot find a straight forward equivalent in any of the packages. From
what I have pieced together, the Mac::StandardFile package has a function:

  CustomGetFile(FILEFILTER, TYPELIST, DLGID, WHERE)

that will perform the task, IF you know what data types/parameters need
to be fed to it.  I perused the Inside Macintosh on-line "Files" volume
and found some (complicated, given that I am an Inside Macintosh virgin,
and do not have a lot of extra time to spend deciphering them just now)
examples in Pascal on how to do this, but I could not find an obvious
correspondence between the MacPerl parameter list for CustomGetFile, and
that shown in the examples in Inside Macintosh. Additionally, I could not
find a defining function template for the function. Does anyone know what
types "FILEFILTER, TYPELIST, DLGID, WHERE" are?

2) I noticed that once I included one or more "use" statements, that I
had to define all my variables as private using the "my()" command, in
order to not have to include "main::" when using them.  I this "normal"?

The following is intended as constructive feedback for the authors of
"MacPerl Power and Ease", Vicki Brown and Chris Nandor, in case there
"listening":

3) I noticed the use of the "&" character in a non-logical operator
context, in an example on pg. 186.  I gather that it has something to do
with calling subroutines, but the construct is not introduced anywhere in
the text, it would be helpful if a sentence or two were included about
this usage, and how it differs from simply calling a subroutine without
it.  I have discovered through trial and error that the following two
statements are equivalent, on the surface:

  &StandardFile'GetFolder() & StandardFile::GetFolder()

4) pg. 187 has an example containing a line that appears to be a shortcut:

$answer = (MacPerl::Answer('Erase existing file?', 'No', 'OK')) if
($file->sfReplacing());

that suggests that the "if" statement is executed first, and if TRUE, the
statement preceding it is executed (bizarre), otherwise, proceed to the
next line.  Perhaps you could include a brief discussion of this along
with your other shortcut examples (the ?: construct, etc.).

Thanks All,
--
Mark Yannuzzi
myannuzzi@aya.yale.edu

--
Mark Yannuzzi
myannuzzi@aya.yale.edu


***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch