You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by "Narins, Josh" <jo...@lehman.com> on 2002/01/16 21:10:27 UTC

Registry, Exporter and namespaces

I'm using Apache::Registry with Exporter.pm in a mod_perl, not trivially
small, environment.

I only use EXPORT_OK, no EXPORT.

I'm wondering about the following situation.

package Foo export_oks "random_fn"
package Bar export_oks "random_fn"

Script foo.pl has line "use Foo qw(random_fn); use Bar();"

Script bar.pl has line "use Bar qw(random_fn); use Foo ();"

It's been suggested to me that bar.pl might actually use &Foo::random_fn
unless it fully qualifies calls to random_fn. 

Thank you,

-Josh Narins



------------------------------------------------------------------------------
This message is intended only for the personal and confidential use of the designated recipient(s) named above.  If you are not the intended recipient of this message you are hereby notified that any review, dissemination, distribution or copying of this message is strictly prohibited.  This communication is for information purposes only and should not be regarded as an offer to sell or as a solicitation of an offer to buy any financial product, an official confirmation of any transaction, or as an official statement of Lehman Brothers.  Email transmission cannot be guaranteed to be secure or error-free.  Therefore, we do not represent that this information is complete or accurate and it should not be relied upon as such.  All information is subject to change without notice.



Re: Registry, Exporter and namespaces

Posted by Paul Lindner <li...@inuus.com>.
On Wed, Jan 16, 2002 at 03:10:27PM -0500, Narins, Josh wrote:
> I'm using Apache::Registry with Exporter.pm in a mod_perl, not trivially
> small, environment.
> 
> I only use EXPORT_OK, no EXPORT.
> 
> I'm wondering about the following situation.
> 
> package Foo export_oks "random_fn"
> package Bar export_oks "random_fn"
> 
> Script foo.pl has line "use Foo qw(random_fn); use Bar();"
> 
> Script bar.pl has line "use Bar qw(random_fn); use Foo ();"
> 
> It's been suggested to me that bar.pl might actually use &Foo::random_fn
> unless it fully qualifies calls to random_fn.

I've not seen this behavior myself..  Consider writing a simple set of
modules to test your hypothesis...

I would avoid using Exported symbols for your own modules if you can
help it.  Each exported symbol uses ~100-120 bytes of storage in each
module that uses it.  This can add up to a considerable amount of
memory..

-- 
Paul Lindner    lindner@inuus.com   ||||| | | | |  |  |  |   |   |

    mod_perl Developer's Cookbook   http://www.modperlcookbook.org
         Human Rights Declaration   http://www.unhchr.ch/udhr/index.htm

Re: Registry, Exporter and namespaces

Posted by ___cliff rayman___ <cl...@genwax.com>.
"Narins, Josh" wrote:

> I'm using Apache::Registry with Exporter.pm in a mod_perl, not trivially
> small, environment.
>
> I only use EXPORT_OK, no EXPORT.
>
> I'm wondering about the following situation.
>
> package Foo export_oks "random_fn"
> package Bar export_oks "random_fn"
>
> Script foo.pl has line "use Foo qw(random_fn); use Bar();"
>
> Script bar.pl has line "use Bar qw(random_fn); use Foo ();"
>
> It's been suggested to me that bar.pl might actually use &Foo::random_fn
> unless it fully qualifies calls to random_fn.
>

that would be a pretty major bug in perl wouldn't it?  using variables from a
package that did not export them, and where you explicitly did not IMPORT them
would be a major problem IMHO.

--
___cliff rayman___cliff@genwax.com___http://www.genwax.com/