>>>>> "JS" == Jim Serio <[EMAIL PROTECTED]> writes:

JS> wrapper script and it works fine so I'm inclined to
JS> think thatSandwich emits a header before even processing
JS> the header file.

Yes it does.  A quick scan of the Apache::Sandwich::handler() function
would confirm this:

    #send headers to the client
    $r->content_type("text/html");
    $r->send_http_header;

    return OK if $r->header_only(); # HEAD request, so skip out early!

    #run subrequests to include the HEADER uri's
    foreach (@header) {
        my $status = Apache::Include->virtual($_, $r) if $_;
        warn "sandwiching $_ ($status)\n" if $Debug;
        #bail if we fail!
        return $status unless $status == DOCUMENT_FOLLOWS; 
    }

    # run subrequest using the specified handler (or default handler)
    # for the main document.

 etc.

I has to send the headers before it sends the header parts, and it has
to send the header parts before it sends the requested document.

You can mimic this using the Apache::Sandwich::insert_parts() function
something like this instead of sandwiching your perl program directly.

#! /usr/local/bin/perl
use strict;

# program template

use CGI;
use Apache::Sandwich;

use vars qw($query);

$query = new CGI or die "Something failed";

print $query->header();
Apache::Sandwich::insert_parts('HEADER');

# program stuff goes here.


Apache::Sandwich::insert_parts('FOOTER');

Reply via email to