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

Re: [MacPerl] GUSI and mime converting



>Still dawdling with my first program (the mime one) Below is the main part of
>my program (less the actual subroutines). When I asked how to make a popup
>window to select a file with I was shown code similer to what's in the unless
>clause. Unfortunately its workings weren't explained and I get an error saying
>'types' is only used once, then it quits.

That is not an error and is not the reason the program quits. It is a
warning. Remove the "-w" on the shebang line and that warning will not be
produced.

The "@types" array allows you to restrict the file that will be displayed
in the dialog to those with the file types specified in that array.

I suggest using more descriptive messages in your die statement. Chris
Nandor advised, "For open and other builtins, always check the value of $!.
For MacPerl toolbox module functions, check the value of $^E."

According to the perlfunc.pod (view it with Shuck)...
   The goto-LABEL form finds the statement labeled with LABEL
   and resumes execution there.  It may not be used to go into
   any construct that requires initialization, such as a subroutine
   or a foreach loop.  It also can't be used to go into a construct
   that is optimized away, or to get out of a block or subroutine
   given to sort(). It can be used to go almost anywhere else within
   the dynamic scope, including out of subroutines, but it's usually
   better to use some other construct such as last or die.
   The author of Perl has never felt the need to use this form of
   goto (in Perl, that is--C is another matter).

I don't know if "goto" is the culprit but I've had problems with it and
have abandoned its use for in my coding. Just thought you should be aware
of this.

Are you calling a function or a subroutine with "mime_print();"?
You don't show us "mime_print". Could the problem be there?


David Seay
http://www.mastercall.com/g-s/



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