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

Re: [MacPerl] Very simple question



Bart Lateur <bart.lateur@skynet.be> wrote:
>	package ill;
>	require Exporter;
>	@ISA = qw(Exporter);
>	@EXPORT = qw(say_hello);    # symbols to export by default

You should also mention 

@EXPORT_OK = qw(...);         # symbols to export on request

Reserve @EXPORT only for those routines which are MOST used.  Things 
which are useful, but not required belong in @EXPORT_OK.  People writing 
modules should read perlmod.pod, perlmodlib.pod and the pod for 
Exporter.pm.

Additionally, routines inside modules should not call die().

Instead you're advised to apply the Carp module

use Carp;

and convert each instance of die() to croak(). From the pod:

> The Carp routines are useful in your own modules because they act like 
> die() or warn(), but report where the error was in the code they were 
> called from.  Thus if you have a routine Foo() that has a carp() in it, 
> then the carp() will report the error as occurring where Foo() was called, 
> not where carp() was called.

--B


Brian McNett, Webmaster
*************************************************************
Mycoinfo. The world's first mycology e-journal.
http://www.mycoinfo.com/
*************************************************************



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