[Templates] TT2: $template eq 1 in Template::Context::process (fwd)

Andy Wardley abw@cre.canon.co.uk
Fri, 4 Aug 2000 10:57:01 +0100 (BST)


> Hmm.. Seems that this message didn't make it to the list. 

I've noticed the same problem.  Some of the messages archived on the
web site didn't get delivered to me.  I'll check it out when I get a 
moment, but it won't be until after the weekend.

> I'm using mod_perl. On the second execution of the compiled template by
> the same process do I get the error:
> 
> Can't call method "process" without a package or object reference at
> Template/Context.pm line 229
> 
> It seems that $self->template($template) returns 1.

Yes, I think this is related to a bug I've just fixed.  When it tries
to require() a template that is already loaded, require() returns 
1 to say "it's already loaded".  I now explicitly delete the %INC 
entry before reloading.

This is the relevant section, around line 333 of Template::Provider.pm
(in _fetch_path()).

	    # load compiled template via require();  we zap any
            # %INC entry to ensure it is reloaded (we don't 
	    # want 1 returned by require() to say it's
	    # in memory)
+	    delete $INC{ $compiled };
	    eval { $data = require $compiled };



A

PS  See following message about known bugs.