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 DuncanThread Previous | Thread Next