Hi all,

First off, apologies if this is not the correct place to discuss
HTML::Template::Plugin::Dot - if there is an alternative, please let me
know.

I came across a problem when I tried using CGI::Application::Plugin::HTDot -
I couldn't use a parameter with a dot in its name as per the
HTML::Template::Plugin::Dot examples. Instead I get:

Bare word 't.name' not allowed in argument list to 'greeting' in dot
expression 't.greeting(t.name)' at
/usr/local/lib/perl5/site_perl/5.8.0/Class/Trigger.pm line 51

I wondering if I misunderstand the ability to supply dotted parameters to
method calls. I've come up with a simple case that illustrates my problem
below

Regards

Dan

--code--

package Test;
use strict;

sub name {
    my $self = shift;
    $self->{name} ||= shift;
    return $self->{name};
}

sub greeting {
    my $self = shift;
    my $name = shift;
    return "hello $name";
}

sub new {
    my $class = shift;
    bless {}, $class;
}

1;

use HTML::Template::Pluggable;
use HTML::Template::Plugin::Dot;

my $text = '<tmpl_var t.greeting(t.name)>';

my $test = Test->new();
$test->name('bob');

my $template = HTML::Template::Pluggable->new(scalarref => \$text);
$template->param('t' => $test);

print $template->output;



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Html-template-users mailing list
Html-template-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/html-template-users

Reply via email to