perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug MacEachern <do...@covalent.net>
Subject Re: ModPerl::Registry root
Date Wed, 29 May 2002 00:21:04 GMT
in more detail.. here are the issues i see with the current
implementation of script cache and symbol table entries:

1) cache location is not flexible.  forces creation of a
global variable with the same name as the subclass:

 no strict 'refs';
 ${ $o->[CLASS] }->{ $o->[PACKAGE] }->...
 #for example creates a global '$ModPerl::Registry' hash reference

default should be like 1.x, where cache is under 1 "root" rather
than caches scattered around the symbol table.

each subclass still has its own package namespace in the Perl symbol
table.  but this the list of all packages can be accessed from 1 "root".

to make this flexible, RegistryCooker should have a cache_table
method, for example:

#the default
sub cache_table {
    \%ModPerl::Registry; #or whatever name
}

if a subclass wants to keep the cache in its own package, it can do:

#example based on what the current RegistryCooker forces
sub cache_table {
    my $self = shift;
    my $class = ref $self;
    no strict 'refs';
    \%$class;
}

2) symbol table location is not flexible.  forced into %$SubClassName::Cache.

default should be like 1.x, where scripts are compiled under 1 "root"
namespace.

Apache::ROOT::
 vs.
{{ModPerl,MyClass,YourClass}::{Registry,RegistryBB,Foo,Bar}}::Cache

not sure if that matters as much.  but i don't see what is gained by
spreading these out underneath the subclasses.  would still prefer one
top-level hardcoded root with everything under it.  kinda like how
Perl has one top-level hardcoded root (%main::)

something like

#the default
sub namespace_root {
    'Apache::ROOT'; #or whatever default root name
}

if a subclass wants its own root namespace:

#example based on what the current RegistryCooker forces
sub namespace_root {
    my $self = shift;
    join '::', ref($self), 'Cache';
}

3) no strict 'refs'; should not be used all over the place.

should be cured after implementing the above.





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


Mime
View raw message