in reply to Debugging DBD::Chart
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Debugging DBD::Chart
by fuzzyping (Chaplain) on Feb 21, 2004 at 04:15 UTC | |
by tilly (Archbishop) on Feb 21, 2004 at 17:00 UTC |