> > > To get the Embperl request object, you need to get the first
> > > parameter passed to the page (not to the sub):
> > >
> > > [-
> > > $r = shift ;
> > > -]
> > >
>
> I am using Perl syntax, so this does not work, and trying $r = shift
> results in nothing..
>

ok, I was a little unclear. The $r = shift works in a normal page that is
executed, not in the file that is included via the object => parameter. To
get $r in this case you must retrive it in the calling page and pass it as a
parameter, e.g.:

calling page

[-
$r = shift ;
$obj = Execute ({object => 'file.pl', syntax => 'Perl'}) ;

$obj -> mysub ($r) ;
-]

in the file.pl

sub mysub
    {
    my ($self, $r) = @_ ;
    ....
    }

So I hope that's better now, sorry for my misleading description

Gerald


> > -----Original Message-----
> > From: Justin Harrison [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, July 30, 2002 12:37 PM
> > To: [EMAIL PROTECTED]
> > Subject: RE: Execute
> >
> >
> > Hi Gerald,
> >
> > Thanks for your response. It definitely does.
> >
> > > -----Original Message-----
> > > From: Gerald Richter [mailto:[EMAIL PROTECTED]]
> > > Sent: Tuesday, July 30, 2002 2:53 AM
> > > To: Justin Harrison; [EMAIL PROTECTED]
> > > Subject: Re: Execute
> > >
> > >
> > >
> > >
> > > > I'm having problems trying to get an embperl::req object in my
> > > > imported perl code (As objects)..
> > > >
> > > > [- Execute ({'object'
> > > > =>'/home/user/dir/lib/web/whatever/whatever.pm',syntax =>
> > > 'Perl'}) -]
> > > >
> > > >
> > >
> > http://perl.apache.org/embperl/pod/intro/IntroEmbperlObject.-page-5-.h
> > > > tm
> > > > says:
> > > >
> > > > "This object is passed in on the stack, so you can retrieve
> > > it using
> > > > the Perl "shift" statement."
> > > >
> > > > The first argument to my sub routines in whatever.pm, when
> > > imported as
> > > > objects, however, does not seem to be the same request
> > object (Or a
> > > > request object at all? Looking at it...) I used in the
> > > caller for the
> > > > execution of the perl file.
> > > >
> > > > It receives Embperl::__7=HASH(0xa8b0304) as the first argument (An
> > > > object reference?)..
> > > >
> > >
> > > Yes, this is correct. That's the object you have created not
> > > the Embperl request object.
> > >
> > > > I tried to use Data Dump on it, but it segfaulted Apache
> > everytime.
> > > >
> > >
> > > This may happen if Data::DUmper tries to display the "magic"
> > > Embperl uses to tied it's data to this request record. I
> > > never tried this...
> > >
> > > To get the Embperl request object, you need to get the first
> > > parameter passed to the page (not to the sub):
> > >
> > > [-
> > > $r = shift ;
> > > -]
> > >
> > > > I tried importing it to access sub routines "normally", but
> > > it didn't
> > > > find them in the current name space.
> > > >
> > >
> > > This should work when you use the import => 1 parameter. When
> > > using the object parameter you should do something like the
> > > following to call them:
> > >
> > > [-
> > > $obj = Execute ({'object'
> > > =>'/home/user/dir/lib/web/whatever/whatever.pm',syntax => 'Perl'})
> > >
> > > $obj -> mysub ;
> > >
> > > -]
> > >
> > > in mysub you get $obj passed as first parameter
> > >
> > > Hope this makes things a little bit more clear
> > >
> > > Gerald
> > >
> > >
> > > > > -----Original Message-----
> > > > > From: Justin Harrison [mailto:[EMAIL PROTECTED]]
> > > > > Sent: Thursday, July 25, 2002 9:12 PM
> > > > > To: [EMAIL PROTECTED]
> > > > > Subject: RE: Execute
> > > > >
> > > > >
> > > > > Thank you Gerald. I love you.
> > > > >
> > > > > > -----Original Message-----
> > > > > > From: Gerald Richter [mailto:[EMAIL PROTECTED]]
> > > > > > Sent: Thursday, July 25, 2002 7:45 PM
> > > > > > To: Justin Harrison; [EMAIL PROTECTED]
> > > > > > Subject: Re: Execute
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > > It seems to work in some fashion with Embperl Meta Subs..
> > > > > > >
> > > > > > > Is it by design that it seems not to function with
> > > perl subs? Am
> > > > > > > I doing something wrong? :-( Is there anyway to make it
> > > > > function with
> > > > > > > perl subs?
> > > > > > >
> > > > > >
> > > > > > It also works with perl subs, but you either need to
> > > tell Execute
> > > > > > that you are loading pure Perl code or wrap your sub's
> > > inside of a
> > > > > > [- -] block:
> > > > > >
> > > > > > Either:
> > > > > >
> > > > > > [- $r->{content} = Execute ({'object' =>
> > > > > > '/home/zo/zo/lib/zoweb/content/content.pm',
> > > > > > syntax => 'Perl'
> > > > > > }) -]
> > > > > >
> > > > > > or
> > > > > >
> > > > > > > > In content.pm:
> > > > > > > >
> > > > > > > > #package zoweb::content::content;
> > > > > > > > #use strict;
> > > > > >
> > > > > > # Never put a package statement here, Embperl will setup the
> > > > > > package for you
> > > > > >
> > > > > > [-
> > > > > > sub title {
> > > > > >  }
> > > > > >
> > > > > > -]
> > > > > >
> > > > > > Gerald
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > --------------------------------------------------------------------
> > > > > -
> > > > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > > > >
> > > > >
> > > > >
> > > > >
> > > --------------------------------------------------------------------
> > > > > -
> > > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > > >
> > > >
> > > >
> > > >
> > >
> > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > >
> > > >
> > >
> > >
> > > -------------------------------------------------------------
> > > Gerald Richter    ecos electronic communication services gmbh
> > > Internetconnect * Webserver/-design/-datenbanken * Consulting
> > >
> > > Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
> > > E-Mail:     [EMAIL PROTECTED]         Voice:    +49 6133 925131
> > > WWW:        http://www.ecos.de      Fax:      +49 6133 925152
> > > -------------------------------------------------------------
> > >
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-------------------------------------------------------------
Gerald Richter    ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
E-Mail:     [EMAIL PROTECTED]         Voice:    +49 6133 925131
WWW:        http://www.ecos.de      Fax:      +49 6133 925152
-------------------------------------------------------------



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to