You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Justin Harrison <sh...@doublebagel.com> on 2002/10/14 21:12:52 UTC

Namespace/scope issue?

Hi,

I have an embperl webpage and I am executing another piece of code into
it like this:

		[- $new_code = Execute ({'object' => 'code.pm',syntax =>
'Perl'});
		$result = $new_code->subroutine -]

Inside code.pm:

Sub subroutine {
Use morecode;
&subroutine_inmorecode;
}

1;


Inside morecode:

Sub  subroutine_inmorecode {

}

Sub subroutine_inmorecode1 {


}

1;



At no point do I declare any packages, etc.

I use the same kind of code elsewhere and it works fine:

I execute module as Perl, call a sub routine in the module using
$code->subroutine, and that subroutine then uses the exact same module,
("morecode") and it can call it fine..

Any ideas?

Justin


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


RE: Namespace/scope issue?

Posted by Justin Harrison <sh...@doublebagel.com>.
I thought that as long as I did not declare my own package inside this
code, that it would be OK?

Thanks for the FAQ Link - And sorry for this package/namespace
repeatitedness on the mailing list!

Justin

> -----Original Message-----
> From: Gerald Richter [mailto:richter@ecos.de] 
> Sent: Wednesday, October 16, 2002 2:07 AM
> To: Justin Harrison; embperl@perl.apache.org
> Subject: Re: Namespace/scope issue?
> 
> 
> Hi,
> >
> > I have an embperl webpage and I am executing another piece of code 
> >into  it like this: ...
> >
> > At no point do I declare any packages, etc.
> >
> 
> That will cause problems, if you use your module from 
> different EMbperl pages, because Embperl assigns a different 
> package to every page. See 
> http://perl.apache.org/embperl/pod/doc/doc13/pod/Faq.-page-3-.
htm#sect_19
for a explanation.

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: Namespace/scope issue?

Posted by Gerald Richter <ri...@ecos.de>.
Hi,
>
> I have an embperl webpage and I am executing another piece of code into
> it like this:
>...
>
> At no point do I declare any packages, etc.
>

That will cause problems, if you use your module from different EMbperl
pages, because Embperl assigns a different package to every page. See
http://perl.apache.org/embperl/pod/doc/doc13/pod/Faq.-page-3-.htm#sect_19
for a explanation.

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