Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Re: Re: CGI::Application and HTML::Template interaction

by cees (Curate)
on Jan 12, 2004 at 15:24 UTC ( #320680=note: print w/replies, xml ) Need Help??


in reply to Re: Re: CGI::Application and HTML::Template interaction
in thread CGI::Application and HTML::Template interaction

You don't have to be that drastic with the change... You can add this function your any of your CGI::Application subclasses and have it work for you. You don't have to edit the CGI::Application source to add this.

To use CGI::Application you need to write a module that inherits from CGI::Application (by adding 'use base CGI::Application;' to the top of your module). You can add the custom load_tmpl function to this module (right along side your runmodes) and it will work properly.

The way I usually do it (and the way most CGI::Application users recommend) is to create a project wide Base class that inherits from CGI::Application, where you can customize the functionality of CGI::Application for the entire project (adding session management, authentication, etc...). Then you can create several modules with runmodes that inherit from your Base class. The Base class is where you would ideally put the customized load_tmpl method. This way your entire project gets the benefit of the change, but other users of CGI::Application on the system will not notice a difference.

If you would like a detailed example of how this is implemented, let me know and I'll put something together for you.

- Cheers

  • Comment on Re: Re: Re: CGI::Application and HTML::Template interaction

Replies are listed 'Best First'.
Re: Re: Re: Re: CGI::Application and HTML::Template interaction
by geektron (Curate) on Jan 13, 2004 at 00:17 UTC
    The Base class is where you would ideally put the customized load_tmpl method. This way your entire project gets the benefit of the change, but other users of CGI::Application on the system will not notice a difference.
    I didn't even think of overriding other CGI::Application methods. Yes, I already have a subclass of CGI::Application for the app in question, but I hadn't gotten to the point of changing any default behaviour in methods ( because, frankly, I don't know it well enough to want to jump too far into it ). But, next time around ( and if i get a chance to refactor this project ), I'll do just that: have a customized my_load_tmpl() method that acts just like load_tmpl() with a few added fun things.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://320680]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2022-01-24 11:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (64 votes). Check out past polls.

    Notices?