This queue is for tickets about the HTML-Template-Pluggable CPAN distribution.

Report information
The Basics
Id:
49123
Status:
open
Priority:
Low/Low

People
Owner:
rhesa [...] cpan.org
Requestors:
SILASMONK [...] cpan.org
Cc:
AdminCc:

BugTracker
Severity:
Important
Broken in:
0.17
Fixed in:
(no value)



Subject: Documentation: dependence on "can" method not made clear
I have found that in order to use something like <TMPL_VAR NAME="world.hello"> with $template->param(world=>$world), it is important that $world->can('hello') is true. If the $world object is relying on AUTOLOAD this will not be true. The class code for $world can get round this by overriding the "can" function but it is not obvious that one would want to do this. I suspect that this may be the underlying cause for #40714 as well.
Hi there,

first off, sorry for the very late reply. HT::Pluggable is the last of my distros that isn't on github yet, since I've had some difficulty in accessing the original subversion repository. I'm still waiting on that for the history, but I do have a git-cpan import that may be good enough. There's a stub ready here:

http://github.com/rhesa/html-template-pluggable

On Sat Aug 29 12:49:14 2009, SILASMONK wrote:
Show quoted text
> I have found that in order to use something like <TMPL_VAR
> NAME="world.hello"> with $template->param(world=>$world), it is important
> that $world->can('hello') is true. If the $world object is relying on
> AUTOLOAD this will not be true. The class code for $world can get round
> this by overriding the "can" function but it is not obvious that one
> would want to do this.

I suppose that's a fairly common issue, though I had always understood that if you use AUTOLOAD, then you should also override can().

http://www.modernperlbooks.com/mt/2009/12/is-it-can-it-does-it-and-robust-perl-5-oo.html

That said, I realise this isn't as common practice as it should be, so I propose we change some of the HT::Dot behavior. If the thing under consideration is blessed, then treat it as an object: instead of only checking $obj->can($method), also check if $obj->can('AUTOLOAD'). If it isn't blessed, we try treating it as a hash key. I think this is conceptually cleaner.

This change currently breaks the tests using Test::MockObject, but I suppose that's okay. I'd like to refactor the test suite anyway. 
Expect something in the coming weeks.

Show quoted text
> I suspect that this may be the underlying cause for #40714 as well.

No, that's a completely different issue. See that thread for more details.

Rhesa
Subject: Re: [rt.cpan.org #49123] Documentation: dependence on "can" method not made clear
Date: Thu, 7 Jan 2010 11:16:23 -0500
To: bug-HTML-Template-Pluggable@rt.cpan.org
From: Mark Stosberg <mark@summersault.com>
Show quoted text
> first off, sorry for the very late reply. HT::Pluggable is the last of my > distros that isn't on github yet, since I've had some difficulty in accessing > the original subversion repository. I'm still waiting on that for the history, > but I do have a git-cpan import that may be good enough. There's a stub ready > here: > > http://github.com/rhesa/html-template-pluggable
Thanks for this maintenance, Rhesa. Here's an story from CGI.pm which may be interesting: We put up the current version on Github, and later got access to the history from SVN, which was converted with "svn2git". Yanick ( http://search.cpan.org/~yanick/ ) was able to quickly merge the old history with the new history to create a fairly normal history. I don't quite understand how he did it, but he would be willing to consult about this I suspect. Mark


This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.