Skip Menu |

This queue is for tickets about the List-Objects-WithUtils CPAN distribution.

Report information
The Basics
Id: 96788
Status: resolved
Priority: 0/
Queue: List-Objects-WithUtils

People
Owner: Nobody in particular
Requestors: perl [...] toby.ink
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: array->exists
I may have a go at implementing this myself later, but for now filing a ticket so I don't forget. It would be useful if arrays had an ->exists method like hashes do. my $arr = array(qw/ foo bar /, undef); $arr->exists(0); # true $arr->exists(1); # true $arr->exists(2); # true $arr->exists(3); # false because 3 > $#$arr I'm not sure what the ideal behaviour of $arr->exists(-1) would be.
I've pushed an 'array-exists' branch that adds exist() and defined() for array objects. Admittedly the nested ternary isn't pretty, but that seems pretty much in-keeping with the rest of Lowu... I think the negative integer behavior (see t/01_array/exists.t) should vaguely match what you might expect of perl, but it's also 4am and I'm drinking lemon shandy, so I'd appreciate a sanity check ;-)
On Sun Jun 29 04:15:53 2014, AVENJ wrote: Show quoted text
> I've pushed an 'array-exists' branch that adds exist() and defined()
Um. 'exists()', rather...
Merged to master (9a29cef)