Skip Menu |

This queue is for tickets about the Catalyst-Runtime CPAN distribution.

Report information
The Basics
Id: 42905
Status: resolved
Priority: 0/
Queue: Catalyst-Runtime

People
Owner: Nobody in particular
Requestors: wfelipe [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 5.7015
Fixed in: 5.71000



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
Subject: Re: [rt.cpan.org #42905] Schemas with the same beginning, catalyst will return the wrong dbix class
Date: Thu, 29 Jan 2009 15:39:01 -0600
To: bug-Catalyst-Runtime [...] rt.cpan.org
From: Jonathan Rockway <jon [...] jrock.us>
I don't think we can change this. The regexp fallback has been around for a long time, and some apps depend on it. You need to ask for your model with its full class name, then the regexp fallback is not triggered. * On Thu, Jan 29 2009, Wilson Felipe via RT wrote: Show quoted text
> 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
-- print just => another => perl => hacker => if $,=$"
Subject: Re: [rt.cpan.org #42905] Schemas with the same beginning, catalyst will return the wrong dbix class
Date: Thu, 29 Jan 2009 22:49:08 +0100
To: Jonathan Rockway via RT <bug-Catalyst-Runtime [...] rt.cpan.org>
From: Florian Ragwitz <rafl [...] debian.org>
On Thu, Jan 29, 2009 at 04:39:20PM -0500, Jonathan Rockway via RT wrote: Show quoted text
> I don't think we can change this. The regexp fallback has been around > for a long time, and some apps depend on it.
The regexp fallback is going to go away (although not soon). Recent versions of Catalyst-Runtime already warn about using it. -- BOFH excuse #392: It's union rules. There's nothing we can do about it. Sorry.
Download signature.asc
application/pgp-signature 189b

Message body not shown because it is not plain text.