in reply to Re: The dreaded if-elsif-else construct (code)
in thread The dreaded if-elsif-else construct (code)

One thing that could extend this approach and possibly eliminate the large quantity of ifs is to templatize the conditional.

Set it up so that the test and actions are defined in a config file and work via a generic test/action method.

Granted the performance will probably drop, but the maintainability should increase.

There also might be modules that support this sort of templating of a function, but i haven't seen them yet. (as i haven't had the need yet)

  • Comment on Re: Re: The dreaded if-elsif-else construct (code)