This bit of logic would probably be better implemented at the individual
super class level since load_tmpl() is a method that is generally expected
to be over loaded anyways. It's a great idea, but already many people use
different template modules and different individual methods for deciding
which template to load.

> I'd like to add a bit of logic to the load_tmpl method so that if it is
> called without a template name it creates a name based on the current run
> mode. This removes another useless use of a constant and enables a really
> simple form for some runmodes. Another instance of removing data from the
> code.
>
> This patch would change the following snippet only marginally but in a
> positive direction.
>
> sub login_form { \ shift()->load_tmpl('login_form')->output }
> sub login_form { \ shift()->load_tmpl              ->output }
>
> --- Application.pm~     Sun Jun 15 15:41:30 2003
> +++ Application.pm      Sun Jun 15 15:44:07 2003
> @@ -325,6 +325,11 @@
>         my $self = shift;
>         my ($tmpl_file, @extra_params) = @_;
>
> +       # provide a default template from the runmode if none was given
> +       unless ($tmpl_file) {
> +               $tmpl_file = $self->get_current_runmode() . '.tmpl';
> +       }
> +
>         # add tmpl_path to path array of one is set, otherwise add a path
> arg
>         if (my $tmpl_path = $self->tmpl_path) {
>                 my $found = 0;
>
> Joshua Jore
> Minneapolis, Hawthorne, 45�00'09" -93�17'39"


---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/[EMAIL PROTECTED]/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to