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

Re: [MacPerl] 5.1.4 notes



D.Thomas@vthrc.uq.edu.au (Danny Thomas) writes:
}4a) it may have been as a result of bugs in preceding versions, or at least
}my assumption that a my variable declared at the start of a loop is
}initialized on each pass through the loop, but there were a few places I
}was trying to clear a hash. 5.1.4 says that
}   %f = {};
}hash has an odd number of elements. So changing that to
}   %f = ();
}seemed to quieten it down. Can someone explain this?

Bad syntax.  {} is the anonymous hash constructor, not an empty hash.
Proper use would be $f = {}, and the hash itself would be %$f.  (In other
words, {} gives a reference to an empty hash, not an empty hash).  But ()
*is* an empty list, and you initialize hashes with lists.

}4b) how should I use the Exporter module?
}My modules normally start like so
}  #!perl -w
}  package  Sapphire;
}  require Exporter;
}  @ISA = Exporter;

I think the problem may be this.  Try @ISA = ("Exporter") or @ISA =
qw(Exporter).  It seems to be complaining about the syntax.

}  @EXPORT = qw( .... );
}  use  strict;
}However if I move the strict immediately after the shebang, I get warnings
}like these:
}  # Global symbol "ISA" requires explicit package name.
}  File 'Danny Scratch:Download:t.pm'; Line 5
}  # Bareword "Exporter" not allowed while "strict subs" in use.
}  File 'Danny Scratch:Download:t.pm'; Line 5
}  # Global symbol "EXPORT" requires explicit package name.
}  File 'Danny Scratch:Download:t.pm'; Line 6
}  # Execution of Danny Scratch:Download:t.pm aborted due to
}    compilation errors.
}Presumably this is not MacPerl specific, but I can't say I've ever mastered
}packages or OO coding. Is there a better way?

---
Paul J. Schinder
NASA Goddard Space Flight Center
Code 693, Greenbelt, MD 20771
schinder@pjstoaster.pg.md.us



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