Chisel Wright wrote:
> The module in question appears to use UNIVERSAL::can()

UNIVERSAL:can is evil and should be killed with fire.  :-)

> but I'm not sure why this has far reaching effects out to the Template code.

It monkey-patches the UNIVERSAL module (from which everything inherits)
and implements an all-the-world-is-OO policy - "Though shalt not call can()
as a function" - which invalidates perfectly valid non-OO Perl.

 From 'perldoc UNIVERSAL' in Perl 5.8.8

    "can" can be called as a class (static) method, an object method,
    or a function.

When this last came up, I cited the above Perl documentation as proof that
it was officially OK to call can() as a function.

http://london.pm.org/pipermail/london.pm/Week-of-Mon-20071119/011479.html

So then they changed the documentation...

 From 'perldoc UNIVERAL' in Perl 5.10.0

   You may call "can" as a class (static) method or an object method.

That said, there are good reasons why it's *generally* not a good idea to
do so, and there are now better ways to do it.  However, that doesn't work
in all cases.  In particular, the CGI module is a problem because of its
two-faced procedural/OO interfaces.  It's a few years since I looked at it,
so things may have changed, but back then the only way I could make TT Do
The Right Thing was to call UNIVERSAL::can() as a function.

It's like using goto.  Yes, it's generally a bad idea, except when you really
do know enough about what you're doing to recognise that it's the best
solution.  UNIVERSAL::can() decides in its infinite wisdom that I don't know
what I'm doing and should be chastised for it.  Bah!

> I've attached a patch written against Template-Toolkit-2.20.

No you haven't :-)

Before you re-send it, can you confirm that all the tests pass with the
patch in.  If they do then I have no objection to the patch in principle.
But I've got a nasty suspicion that there may be problems...

A

_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates

Reply via email to