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

Wade.Stuart at fallon.com Wade.Stuart at fallon.com
Wed Mar 29 20:18:52 CEST 2006





and here was the end solution proposed.



catalyst-bounces at lists.rawmode.org wrote on 08/28/2005 02:32:53 PM:

>
> Am 28.08.2005 um 21:34 schrieb Matt S Trout:
>
> > 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?
>
> Yes, thats a very clean solution, i like it.
>
> --
> sebastian
>
>
> _______________________________________________
> Catalyst mailing list
> Catalyst at lists.rawmode.org
> http://lists.rawmode.org/mailman/listinfo/catalyst




More information about the Catalyst mailing list