Re: relationship namespace
[prev]
[thread]
[next]
[Date index for 2004/12/20]
On Mon, Dec 20, 2004 at 10:10:43PM +0000, William Ross wrote:
> Found it. I'm not exactly sure it's a bug, as it only comes up if you
> declare relationships (or anything else that touches on class data) at
> more than one level in the inheritance tree, and there's nothing to say
> you're allowed to do that. You might just want to prohibit it :)
Sounds like it should be allowable, unless I'm missing something ...
> --- /Users/will/Desktop/DBI.pm.orig Mon Dec 20 21:43:08 2004
> +++ /Library/Perl/5.8.5/Class/DBI.pm Mon Dec 20 21:43:25 2004
> @@ -1022,7 +1022,9 @@
> sub _extend_meta {
> my ($class, $type, $subtype, $val) = @_;
> my %hash = %{ $class->__meta_info || {} };
> - $hash{$type}->{$subtype} = $val;
> + my %subhash = %{ $hash{$type} || {} };
> + $subhash{$subtype} = $val;
> + $hash{$type} = \%subhash;
> $class->__meta_info(\%hash);
> }
Probably easier just to use Storable's dclone. Then we don't need to
worry about what happens even further down ...
> Let me know if you think this needs a test.
It would certainly be useful.
Thanks for investigating this.
Tony