[Pdx-pm] sub calling logic

Roderick A. Anderson raanders at acm.org
Mon Dec 22 18:03:59 CST 2003

BTW, this got dropped into the Postpone folder last week because of an
interruption and then I was gone to Seattle for my son's graduation and
just realized I'd never finished it.

On Tue, 16 Dec 2003, Ovid wrote:

> The answer depends upon whether or not log_error() is logically
> dependent on $error.  If it is the case that log_error() cannot proceed
> unless $error is true, then your decision is a good one.  The test of
> $error belongs in log_error() and not outside of it.  Obviously, there
> is a dependency here, so you're fine.

I think this is my case.  Much head scratching and deep thought lead me 

> If, however, you have a subroutine named write_current_orders(), you
> might think that this is okay:
>   sub write_current_orders {
>     my ($file, @orders) = @_;
>     return unless @orders;
>     ...
>     _write_formatted_data($file, $data);
>   }

Yeah.  I almost, in a fit of madness, did this once.  My current script
has far too many output subs.  I'm trying to use the idea above to reduce
them to one generalized subroutine and pass in the differing types.

    "Open Source Software - You usually get more than you pay for..."
     "Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL"

More information about the Pdx-pm-list mailing list