[Catalyst] Problem with Catalyst::Engine::component()

Matt S Trout dbix-class at trout.me.uk
Sun Aug 28 21:34:08 CEST 2005


On Sun, Aug 28, 2005 at 08:19:00PM +0200, Marcus Ramberg wrote:
> On 8/28/05, Bernhard Graf <catalyst at augensalat.de> wrote:
> > 
> > Marcus Ramberg wrote:
> > 
> > > > Well, you could have used $c->component('^MyApp::M::Shop$'), but i
> > > > agree, regex search is wrong, anyone got objections against
> > > > removing it? It was originally meant to save me some typing, but it
> > > > seems there are too many people who can't handle it.
> > > I object! ;) I've just used this feature in
> > > Catalyst::Plugin::DefaultEnd, to find the first available View
> > > component.
> > Aren't you serious about this or why is the smiley?
> > Did you release this mod already or is there a chance for modification?
> 
> I'm quite serious, DefaultEnd is in the Catalyst trunk, and I intend to 
> release it before I leave to Braga on tuesday. If someone has a suggestion 
> for how I could solve this better, I'm all ears. Can't we make regex mode 
> more explicit in a further release, for example only support regexes in list 
> context?

How about ->comp(qr/.../); does a regex search, anything else does simple
string matching? Worst case scenario, grep { /.../ } $c->comp() will still
do the trick anyway ...
 
> > Besides Catalyst::Engine::component() needs two fixes: Add defined() to
> > the first if stmt to cope with objects that might evaluate to false in
> > boolean context like Class::DBI based objects might do and of course
> > return nothing if nothing matches.
> 
> 
> I'm not arguing that case, I'm just saying it's bad to break backwards 
> compability, and especially without providing a workaround. :p

How about using regex search automatically if it falls off the end of the

$foo
MyApp::$foo
MyApp::[MVC]::$foo

search chain I proposed, and have ->comp(qr/.../) be an explicit regex search?

-- 
     Matt S Trout       Specialists in perl consulting, web development, and
  Technical Director    UNIX/Linux systems architecture and automation. Mail
Shadowcat Systems Ltd.  mst (at) shadowcatsystems.co.uk for more information

 + Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +



More information about the Catalyst mailing list