Ok, I think I figured it out.   I neglected to mention it before, but the 
error I was getting was

(8)Exec format error: [path to the content filename]

The problem was here:

( trimmed down, with the param call moved up into the main handler.  I have 
a question about that, too)

sub print_component {
     my ($r) = shift;
     my ($file) = shift;                 # this is the path to the 
component file
     my ( $args ) = shift;
     if ( -e $file ) {
         if($file =~ /\.(?:cgi|pl)$/o) {         # if the file is a script
             my $apr = Apache::Request->new($r);
             my $status = $apr->parse;
             unless ($status == OK) {
                 $apr->custom_response($status,$apr->notes("error-notes"));
                 return $status;
             }
             my ( $uri ) = $r->uri;              # this isn't the 
component, though
             $uri = $uri .'?'.$args if $args;
             my $subr = $r->lookup_uri($uri);
             $subr->handler('cgi-script');
             $subr->run();                       # running the wrong thing
      }
      # otherwise it's a static file...
}

The problem was that I was basing the action decision based on $file (the 
path to the component), and executing $uri, which was always (duh) the uri 
and (duh) never the component.

My other question is about Apache::Request.   Why does this:

             my $apr = Apache::Request->new($r);
             my @params = $apr->param;

poon the parameters listing when it runs?   If I have a page that contains 
three scripts as components, I need every component to get any arguments 
passed in.   If I run the above for each component, only the first one gets 
the arguments.   All others after that get junk.   I have corrected for 
this by calling the code only once, but I'm curious as to whether or not 
this is the expected behavior and why.

thanks everyone,
Todd





At 02:49 PM 9/12/00 -0400, Todd Finney wrote:
>Hi,
>
>I have a handler - we talked about it a few weeks ago, Templating Redux - 
>that mostly works.   It takes any page request, and wraps it in a template 
>file while also adding some cookie-defined components to the 
>template.  One of the problems it is having is when I try to insert a cgi 
>script as anything other than the requested page (as a toolbar for 
>example), the server tries to execute the content file, which is usually 
>an html file.   If the content is a perl script, and the components 
>(toolbar, etc) are static, everything works peachily.
>
>The wrapper follows.  Code comments that could lead to my improvement as a 
>(mod_)perl programmer are always most welcome.   If you need more 
>information, please ask.
>
>thanks everyone!
>Todd
>

Reply via email to