Hi,
without being able to use feature 'signatures', how do I verify
that parameters passed to a function have been passed to it by
the caller?
A test for undef is not sufficient because the value passed to a
function may be undef itself, and I need to be able to distinguish
between the paramete
This is how I'd go about it:
https://gist.github.com/andrewsolomon/323a2b317ea5903f662fbaaded254798
"exists" is true if there's a key in a hash even if the key's value is
undef.
Does that provide a solution for you, or are there other constraints?
On Sun, Nov 19, 2017 at 4:57 PM, hw wrote:
>
On 19/11/17 15:40, Gil Magno wrote:
> $num_of_params = scalar @_;
Complementing... In order to get the number of params, you could do
$num_of_params = @_;
without using "scalar @_", because this assignment is already in scalar
context.
But if you're in list context, you have to use "scalar"
On 19/11/17 13:57, hw wrote:
> without being able to use feature 'signatures', how do I verify
> that parameters passed to a function have been passed to it by
> the caller?
If you're dealing with positional parameters[1] (and not with named
ones) you can check for the size of @_ inside your funct
What no one has said so far is the importance of using Carp when throwing
errors related to how the function was called. The Carp module provides
versions of warn (carp) and die (croak) that give the line and file where
the call to the function occurred rather than the line of the carp or croak:
Andrew Solomon wrote:
This is how I'd go about it:
https://gist.github.com/andrewsolomon/323a2b317ea5903f662fbaaded254798
"exists" is true if there's a key in a hash even if the key's value is undef.
Does that provide a solution for you, or are there other constraints?
That would require to
Gil Magno wrote:
On 19/11/17 13:57, hw wrote:
without being able to use feature 'signatures', how do I verify
that parameters passed to a function have been passed to it by
the caller?
If you're dealing with positional parameters[1] (and not with named
ones) you can check for the size of @_ in
Chas. Owens wrote:
What no one has said so far is the importance of using Carp when throwing
errors related to how the function was called. The Carp module provides
versions of warn (carp) and die (croak) that give the line and file where the
call to the function occurred rather than the line
On 19/11/17 13:57, hw wrote:
> without being able to use feature 'signatures', how do I verify
> that parameters passed to a function have been passed to it by
> the caller?
https://metacpan.org/pod/signatures
https://metacpan.org/pod/signatures#SEE-ALSO
https://metacpan.org/pod/Sub::Signatures
Gil Magno writes:
> On 19/11/17 13:57, hw wrote:
>> without being able to use feature 'signatures', how do I verify
>> that parameters passed to a function have been passed to it by
>> the caller?
>
> https://metacpan.org/pod/signatures
> https://metacpan.org/pod/signatures#SEE-ALSO
>
> https://m
hw writes:
> Gil Magno writes:
>
>> On 19/11/17 13:57, hw wrote:
>>> without being able to use feature 'signatures', how do I verify
>>> that parameters passed to a function have been passed to it by
>>> the caller?
>>
>> https://metacpan.org/pod/signatures
>> https://metacpan.org/pod/signatures
Why can't you use 'signatures' feature at the first place?
Usually, it means that you tight yourself to system perl, which is not a
good decision at all.
Don't trust me on this, trust brian d foy
https://www.effectiveperlprogramming.com/2015/11/apple-recommends-installing-your-own-perl/
Ins
Илья Рассадин writes:
> Why can't you use 'signatures' feature at the first place?
The perl version I am required to use does not support it.
> Usually, it means that you tight yourself to system perl, which is not
> a good decision at all.
>
> Don't trust me on this, trust brian d foy
> https:
13 matches
Mail list logo