On Wed, 11 Nov 2009, Stevan Little wrote:

I got the same thing recently.

I was passing a string as an argument to the 'first' delegation method and not a code ref (which is what first expects).

Not sure if that is your issue too, but thought I would throw in my 2 cents.

(if this is the correct issue perhaps a bug to List::Util is in order, segfaulting is not acceptable behavior when encountering bad input).

I think it's our own darn fault for purposely circumventing List::Util's use of prototypes:

  sub first : method {
      my ( $attr, $reader, $writer ) = @_;
      return sub {
          my ( $instance, $predicate ) = @_;
          &List::Util::first($predicate, @{ $reader->($instance) });
      };
  }

If we remove the leading '&' you'll get a prototype error from Perl
rather than a seg fault. Should List::Util have to test that the first
argument really, really, really is a coderef? It already asks for one
pretty unambiguously ;)


-dave

/*============================================================
http://VegGuide.org               http://blog.urth.org
Your guide to all that's veg      House Absolute(ly Pointless)
============================================================*/

Reply via email to