On Thu, Feb 14, 2008 at 6:14 PM, Sam Tregar <[EMAIL PROTECTED]> wrote: > Hey all. I'm working on adjusting to Rose from a long history with CDBI, so > I do this kind of thing a lot: > > $foos = My::Foo::Manager->get_foos(bar => "big"); > > When I really mean: > > $foos = My::Foo::Manager->get_foos(query => [bar => "big"]); > > This is a nasty bug since the first incorrect call doesn't croak() - it just > returns all the My::Foos! Sometimes I don't notice right away that I'm > getting the wrong objects since my test set is small. Shouldn't it croak()?
Perl 5 doesn't have any language features for validating named parameters, and doing so "manually" at runtime is (relatively) expensive. This is especially true for Manager methods which take a ton of parameters (and still growing). As for your particular example, keep in mind that these are also equivalent: $foos = My::Foo::Manager->get_foos([ bar => "big" ]); $foos = My::Foo::Manager->get_foos({ bar => "big" }); (The first is preferred since the second is coerced into the first internally.) You may find it easier to transition to these forms. Finally, if you're really concerned, keep in mind that you can always make your own Manager subclass that does check args, then have all your real Manager classes inherit from it instead of inheriting form Rose::DB::Object::Manager directly. -John ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Rose-db-object mailing list Rose-db-object@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rose-db-object