[Zope-Perl] REQUEST object
Gisle Aas
gisle@ActiveState.com
02 Aug 2000 14:04:53 +0200
Monty Taylor <mtaylor@goldridge.net> writes:
> First off, great job! It took me all of 10 minutes to get things up and
> running. My cynical office-mates were suitably impressed. :)
Cool.
> Quick question: In a PerlMethod, how does one access the REQUEST object?
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.
As a demo try to create a new perl method like this:
Arguments: REQUEST
Code: my $req = shift;
return $req->get_header("User-Agent");
When you invoke it you should see the name of you browser.
> I tried passing it as a parameter, but that passed the contents as html,
> like this:
>
> <dtml-call "test_perl(foo=REQUEST)">
>
> Is REQUEST available in a namespace somewhere in the PerlMethod, or am I
> missing something? (Or should I not be trying to pass the whole darned
> REQUEST object?)
I think that should work too. What was the Arguments/Code of your perl method?
Regards,
Gisle