Wim Kerkhoff wrote:
> 
> Gerald Richter wrote:
> >
> > > The only thing that's been hooping me up so far in the
> > > inability to do these two types of includes:
> > >
> > > <!--#include virtual="/some/file.html">
> >
> > This should work
> 
> Should work, but doesn't. Basically it returns nothing... no errors or
> anything else in its place in the calling document. #include
> file="/path/to/actual/some/file.html" works fine.

I've been trying to get this to work. I think that the problem is that
HTML::Embperl::Syntax::SSI isn't setting up the $apreq object properly.
I added warn, die, and exit calls to InitSSI... but it appears that its
not being called, and hence $apreq (global to SSI.pm) is undefined. I
see where the "callback" is set up for it in Init, but I'm not to sure
where that code snip is supposed to be called from... This also means
that $epreq isn't set up, and that $ENV{DOCUMENT_ROOT}, etc aren't being
initialized either, which confuses find_file().  I was 100% confident
that I had everything configured properly...

I've attached a diff of what I've been mucking about... currently, I've
got it so that

<!--#include embperl="something.epl"--> works.

For the rest, its pretty messy with the debug stuff I was working with. 
I haven't actually tried this out in real code yet, just with sample
Embperl/SSI "hello world" type scripts.

-- 

Regards,

Wim Kerkhoff, Software Engineer
Merilus, Inc.  -|- http://www.merilus.com
Email: [EMAIL PROTECTED]
105c105
<     $self -> AddComment ('#include', ['file', 'virtual'], undef, undef, 
---
>     $self -> AddComment ('#include', ['file', 'virtual', 'execute'], undef, undef, 
107c107
<                                         '_ep_rp(%$x%, 
HTML::Embperl::Syntax::SSI::include (%&\'file%, %&\'virtual%)) ;',
---
>                                         '_ep_rp(%$x%, 
>HTML::Embperl::Syntax::SSI::include (%&\'file%, %&\'virtual%, %&\'execute%)) ;',
183a184,187
>     warn "set apreq to $apreq!";
>     exit;
>     die;
> 
220c224
<     my ($fn, $virt) = @_;
---
>     my ($fn, $virt, $execute) = @_;
222a227,229
>     warn "searching fn=$fn, virt=$virt, execute=$execute";
>     warn "apreq=$apreq";
> 
227c234,235
<         return $ENV{DOCUMENT_NAME} ;
---
>       warn "document_name=$ENV{DOCUMENT_NAME}";
>         return $ENV{DOCUMENT_NAME} || $fn || $execute ;
231a240
>       warn "fn?";
234a244,249
>     if ($execute)
>         {
>       warn "Execute??";
>       my $req = $apreq -> lookup_file (InterpretVars ($execute));
>       return $req -> filename;
>     }
237c252,253
<         my $req = $apreq -> lookup_uri (InterpretVars ($fn)) ;
---
>       warn "virtual??";
>         my $req = $apreq -> lookup_uri (InterpretVars ($virt)) ;
241a258
>       warn "guesing";
327,329c344,345
< sub include 
<     {
<     my($fn, $virt) = @_;
---
> sub include {
>     my($fn, $virt, $execute) = @_;
331c347
<     my $file = find_file($fn, $virt) ;
---
>     my $file = find_file($fn, $virt, $execute) ;
333d348
<     local $HTML::Embperl::escmode = 0 ;
335,337c350
<     open FH, "<$file" or die "Cannot open $file ($!)" ;
<     my $val = <FH> ;
<     close FH ;
---
>     warn "fn=$fn, virt=$virt, execute=$execute, file=$file";
339c352,366
<     return $val ;
---
>     if ($execute) {
>       use HTML::Embperl;
>       warn "executing $file...";
>       my $val = "";
>         HTML::Embperl::Execute({inputfile=>$file, output=>\$val});
>       return $val;
>     }
>     else {
>         local $HTML::Embperl::escmode = 0 ;
> 
>         open FH, "<$file" or die "Cannot open $file ($!)" ;
>         my $val = <FH> ;
>         close FH ;
> 
>         return $val ;
340a368
> }
363a392,393
>     warn "r=$r";
>     warn "filename=$filename";

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to