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

Andy McKay andym@ActiveState.com
Wed, 14 Mar 2001 10:29:50 -0800


> Also I tried an unrestricted Perl script, testperl.pm:
> ---------------------------------------------------------------------
> package testperl;
> require Exporter;
> @ISA = qw(Exporter);
> @EXPORT = qw(testit);
>
> 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.

Changing a perl external method can be a little flaky, try it a few more
times to see if it works. Sometimes it does, sometimes it doesnt. You can
get REQUEST straight from self which is what I have done:

my $self = shift;
my %REQUEST = %{$self->{'REQUEST'}};

I tried this in an Internal method and got into some bother, so I'll have a
closer look when I have more time.

HTH.

--
  Andy McKay