[Koha-bugs] [Bug 7757] Edit basket vendor after it has been created
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Thu May 24 14:28:19 CEST 2012
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7757
--- Comment #14 from Kyle M Hall <kyle.m.hall at gmail.com> ---
I just re-read your comment. Do you think it's really necessary to pass
required params directly? I really like the passing a single hash as the param
list like so:
mysub(
param1 => $param1,
param2 => $param2,
param3 => $param3,
);
mysub {
my %params = @_;
my $param1 = $params{'param1'};
my $param2 = $params{'param2'};
my $param3 = $params{'param3'};
return unless ( $param1 && $param2 )
## Do Stuff
}
(In reply to comment #13)
> > About parameters: I think we should define a rule for new subs, about how we
> > pass parameters. I think passing hashes would gracefully solve this kind of
> > problem. So what about a rule like = identifier/mandatory fields are passed
> > directly, others are passed through a hash
> > The ModBasketHeader would then become:
> > ModBasketHeader($basketno,
> > { basketname => $basketname,
> > basketnote => $basketnote,
> > basketbooksellernote => $basketbooksellernote,
> > basketcontractnumber => basketcontractnumber,
> > basketbooksellerid=> $basketbooksellerid}
> > );
> >
> > Kyle, if you agree/like this idea, I can start a discussion on koha-devel !
>
> Paul, I am 110% behind this idea. I've been using hashes for parameter
> passing in most of my new code. I think it makes it much easier to extend
> subroutines after the fact. Right new we have subs that look like sub(
> $param1, $parm2, undef, $param3, 1, $param4 ) and this would make our code
> far better.
--
You are receiving this mail because:
You are watching all bug changes.
More information about the Koha-bugs
mailing list