[Dbix-class] Bug in has_one - can somebody do a patch/test please?
Matt S Trout
dbix-class at trout.me.uk
Tue Dec 20 04:01:33 CET 2005
islue wandered onto IRC tonight and politely pointed out that has_one is
utterly and completely broken. It does
shift->_has_one(undef => @_);
which due to the heavy-duty quoting of =>, becomes 'undef'.
shift->_has_one(undef() => @_);
should work; I'd be happy to apply that but it appears we don't actually
test has_one currently (*autoLART*) so is there any chance somebody could
put together a patch including the fix and a test so I don't accidentally
break it again later?
02:20 <@mst> hmm. did 'undef' not exist in early perl5s?
02:22 <@merlyn> undef has existed since perl3
02:24 <@mst> merlyn: then this is odd. code reading shift->_has_one(undef =>
@_) is ending up with 'UNDEF' further in, not a real undef
02:24 <@merlyn> earlier perls quoted even function names as barewords for =>
02:25 <@merlyn> oh wait, no, that's proper behavior
02:25 <@merlyn> print => 3 is ("print", 3)
02:25 <@merlyn> undef => 5 is ("undef", 5)
02:25 <@merlyn> you want to not use => if you don't want that quoted
02:25 <@merlyn> (undef, @_) for example
02:25 <@mst> whoa
02:25 <@merlyn> => is a very strong quoter
02:25 <@merlyn> and that's deliberate
02:26 <@merlyn> so I can always safely write BAREWORD => $this
02:26 <@merlyn> and have it work
02:26 <@mst> yes, now you point it out to me it makes perfect sense
02:26 <@merlyn> even if BAREWORD later gets defined
02:27 <@mst> it's ok, I now know what the underlying problem is
02:27 <@mst> the underlying problem is that whoever added this code never
actually wrote tests for it
02:28 <@mst> which would be less annoying but for the fact I suspect that was
me :)
--
Matt S Trout Offering custom development, consultancy and support
Technical Director contracts for Catalyst, DBIx::Class and BAST. Contact
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 Dbix-class
mailing list