You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Benni Baermann <be...@obda.de> on 2003/12/02 15:16:33 UTC
called from embperl? $0 available?
Hi!
I noticed, that $0 is set to "-e" in my module if it is called from
embperl. Is this the normal behaviour or just random?
Is there another - possible better - way to determine in my modul, if
the function is called from Embperl or from an ordinary script?
Thanks for any help! (and thanks for the helpful answers to my other
question :-)
Benni
--
http://www.aymargeddon.de
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
Re: called from embperl? $0 available?
Posted by Sherwin Daganato <sh...@saturn.emc.com.ph>.
On Tue, Dec 02, 2003 at 03:16:33PM +0100, Benni Baermann wrote:
> I noticed, that $0 is set to "-e" in my module if it is called from
> embperl. Is this the normal behaviour or just random?
>
> Is there another - possible better - way to determine in my modul, if
> the function is called from Embperl or from an ordinary script?
>
Try this inside your function:
# tested on HTML-Embperl-1.3.4
if ( (caller)[0] =~ /^HTML::Embperl::DOC::_\d+$/ ) {
# was called from Embperl
} else {
# was called from elsewhere
}
HTH
Sherwin
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org