Uri Guttman wrote:
>>>>>> "SHC" == Shawn H Corey <shawnhco...@gmail.com> writes:
> 
>   SHC> Uri Guttman wrote:
>   >> why the || '' ??
>   >> 
>   >> the help sub doesn't seem to exit/die
> 
>   SHC> Not proven; you cannot assume this.
> 
>   SHC> One school of thought about programming is that all functions must have
>   SHC> only one return and all programs must have only one exit.  Therefore,
>   SHC> help() may return or it may not.
> 
> that school leads to gotos and spaghetti logic. last/next/return are
> your friends. i have see code where one exit is forced and it looks
> forced. ewww.

I didn't say it was a good idea.  And part of this philosophy is no
goto's.  Instead, use lots of state variables and if statements.

> 
>   SHC> Until you actually see the help() sub, you don't know if it returns.
> 
> true. but i had to point out your own assumption that it DID return and
> not exit. these are the trials and tribulations when we use PSI::ESP to
> see invisible code.

If it exited, then my extra code does nothing.  If it didn't, my code
set station to the default value.  Yes, I'm assuming at declaration of
$station it was assign a valid default.  Here's the statement:

my $station = '';

Call it paranoid defensive programming.  ;)


-- 
Just my 0.00000002 million dollars worth,
  Shawn

Programming is as much about organization and communication
as it is about coding.

I like Perl; it's the only language where you can bless your
thingy.

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to