Piero -

Upon first seeing your error message, it looks as though PDL is using die()
instead of carp(). However, it's more complicated than that. What happens
is that an exception gets thrown at the C level, and that always behaves
like a die, but it indicates the most recent line of Perl code. (The fact
that it actually tells you to look at Basic/Core/Core.pm.PL, which is
helpful for the devs, is something I changed a few years ago.)

The proper solution here is to go through the PDL core and identify any
Perl code that makes a call to XS code that could croak. We then need to
wrap those calls in eval blocks, and issue relevant exceptions from the
Perl code.

If we go that far, then I think we could benefit a lot by using structured
exceptions. CHM, are structured exceptions on our list? Can that be rolled
into the warnings cleanup?

David


On Fri, Dec 6, 2013 at 10:29 AM, Piero Ranalli <[email protected]>wrote:

> Hi
>
> reading the following line from Ingo:
>
> > Far less important but still, the barf on multielement piddles!
>
> I remembered another thing that maybe could be improved.  When there's
> an error message, it points to within the PDL source code, as in the
> following one-liner:
>
> piero$ perl -MPDL -E '$q=sequence 10; say $q->at(11);'
> Position out of range at Basic/Core/Core.pm.PL (i.e. PDL::Core.pm) line
> 3300.
>
> I'd really like the message to point at my code, instead of PDL's.
> Would it be difficult for PDL to use Carp (or any similar approach)?
>
>
> regards,
> Piero
>
> _______________________________________________
> Perldl mailing list
> [email protected]
> http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
>



-- 
 "Debugging is twice as hard as writing the code in the first place.
  Therefore, if you write the code as cleverly as possible, you are,
  by definition, not smart enough to debug it." -- Brian Kernighan
_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

Reply via email to