On Sun, 16 May 2004, Nishikant Kapoor wrote:
I do edit the template by hand but in this case, the mtime on the template is not changing. However, the content for the template needs to change based on whether the user is logged-in or logged-out.
Well that has nothing to do with the file cache. To convince yourself, turn it off and observe that nothing changes! The file cache is just saving HTML::Template the trouble of loading the template from disk every time it needs it. It has nothing to do with the output - that's driven by your calls to param(), which are reset after every new().
Okay, here is what I think is happening.
index.shtml: ... <!--#exec cgi="/cgi-bin/featuredLinks.cgi"--> ...
When you login or logout, sub showHome() is called.
sub showHome { ... my $filter = sub { my $textRef = shift;
my $strToReplace = 'featuredLinks.cgi'; if ($$textRef =~ /(.*cgi=\")(.*$strToReplace)(\".*)/) { my $strToReplaceWith = &getFeaturedLinks; $$textRef =~ s/(.*cgi=\")(.*$strToReplace)(\".*)/$strToReplaceWith/g; } };
my $template = HTML::Template->new(filename => 'index.shtml', file_cache => 1, file_cache_dir => 'tmplCache', file_cache_dir_mode => 0777, filter => $filter); ... } #end of showHome()
When file_cache is ON, template is being returned from the cache, thereby bypassing the $filter which is actually responsible for getting the appropriate data based on user's login status and hence, the inconsistency. Does this look like what is going on here? If so, what would you suggest be the workaround?
Thanks, Nishi
------------------------------------------------------- This SF.Net email is sponsored by: SourceForge.net Broadband Sign-up now for SourceForge Broadband and get the fastest 6.0/768 connection for only $19.95/mo for the first 3 months! http://ads.osdn.com/?ad_id=2562&alloc_id=6184&op=click _______________________________________________ Html-template-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/html-template-users