1use Test::More; 2use strict; use warnings FATAL => 'all'; 3 4use List::Objects::WithUtils 'array'; 5 6my $arr = array(qw/ a ba bb c /); 7 8my $first = $arr->first_where(sub { /^b/ }); 9 10ok $first eq 'ba', 'first_where ok'; 11 12ok $arr->first(sub { /^b/ }) eq $first, 13 'backwards compat ok'; 14 15 16ok !defined array->first_where(sub { 1 }), 17 'first_where on empty array returns undef'; 18 19done_testing; 20