in reply to Re: deep usage of if-else!!
in thread deep usage of if-else!!

yes $o->check() returns 0 or 1, but in most of the cases it is too long i.e. parameter passed to it, that is why i'm using $o->state.
But yes as u and Hue-Bond said I can see which are the most frequently combination of checks and actions and separate them into methods, this way I will shorten things abit.(before i read your replies i figured out to shorten one of them).
But then, i can do this for just several of them, otherwise i will go into the trap of too-many-methods ;)
That is why i was wondering that probably someone already invented something along these lines ;))
thanx for your replies

Replies are listed 'Best First'.
Re^3: deep usage of if-else!!
by davidrw (Prior) on May 01, 2006 at 18:54 UTC
    yes $o->check() returns 0 or 1, but in most of the cases it is too long i.e. parameter passed to it
    too long? so? that's fine, or bundle the params into a hash, or store in the object:
    if( ! $obj->check( blah => 1, stuff => 2, foo => 'bar', ... )){ ... } my %params = ( blah => 1, stuff => 2, foo => 'bar', ... ) if( ! $obj->check(%params) ){ ... } $obj->blah(1); $obj->stuff(2); $obj->foo('bar'); ... if( ! $obj->check() ){ ... }