Despite being the author of both modules, I'm going to have to go with PodMaster and say that this is a sign of something else being seriously wrong.

Let me lead you through the details, finishing with my educated guess.

As you've noticed, Text::xSV just does a use of Carp. If you look in Carp, it does a delayed load of Carp::Heavy - use Carp any number of times and Carp::Heavy does not get loaded until after you call a function in Carp. (That is the entire idea of Carp::Heavy.) So scattering around another use or 10 of Carp should make no difference.

Now what you're describing could happen if someone assigns to @INC. Then when it finally goes to load Carp::Heavy it cannot find the directory. But you've made it clear that Carp::Heavy is to be found in /usr/lib/perl5/5.8.0, which is in the list of directories that is reported in your error message.

Now you can remove the symptom by setting error_handler in Text::xSV to be any function that you want (either by passing error_handler to new, or by calling the set_error_handler method). However from what you describe, Carp is still messed up, you're just seeing it in Text::xSV because that one is more likely to report an error than anything else. And we still haven't explained why Perl is not behaving as Perl is supposed to behave.

As for Perl's undocumented behaviour, to the best of my knowledge that kind of misbehaviour can only happen for two possible reasons, either deep bugs in Perl, or else you're loading a module written in C that has bugs. My experience suggests that it is far more likely due to a bad module. What can happen with C is that there is a dangling pointer just writing to random memory, literally anything can happen. Changing virtually anything moves stuff around in memory, causing the symptom to move somewhere else. Normally the bug appears somewhere that you won't notice. Sometimes it is visible.

Tracking these kinds of issues down is very hard. When at all possible I'd suggest just reducing the number of C libraries that you load as much as possible to reduce the risk. If there are libraries that you have to load which might be buggy, well I can do more than wish you good luck debugging. Dangling pointers are a notorious nightmare to resolve. :-(

Update: I'm not normally a C programmer, but here is a comparison of some of the tools that I've heard of for catching the kind of C-level bug which I suspect is responsible for your problem. Someone else hopefully has more detailed advice on how to track down the issue.


In reply to Re: Carp::Heavy and Text::xSV by tilly
in thread Carp::Heavy and Text::xSV by xorl

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.