[Zope-Perl] How to get REQUEST's and RESPONSE's

Gisle Aas gisle@ActiveState.com
14 Mar 2001 11:33:41 -0800


"Greg Green" <gregory.p.green@boeing.com> writes:

> I have tried numerous ways to use the REQUEST and/or the RESPONSE object's in
> perl methods in Zope without success. I have a Perl Script:
> 
> arguments: self, REQUEST, RESPONSE
> 
> Code:
> 	return $REQUEST->items();
> 
> And i get an error:
>     Error Type: PerlError
>     ErrorValue: Usage: Python::PyObject_GetAttr(o, attrname) at .../perl/Zope.pm
>     line 118.
> 
> Also I tried an unrestricted Perl script, testperl.pm:
> ---------------------------------------------------------------------
> package testperl;

The package name should be 'ZopeExt::testperl'.

> require Exporter;
> @ISA = qw(Exporter);
> @EXPORT = qw(testit);

You should not do this.  I don't think it actually harms though.


> sub testit {
>     local $self = shift @_;
>     local $REQUEST = shift @_;
>     local $RESPONSE = shift @_;
> 
>     return $REQUEST->items();
> }
> 
> return 1;
> 
> ---------------------------------------------------------------------
> This is installed in ZopeBase/Extensions/ZopeExt/testperl.pm
> 
> When I try it I get:
> 
>      ErrorType: PerlError
>      ErrorValue: Undefined subroutine
>      &ZopeExt::testperl::testit called
> 
> Please reply to me directly as I am not on the list.