develooper Front page | perl.perl5.porters | Postings from January 2022

Re: Things you can't do in a signatured sub

Thread Previous | Thread Next
Darren Duncan
January 31, 2022 22:00
Re: Things you can't do in a signatured sub
Message ID:
On 2022-01-31 1:08 p.m., Dave Mitchell wrote:
> Again, with query parameters this is simple:
>       sub name ($self, ??$has_value, $value = undef) {
>           if ($has_value) {
>               $self->{name} = $value; # even if undef
>           }
>           else {
>               return $self->{name};
>           }
>       }
> $has_value is a boolean value which is true if there are any args
> remaining at that point in parameter processing.

Thanks for the explanation.

I kept hearing references to "query parameters" and they didn't really make 
sense to me before in this context.

The only other place I hear "query parameters" is in reference to calling SQL 
DBMSs from a program, and "query parameters" mean the same thing as plain old 
"parameters", for example when one writes something like:

    SELECT foo FROM bar WHERE baz = :quux

... and after you prepare that, each execution binds "quux" to an argument, 
because it is a "query parameter".

-- Darren Duncan

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About