Stupid mistakes, vol 1

Darren Duncan darren at DarrenDuncan.net
Mon Feb 3 22:27:37 CST 2003


Peter Scott said:
>Don't do
>
>	use base qw(Exporter);
>	our @EXPORT = qw(some_func);
>
>	sub some_func { }
>
>and then spend ages scratching your head as to why some_func is not exported to the caller only to discover that elsewhere in the same module you had earlier inserted your own import().

Of course, I could also say, don't import/export at all, but use objects for everything.  This way, you save having to mess with your caller's namespace.  While there are some niceties that you lose when going all objects, I think it is a small price to pay for what you gain; and you haven't actually *lost* anything, except a few seconds typing more characters when coding, and a bit steeper of an initial learning curve. -- Darren Duncan



More information about the Victoria-pm mailing list