You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Gerald Richter <ri...@ecos.de> on 2002/03/18 21:09:09 UTC

Re: write module for Embperl and HTML::Embperl namespace (was: 2.0b6 namespace HTML vs. non HTML)


> I have some perl libraries that check to see if they are running in
> Embperl so they can use certain things (typically OUT and escmode).
> What's the best way to make it possible for them to run under either
> environment?

Instead of using Embperl::OUT etc. directly, make an alias into your
package. You can make this alias to HTML::Embperl or Embperl, depending from
where you are called, e.g.:

*OUT = \*Embperl::OUT ;
*fdat = \%Embperl::fdat ;

or if you want to have compatibility, you can create the alias in
HTML::Embperl namespace:

*HTML::Embperl::OUT = \*Embperl::OUT ;
*HTML::Embperl::fdat = \%Embperl::fdat ;

but this will not work if you use 1.3 and 2.0b6+ on the same Apache server.

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: write module for Embperl and HTML::Embperl namespace (was: 2.0b6 namespace HTML vs. non HTML)

Posted by Gerald Richter <ri...@ecos.de>.
>
> That's fine, but how do I tell which one called me?  The joys of
> object-oriented programming--my module is two deep down to easily be
> passed the information.
>

If only one module of both is loaded, you can simply test for existens for
some symbol you now that should exist e.g.

if (define(&Embperl::handler))
    .....

if both are used in the same server that won't work, and you have to walk up
your call stack using the caller function, to see from where you are called

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: write module for Embperl and HTML::Embperl namespace (was: 2.0b6 namespace HTML vs. non HTML)

Posted by Kee Hinckley <na...@somewhere.com>.
At 9:09 PM +0100 3/18/02, Gerald Richter wrote:
>  > I have some perl libraries that check to see if they are running in
>>  Embperl so they can use certain things (typically OUT and escmode).
>>  What's the best way to make it possible for them to run under either
>>  environment?
>
>Instead of using Embperl::OUT etc. directly, make an alias into your
>package. You can make this alias to HTML::Embperl or Embperl, depending from
>where you are called, e.g.:

That's fine, but how do I tell which one called me?  The joys of 
object-oriented programming--my module is two deep down to easily be 
passed the information.

-- 

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