Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re: Re: Refactor method calls or not?

by Juerd (Abbot)
on Jan 19, 2002 at 00:04 UTC ( #139934=note: print w/replies, xml ) Need Help??

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.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://139934]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (7)
As of 2021-04-21 18:52 GMT
Find Nodes?
    Voting Booth?

    No recent polls found