[Maypole] template_args change request

From: Dave Howorth (dhoworth at mrc-lmb.cam.ac.uk)
Date: Wed Oct 27 2004 - 13:16:23 BST


Turning things into objects has some interesting side-effects :)

In the Maypole class doc it says:

   template_args
   -------------
     $r->template_args->{foo} = 'bar';

If you do that, you get:

   Can't use an undefined value as a HASH reference at ...

It's necessary to write:

    $r->template_args({});

before trying to create any hash entries as documented.
This could be fixed by an extra sentence in the docs, but I think a
better cure would be to add that initialising statement to
Maypole->handler(), perhaps by changing:

       my $r = bless { config => $class->config }, $class;

to read:

       my $r = bless {
                 config => $class->config,
                 template_args => {},
               }, $class;

Cheers, Dave

BTW, now that config is an object, it's no longer possible to just add
extra keys to the hash and expect them to be visible in the template.
The template_args method allows one to add per-instance keys to the
template variables, but I can't see a way to add per-class keys (i.e.
things that can be computed at initialisation time). Is there an
approved way to do this?

_______________________________________________
maypole mailing list
maypole at lists.netthink.co.uk
http://lists.netthink.co.uk/listinfo/maypole



This archive was generated by hypermail 2.1.3 : Thu Feb 24 2005 - 22:25:56 GMT