in reply to Re: Refactor method calls or not?
in thread Refactor method calls or not?

There is no $spoon, er.. $type :) Did you mean $table there?
Your grep either returns all values (if $type is true), or none at all (if $type is false). And die is evil outside the main program.
I'd also use a lookup hash to avoid having to iterate over the array over and over.
use Carp; ... my %tables; @tables{ qw/foo bar/ } = (); sub ... { ... croak 'Disallowed table' unless exists $tables{$table); ... }

2;0 juerd@ouranos:~$ perl -e'undef christmas' Segmentation fault 2;139 juerd@ouranos:~$

Replies are listed 'Best First'.
Re: Re: Re: Refactor method calls or not?
by perrin (Chancellor) on Jan 19, 2002 at 01:13 UTC
    Thanks for catching those. I should have proofread before posting. And of course that should have been a hash. Don't know what I was thinking.

    The die is just a stand-in for whatever Ovid uses for exception handling.