You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Michael Finke <mf...@apollo.screamdesign.com> on 2000/02/17 17:04:02 UTC

Using Apache::FakeRequest and DAD

Our setup:
	Apache		1.3.11
	DAD		2.02(Modified)
	mod_perl	1.21
	FakeRequest	1.0

Our project:
	We're working on dynamically generated pages, which need to
include advertisements pulled out of DAD.  We are working on pages which
will have the same content, yet are wrapped by unique headers and footers
depending on the site from which the pages are hit.  The headers and
footers are both perl scripts which determine the appropriate
header/footer to tack on.  It then reads the proper flat HTML file and
splats it back to the screen.  

The problem:
	We're using Apache::FakeRequest to spoof DAD into returning the ad
data back into a variable so we can insert it into the page where it is
needed.  The problem we're having though is getting $r->args to set
correctly.  We've tried everything we could think of, to no avail.  No
matter what we pass to FakeRequest, $r->args is only getting the first
item we pass.  The errors we are getting are: "Odd number of elements in
hash assignment at /usr/local/apache/perl/DAD/public.pm line 109."  

	Anyone know how to get $r->args set properly on a FakeRequest so
we can kill these two errors that keep spamming our logs?

	Any help anyone can give us would be greatly appreciated, we're
stuck as to how to fix this.  I apologize if this gets posted twice, I
sent it out yesterday and never saw it come across the list.  I figured it
should show within 24 hours. 

Michael Finke
ScreamDesign.Com
(978)-579-0898 X240


Re: Using Apache::FakeRequest and DAD

Posted by Doug MacEachern <do...@pobox.com>.
On Thu, 17 Feb 2000, Michael Finke wrote:

> Our setup:
> 	Apache		1.3.11
> 	DAD		2.02(Modified)
> 	mod_perl	1.21
> 	FakeRequest	1.0
> 
> Our project:
> 	We're working on dynamically generated pages, which need to
> include advertisements pulled out of DAD.  We are working on pages which
> will have the same content, yet are wrapped by unique headers and footers
> depending on the site from which the pages are hit.  The headers and
> footers are both perl scripts which determine the appropriate
> header/footer to tack on.  It then reads the proper flat HTML file and
> splats it back to the screen.  
> 
> The problem:
> 	We're using Apache::FakeRequest to spoof DAD into returning the ad
> data back into a variable so we can insert it into the page where it is
> needed.  The problem we're having though is getting $r->args to set
> correctly.  We've tried everything we could think of, to no avail.  No
> matter what we pass to FakeRequest, $r->args is only getting the first
> item we pass.  The errors we are getting are: "Odd number of elements in
> hash assignment at /usr/local/apache/perl/DAD/public.pm line 109."  
> 
> 	Anyone know how to get $r->args set properly on a FakeRequest so
> we can kill these two errors that keep spamming our logs?

Apache::FakeRequest::args doesn't parse the string in a list context.
if you look at FakeRequest.pm all the methods are generated and end up
calling this:
sub elem {
    my($self, $key, $val) = @_;
    $self->{$key} = $val if $val;
    $self->{$key};
}

you could take `args' out of the @methods list and implement a version
that behaves as Apache::args does under mod_perl, patch is most welcome.
i'll add it to the ToDo list for now.