Look at your installation of DBD::Chart::Plot, and skip to line 3626. That may give you some idea what is happening.

A random guess might be that it is trying to figure out some parameter from an environment variable, and a different environment running from cron causes the division by 0 error. That would explain why you get a different result when running from cron. You can control for that by using RE (tilly) 3: Get default login environment to be sure that you get the same environment running from cron and by hand.

Another idea might be to create an edited version of DBD::Chart that inserts a Carp::cluck right before the warning. Examine the messages emitted. The stack backtrace on the last one before you die tells you which call to print_graph gave a division by 0, which is at least somewhere to start.

FWIW it looks like the warning caused by DBD::Graph is a red herring for your problem (though it should be reported to the author).

UPDATE: Random style tips.

I should point out that there is research indicating that a consistent indent in the 2-4 character range improves comprehension over larger indent.

Also you used a C-style for-loop (for (my $i=0; $i<$max_wedges; $i++) { ... }). The most common coding error in C is an off-by-one error, and if you use them liberally in Perl, you will also have off-by-one errors. Being in the habit of using ranges will avoid those. Though admittedly in this case. for my $i (0..($max_wedges - 1)) { ... } involves more thought about the boundary condition than the C-style loop did.

UPDATE 2: Cunningly hide the fact that I misread the error message by fixing which module I said to examine. Stupidly ruin the effect by confessing to everything.


In reply to Re: Debugging DBD::Chart by tilly
in thread Debugging DBD::Chart by fuzzyping

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.