All those if/elsif's make your code look somewhat like '
The Wrong Way' to do it according to the
Patterns in Perl web site. I'm not sure how you would fit this problem into something resembling '
The Right Way' though I have an idea. If dcr_type is tainted, you'd have to make sure that it matches '^(CONTACT|FAQ|LITERATURE|ORGANIZATION)$', then assuming that you have those four classes defined, you can just call
$dcr_type->new(@args). You could even do
$dcr = s/(.*)/\u\L$1/ so you can have normal
ucfirst type class names. Keep in mind I haven't really thought much about the OP's problem, so I don't know how appropriate any of this is for this particular case :-)