[Zope-Perl] REQUEST object

Monty Taylor mtaylor@goldridge.net
Wed, 02 Aug 2000 14:17:24 +0200


Gisle Aas wrote:
> The REQUEST object will just be Python::Object reference when passed
> to perl.  The reason you see the contents as html is probably that the
> python object underneath provide a __str__ method returning that stuff
> and if you simply use a Python::Object in string context perl will
> invoke the equivalent of str(o) and use that.  If you just call
> methods on the object it should work.

That makes sense. I was calling it in string context. 

Here's what I finally did that worked:
dtml-method:
<dtml-call "test_perl(REQUEST)">

PerlMethod:
  Arguments: REQUEST
  Code:      my $foo=shift;
             foreach ( $foo->keys ){
               print;  #Goes to stderr in Debug mode
               print "\n";
             }

As a note, test_perl(REQUEST=REQUEST) does not work, and neither does
just 
plain test_perl(). What does the REQUEST in the arguments get us? Since
we're
using Perl shift to grab arguments from @_, we're not really providing
named 
parameters. Yet without REQUEST in the arguments, it doesn't work. 
This method of doing things seems to work fine, but I'd love to
understand what's
actually happening here. Any thoughts?


Thanks alot,
Monty