From: | Aaron Mackey <AMACKEY [...] cpan.org> |
To: | bug-Tangram [...] rt.cpan.org |
Subject: | BackRef normalisation bug |
Date: | Thu, 5 Jun 2003 01:14:16 +1200 |
CC: | Aaron J Mackey <ajm6q [...] virginia.edu> |
[logged on behalf]
I have class names like My::Project::DataType and
My::Project::CollectionType ... in order for my database to take
these names, I have a normalize sub that strips them to DataType and
CollectionType; which is fine, until I go to use a Tangram::BackRef
to access a CollectionType from a DataType - Tangram says "No such
class 'CollectionType'", which is true: the class is
"My::Project::CollectionType".
I've tracked it down to lines 139-141 of Tangram/Schema.pm:
$class = $self->{normalize}->($class, 'fieldname');
my @members = $types->{$typetag}->reschema($memdefs, $class, $self)
if $memdefs;
The "backref" handling is done within reschema, in which $class is
now "CollectionType" instead of "My::Project::CollectionType".
Later, in line 160, we do need the normalized table name.
One fix would be to pass reschema an additional variable, the
unmolested class name, to be used in backrefs ... I'm happy to
provide that patch for those interested.
[editor - patch bled out of user; see attached]
Message body is not shown because sender requested not to inline it.