Need help with Chart::OFC

This is Debian, with the usual suspects:
Apache/2.2.6 (Unix) mod_fastcgi/2.4.6 mod_perl/2.0.3 Perl/v5.8.8.

I've installed Flash and successfully tested the demo my.cgi which
comes with Open Flash Chart.

However, when I replace the data generating code in my.cgi
(renamed ofc.1.cgi) with calls to Chart::OFC::* (from the latter's
t/Grid.t and t/Pie.t) I get a HTTP error:
[Sat Jan 05 13:52:40 2008] [error] [client 127.0.0.1] malformed header
from script. Bad header=&pie=80,#000000,#000000&: ofc.1.cgi.

Code:
=====><8=====
#!/usr/bin/perl

use strict;
use warnings;

use CGI qw/:standard/;
use Chart::OFC::Dataset;
use Chart::OFC::Dataset::Bar;
use Chart::OFC::Grid;
use Chart::OFC::Pie;
use Chart::OFC::XAxis;
use Chart::OFC::YAxis;

# ---------------------------

sub swf_object {
my $width = shift;
my $height = shift;
my $url = shift;

print '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
codebase="http://fpdownload.macromedia.com/pub/shockwave/cab s/flash/
swflash.cab#version=8,0,0,0" width="400" height="300" id="graph-2"
align="middle">';
print '<param name="allowScriptAccess" value="sameDomain" />';
print "<param name=\"movie\" value=\"/open-flash-chart.swf?width=
$width&height=$height&data=$url /><param name=\"quality\" value=\"high
\" /><param name=\"bgcolor\" value=\"#FFFFFF\" />";
print '<embed src="/open-flash-chart.swf?width='.
$width .'&height='. $height .'&data='. $url .'" quality="high"
bgcolor="#FFFFFF" width="'. $width .'" height="'. $height .'"
name="open-flash-chart" align="middle" allowScriptAccess="sameDomain"
type="application/x-shockwave-flash" pluginspage="http://
www.macromedia.com/go/getflashplayer" />';
print '</object>';

}

# ---------------------------

if( !param() ) {

print header, start_html( -title => "Open Flash Demo" );
swf_object( 600, 250, 'http://127.0.0.1/cgi-bin/ofc.1.cgi?data' );
print "</body></html>\n";

} else {

=pod

my [at] datasets = Chart::OFC::Dataset::Bar->new( values => [ 1 .. 5] );
my $x_axis = Chart::OFC::XAxis->new( axis_label => 'X Axis' );
my $y_axis = Chart::OFC::YAxis->new( axis_label => 'Y Axis', max =>
100, label_steps => 20 );

my $chart = Chart::OFC::Grid->new( title => 'Grid Test',
inner_bg_color => '#FFFF00',
inner_bg_color2 => '#FFFFFF',
inner_bg_fade_angle => 152,
datasets => \ [at] datasets,
x_axis => $x_axis,
y_axis => $y_axis,
);

print $chart->as_ofc_data();

=cut

my $set = Chart::OFC::Dataset->new( values => [ 1..10 ] );
my $pie = Chart::OFC::Pie->new( title => 'Pie Test', dataset => $set,
labels => [ 'a'..'j' ] );

print $pie->as_ofc_data();

}
=====><8=====

Lastly, if I comment out all Chart::OFC code in this program, and plug
back in the original code from my.cgi, the code works.

Any ideas?
TIA.

--
Ron Savage
http://savage.net.au/index.html
ron [ Sa, 05 Januar 2008 04:04 ] [ ID #1900617 ]

Re: Need help with Chart::OFC

On Jan 5, 2:04 pm, r... [at] savage.net.au wrote:

Hi Ron

> Any ideas?

Yep.

Chart::OFC ships with OFC V 1.9.5, but I installed V 1.9.6.

Unfortunately the author of OFC changed the method of concatenating
data strings, for whatever reason.

I had to edit Chart::OFC.pm line 52 to be:

return $CRLF . join '', map { "$_ \n" } [at] lines;

Now, Chart::OFC works!

Many thanx to both authors.

OFC's home is: http://teethgrinder.co.uk/open-flash-chart/

--
Ron Savage

http://savage.net.au/index.html
ron [ So, 06 Januar 2008 02:09 ] [ ID #1901202 ]
Perl » comp.lang.perl.modules » Need help with Chart::OFC

Vorheriges Thema: How to Add dynamic array/hashes to Curses::UI:Listbox -lables
Nächstes Thema: Announce: DBD::Unify 0.70