You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Kee Hinckley <na...@somewhere.com> on 2002/03/13 22:20:12 UTC

Auto-loading an embperl file?

I often find myself with a site where every page starts off with:

[! Execute('common-set-of-routines') !]

Is there anyway (other than Embperl::Object, which I may already be 
using on portions of the site for other things) to configure this to 
happen automatically?
-- 

Kee Hinckley - Somewhere.Com, LLC
http://consulting.somewhere.com/
nazgul@somewhere.com

I'm not sure which upsets me more: that people are so unwilling to accept
responsibility for their own actions, or that they are so eager to regulate
everyone else's.

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: Auto-loading an embperl file?

Posted by Gerald Richter <ri...@ecos.de>.
>
> Are these routines which must be executed on every page or merely
> present? If the latter then look at EMBPERL_OBJECT_HANDLER_CLASS.
>

This is also a possiblity when dealing with Embperl::Object, the difference
is that when you define an application object, it's init method will be
called, a EMBPERL_OBJECT_HANDLER_CLASS will just make methods available via
$r -> method

Gerald



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

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




---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: Auto-loading an embperl file?

Posted by Andrew O'Brien <an...@switchonline.com.au>.
On Wed, Mar 13, 2002 at 04:20:12PM -0500, Kee Hinckley wrote:
> I often find myself with a site where every page starts off with:
> 
> [! Execute('common-set-of-routines') !]
> 
> Is there anyway (other than Embperl::Object, which I may already be 
> using on portions of the site for other things) to configure this to 
> happen automatically?

Are these routines which must be executed on every page or merely
present? If the latter then look at EMBPERL_OBJECT_HANDLER_CLASS.

If they need to be executed on every sub-Execute then you may want to
look at rearranging things - I haven't hit a situation that wasn't
solved either with the above or a base file that stuck an
epl-executed-to-object thingy in $req. But I may have been lucky :)

Not knowing exectly what you're trying to do, you may want to have a
look at EMBPERL_INPUT_FUNC

-- 
 Andrew O'Brien
 Senior Engineer                       email: andrewo@switchonline.com.au.
 Switch Online Group Pty Limited       phone: +61 2 9299 1133
 ABN 89 092 286 327                    fax:   +61 2 9299 1134

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: Auto-loading an embperl file?

Posted by Gerald Richter <ri...@ecos.de>.
> I often find myself with a site where every page starts off with:
>
> [! Execute('common-set-of-routines') !]
>
> Is there anyway (other than Embperl::Object, which I may already be
> using on portions of the site for other things) to configure this to
> happen automatically?

The new application object introduced in 2.0b6 is excatly what fit here. You
can use it either together with Embperl::Object, in which case it is
searched like any other file (use EMBPERL_OBJECT_APP) or/and you can define
it for use in "normal" Embperl (use EMBPERL_APP_HANDLER_CLASS). It's init
method is called at the start of every request (when %fdat and %udat etc.
already available) and you can define any common need subs here or do your
Execute from it.

Gerald


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

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





---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org