tag:blogger.com,1999:blog-3035323255246508397.post8435404160737522649..comments2023-06-10T09:01:43.125-07:00Comments on Perl Indonesia: So is wantarray() bad or not?Perl Indonesiahttp://www.blogger.com/profile/09083793321887864209noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-3035323255246508397.post-74876446815130667672010-05-07T00:38:45.138-07:002010-05-07T00:38:45.138-07:00@john: Thanks for the comment. I agree, we really ...@john: Thanks for the comment. I agree, we really need to think several times before using wantarray(). That said, I am still somewhat leaning towards it.<br /><br />I have two use cases: first, API function calling another API function. Second, application code calling API function.<br /><br />API function code are generally more well thought out, more carefully designed, coded, and tested. They will almost always use the array form:<br /><br />($status, $errmsg, $result) = API::func($args);<br /><br />While application code might or might not do this. They might just say:<br /><br />$result = API::func($args);<br /><br />I think it's a great idea to help (or punish?) the last case, i.e. automatically dying with $status and $errmsg whenever $status is not a successful code.<br /><br />This can be done with or without wantarray() though.Steven Haryantohttps://www.blogger.com/profile/04922802400068672153noreply@blogger.comtag:blogger.com,1999:blog-3035323255246508397.post-72503337675030600282010-05-06T06:36:52.117-07:002010-05-06T06:36:52.117-07:00Personally this this kind of thing is going to cau...Personally this this kind of thing is going to cause you headaches. DBIx::Class overloaded ->resultset via wantarray to either return an object or an array and its one of the choices most regretted. <br /><br />wantarray I think is something like goto, if you need it you really need it, but I don't make using it a habitAnonymousnoreply@blogger.com