Thank you all for your support. I think rlm_perl is better option because queries are a bit complex and I want to integerate more functionality in future. Thanks once again to all .
Regards,