Skip Menu |

This queue is for tickets about the Jifty-Plugin-Chart CPAN distribution.

Report information
The Basics
Id: 75591
Status: resolved
Priority: 0/
Queue: Jifty-Plugin-Chart

People
Owner: Nobody in particular
Requestors: fschlich [...] zedat.fu-berlin.de
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 1.01
Fixed in: (no value)



Subject: t/TestApp-Plugin-Chart/t/chart.t: Couldn't read 11 bytes (Chart 2.4.4 breaks Jifty::Plugin::Chart::Renderer::Char)
Hi, I'm forwarding http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=660379 along with some debugging results. t/TestApp-Plugin-Chart/t/chart.t fails with the following error messages: # Couldn't read 11 bytes: # Failed test 'it is a png file' # at t/TestApp-Plugin-Chart/t/chart.t line 54. # got: undef # expected: 'png' # Failed test 'it is 400 pixels wide' # at t/TestApp-Plugin-Chart/t/chart.t line 55. # got: undef # expected: '400' # Failed test 'it is 500 pixels tall' # at t/TestApp-Plugin-Chart/t/chart.t line 56. # got: undef # expected: '500' # Looks like you failed 3 tests of 9. t/TestApp-Plugin-Chart/t/chart.t ..... Dubious, test returned 3 (wstat 768, 0x300) Failed 3/9 subtests As it turns out, instead of a PNG file, the value "1" is returned. This is due to the following lines in lib/Jifty/Plugin/Chart/View.pm: # Render the chart and output the PNG file generated eval { my $chart = $args->{class}->new( $args->{width}, $args->{height} ); $chart->set(%{ $args->{options} }) if $args->{options}; # XXX scalar_png() is undocumented!!! Might bad to rely upon. outs_raw($chart->scalar_png($args->{data})); }; ...and yes it was perhaps bad to rely upon, as in version 2.4.4 of 10 Jan 2012, Chart grew a "return 1" at the end of scalar_png(). This arguably makes the entire scalar_png method pointless, but since it's undocumented, I'll leave it to you to decide whether to switch to the documented API, convince the Chart maintainers to remove the return statement and make scalar_png() part of the documented API, or use this even-uglier-will-break-any-minute patch: --- a/lib/Jifty/Plugin/Chart/View.pm +++ b/lib/Jifty/Plugin/Chart/View.pm @@ -30,7 +30,9 @@ my $chart = $args->{class}->new( $args->{width}, $args-> {height} ); $chart->set(%{ $args->{options} }) if $args->{options}; # XXX scalar_png() is undocumented!!! Might bad to rely upon. - outs_raw($chart->scalar_png($args->{data})); + $chart->scalar_png($args->{data}); + # XXX fiddling with internals is even worse!!! + outs_raw($chart->{'gd_obj'}->png()); }; # Should have thrown an error if bad stuff happened, handle that Florian
From: fschlich [...] zedat.fu-berlin.de
In Debian, we're going to patch Chart, see https://rt.cpan.org/Public/Bug/Display.html?id=75887 for a patch
Thanks for the heads up. It looks like Chart 2.4.5 was released with the Debian fix.