I just saw a question on comp.lang.perl.modules where the error
message:

    Bad arg length for Socket::unpack_sockaddr_in, [...]
    at C:/Perl/lib/Socket.pm line 295.

understandably confused a user who had simply passed an invalid
argument to C<sockaddr_in>.  This is exactly the situation that
C<Carp::croak> is meant to avoid so it is unfortunate in this
case that, in XS code, C<croak> acts like C<die> and not like
C<Carp::croak>.

Anyone recall past discussions on whether XS C<croak> should
be able to skip up the call stack until it finds a call
originating from a different package just like C<Carp::croak>? 
This would have to be optional, of course.

Normally I'd just advocate addition of a new XS subroutine
that provides the functionality of C<Carp::croak> but I'd
want to call this "croak" and that name is already taken. 

Perhaps we could add a C sub C<Carp_croak> that just calls
C<Carp::croak> if F<Carp.pm> has already been C<require>d and
falls back on calling the current C<croak> [a.k.a. "die"]
otherwise?
-- 
Tye McQueen    Nothing is obvious unless you are overlooking something
         http://www.metronet.com/~tye/ (scripts, links, nothing fancy)

Reply via email to