http://www.perlmonks.org?node_id=479283


in reply to OOP in CGI

To try and answer your questions ..

As neniro points out, one of the benefits of using the OO interface for the CGI module is the fact that it doesn't cause namespace pollution. For large applications, that's an obvious advantage; for small applications less so.

Other benefits would include the potential to use multiple CGI objects, but why would you want to? Submit buttons can have values to distinguish them, which can be read as parameters if you give your buttons names.

As far as 3 goes, I think you're on your own and stuck with JavaScript. To achieve this, you need the client to perform the submit. As all of your Perl lives server-side, Perl doesn't have the ability to manipulate the client in this way.

Replies are listed 'Best First'.
Re^2: OOP in CGI
by Joost (Canon) on Jul 29, 2005 at 13:01 UTC
    Other benefits would include the potential to use multiple CGI objects, but why would you want to?

    To me, the biggest advantage of using the OO interface is that it's easier to pass the request/response around, and possibly replace the implementation later. Some of the frameworks that run on both mod_perl and CGI do this.