Subject: | Schemas with the same beginning, catalyst will return the wrong dbix class |
When we have two dbix classes which the name of one is the beginning of
another, Catalyst may return the wrong dbix class. For instance, we have
the schema Hostname and HostnameService, if we look up the Hostname schema:
my $result = $c->model ("Hostname")->search ({});
it returns a HostnameService result, in our case we changed the
Catalyst.pm module to fix the problem, adding an exactly:
--- Catalyst.pm.orig 2009-01-29 17:48:18.000000000 -0200
+++ Catalyst.pm 2009-01-29 17:47:18.000000000 -0200
@@ -421,7 +421,7 @@
foreach my $name (@names) {
foreach my $component ( keys %{ $c->components } ) {
- return $c->components->{$component} if $component =~ /$name/i;
+ return $c->components->{$component} if $component =~
/::$name$/i;
}
}
I don't know if it's the best solution, or if it fits everyone