Hi there,
I'm newby on template toolkit but I' trying to use it in a new project I'm 
working at. I'm using Moose also and I'm fascinated with lazy loading (i really 
love this feature, among others).
The problem I'm having right now is with template toolkit and these kind of 
variables.
Here is the code I'm using. 

#!/usr/bin/perl
package value; 
{
    use Moose;
    has 'nolazy'    => ( is => 'ro', isa => 'Bool', default => 0);
    has 'lazy'        => (is => 'ro', isa =>"Bool", 
                                    lazy =>1, 
                                    default => 
                                        sub
                                        {
                                            return 1;                           
                                                   
                                        });
}
use Template;

        my $tt = Template->new({
                                INCLUDE_PATH => './',
                                EVAL_PERL    => 1,
                                }) || die $Template::ERROR, "\n";
        
        $Template::Parser::DEBUG = 1;
        $Template::Directive::PRETTY = 1;
        $myValue = value->new();
        #discomment the above line and the lazy variable will show you a value 
in the template;
#        $myValue->lazy();
        
        $text = "no lazy var [% nolazy %] - lazy var [% lazy %]
";
        $tt->process(\$text, $myValue) || die $tt->error(), "\n";        
1;

any thoughts on this?

TIA
Juan
                                          
_________________________________________________________________
Hotmail: Trusted email with powerful SPAM protection.
https://signup.live.com/signup.aspx?id=60969
_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates

Reply via email to