[Dbix-class] ->search oddity with superfluous parameters
Matt S Trout
dbix-class at trout.me.uk
Thu May 29 11:32:57 BST 2008
On Thu, May 15, 2008 at 09:54:45PM +0100, Aaron Crane wrote:
> This works:
>
> my $rs = $schema->resultset('CD')->search(
> { artist => 1 },
> { order_by => 'id' },
> );
>
> Oddly, so does this:
>
> my $rs = $schema->resultset('CD')->search(
> { artist => 1 },
> undef,
> { order_by => 'id' },
> );
>
> I'm finding it hard to imagine that's deliberate. Attached is a
> patch (against 0.08/trunk) which (a) tests that this code throws an
> exception, and (b) throws such an exception. All other tests seem to
> pass.
Makes perfect sense. Come find us on irc.perl.org #dbix-class and I'll give
you a commit bit.
> I've also attached a second patch which refactors some surrounding
> code in a way that I find much easier to understand. It should apply
> to 0.08/trunk either before or after the behaviour-changing patch.
The unless/if bit looks fine.
The horrific replacement ?: stanza is not coming anywhere near the codebase.
(1) You';ve removed the bracketing, which is unsafe and harder to read
(2) You've done stupid aligning tricks, which will mean any future changes
will either (a) unalign it (b) pollute the diff with whitespace shit
--
Matt S Trout Need help with your Catalyst or DBIx::Class project?
Technical Director http://www.shadowcat.co.uk/catalyst/
Shadowcat Systems Ltd. Want a managed development or deployment platform?
http://chainsawblues.vox.com/ http://www.shadowcat.co.uk/servers/
More information about the DBIx-Class
mailing list