On Thu, Mar 18, 2004 at 09:15:25AM -1000, Clifton Royston wrote:
>   That must be a part of the problem.  Quite odd.  I am currently
> unable to reproduce it myself with a very simple script, so there's
> something about the broader execution environment going on here...
> 
>   I'll check back in once I have a script which reproduces it.  

  OK, I think I have this worked out.  What was probably confusing us
both is the builtin fallback (IIRC) to trying some different paths,
including the current working dir, to load the templates from.  The
result is that if you are executing the script from the same relative
path to the included files, it seems to work. 

  Here's the simplest scenario I can find to reproduce it.  Files are
in these relative paths:

/home/cliftonr/work:
   a.html
   b.html
   c.html

/home/cliftonr/work/htmltest:
     test-template.pl
     main.html

/home/cliftonr/work/a.html:
<b>Contents of template "a.html"</b>

 similarly for b.html and c.html

/home/cliftonr/work/htmltest:
#!/usr/bin/perl
use HTML::Template;
use constant TEMPLATE_DIR => '/home/cliftonr/work/html-test';
   my $template = HTML::Template->new(
        filename => TEMPLATE_DIR . '/' . $ARGV[0] );
   print $template->output( );
1;

/home/cliftonr/work/htmltest/main.html:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>Main</title></head>
<body><div align=center style="height: 100%;"><table width=100%
border="0" cells
pacing="0" cellpadding="0" ><tr><td>
<tmpl_include NAME="../a.html">after a</td></tr><tr><td>
<tmpl_include NAME="../b.html">after b</td></tr> <tr><td> <tmpl_include 
NAME="../c.html"> </td></tr></table>
</div></body></html>


cd ~/work/html-test;
~/work/html-test/test-template.pl main.html
 [works normally, outputs template with all inclusions]

cd /home/cliftonr/random1/random2;
~/work/html-test/test-template.pl main.html
HTML::Template->new() : Cannot open included file ../c.html : file not found. at
 /usr/local/lib/perl5/site_perl/5.6.1/HTML/Template.pm line 2180.

Note that "a.html" is on its own line, and the following include of
"b.html" works OK, but "b.html" and "c.html" are on the same line, and
the second does not work.

  -- Clifton

-- 
          Clifton Royston  --  [EMAIL PROTECTED] 
         Tiki Technologies Lead Programmer/Software Architect
Did you ever fly a kite in bed?  Did you ever walk with ten cats on your head?
  Did you ever milk this kind of cow?  Well we can do it.  We know how.
If you never did, you should.  These things are fun, and fun is good.
                                                                 -- Dr. Seuss


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
Html-template-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/html-template-users

Reply via email to