[Catalyst] Chart::Graph::Gnuplot trouble.
Mojo Nichols
mnichols at mojosoft.org
Mon Mar 17 02:24:00 GMT 2008
I am unable to get this package to work in Catalyst, despite it working
outside of catalyst. I'm at a loss of where to go with it next.
My output:
mnichols at trillian:~/catalyst/test$ ./script/test_server.pl -r -f -k
[debug] Debug messages enabled
[debug] Statistics enabled
[debug] Loaded plugins:
.----------------------------------------------------------------------------.
| Catalyst::Plugin::ConfigLoader
0.14 |
| Catalyst::Plugin::Static::Simple
0.17 |
'----------------------------------------------------------------------------'
[debug] Loaded dispatcher "Catalyst::Dispatcher"
[debug] Loaded engine "Catalyst::Engine::HTTP::Restarter"
[debug] Found home "/home/mnichols/catalyst/test"
[debug] Loaded Config "/home/mnichols/catalyst/test/test.yml"
[debug] Loaded components:
.-----------------------------------------------------------------+----------.
| Class |
Type |
+-----------------------------------------------------------------+----------+
| test::Controller::Root |
instance |
'-----------------------------------------------------------------+----------'
[debug] Loaded Private actions:
.----------------------+--------------------------------------+--------------.
| Private | Class |
Method |
+----------------------+--------------------------------------+--------------+
| /default | test::Controller::Root |
default |
| /end | test::Controller::Root |
end |
| /plot | test::Controller::Root |
plot |
'----------------------+--------------------------------------+--------------'
[debug] Loaded Path actions:
.-------------------------------------+--------------------------------------.
| Path |
Private |
+-------------------------------------+--------------------------------------+
| /plot |
/plot |
'-------------------------------------+--------------------------------------'
[info] test powered by Catalyst 5.7012
You can connect to your server at http://trillian:3000
exit value = 16777215
signal number = 127
dumped core = 128
at /usr/local/share/perl/5.8.8/Chart/Graph/Gnuplot.pm line 768
[info] *** Request 1 (0.143/s) [13684] [Sun Mar 16 22:16:47 2008] ***
[debug] "GET" request for "plot" from "127.0.0.1"
[debug] Path is "plot"
[info] Request took 0.035527s (28.148/s)
.----------------------------------------------------------------+-----------.
| Action |
Time |
+----------------------------------------------------------------+-----------+
| /plot |
0.024378s |
| /end |
0.000708s |
'----------------------------------------------------------------+-----------'
The controller:
package test::Controller::Root;
use strict;
use warnings;
use Chart::Graph::Gnuplot (qw/gnuplot/);
use base 'Catalyst::Controller';
#
# Sets the actions in this controller to be registered with no prefix
# so they function identically to actions created in MyApp.pm
#
__PACKAGE__->config->{namespace} = '';
=head1 NAME
test::Controller::Root - Root Controller for test
=head1 DESCRIPTION
[enter your description here]
=head1 METHODS
=cut
=head2 default
=cut
sub plot : Local {
my ( $self, $c ) = @_;
gnuplot({'title' => 'foo',
'x2-axis label' => 'bar',
'logscale x2' => '1',
'logscale y' => '1',
'output type' => 'png',
'output file' =>'/tmp/try.png',
'xtics' => [ ['small\nfoo', 10], ['medium\nfoo', 20],
['large\nfoo', 30] ],
'ytics' => [10,20,30,40,50],
'extra_opts' => 'set key left top Left'},
[{'title' => 'data1',
'type' => 'matrix'}, [[1, 10],
[2, 20],
[3, 30]] ],
[{'title' => 'data2',
'style' => 'lines',
'type' => 'columns'},
[8, 26, 50, 60, 70],
[5, 28, 50, 60, 70] ]
);
$c->response->body("Test plot");
}
sub default : Private {
my ( $self, $c ) = @_;
# Hello World
$c->response->body( $c->welcome_message );
}
=head2 end
Attempt to render a view, if needed.
=cut
sub end : ActionClass('RenderView') {}
=head1 AUTHOR
Mojo Nichols,,,
=head1 LICENSE
This library is free software, you can redistribute it and/or modify
it under the same terms as Perl itself.
=cut
1;
An example perl script that demonstrats that the above function should work:
#!/usr/bin/perl
use strict;
use warnings;
use Chart::Graph::Gnuplot (qw/gnuplot/);
use base 'Catalyst::Controller';
gnuplot({'title' => 'foo',
'x2-axis label' => 'bar',
'logscale x2' => '1',
'logscale y' => '1',
'output type' => 'png',
'output file' =>'/tmp/try.png',
'xtics' => [ ['small\nfoo', 10], ['medium\nfoo', 20],
['large\nfoo',
30] ],
'ytics' => [10,20,30,40,50],
'extra_opts' => 'set key left top Left'},
[{'title' => 'data1',
'type' => 'matrix'}, [[1, 10],
[2, 20],
[3, 30]] ],
[{'title' => 'data2',
'style' => 'lines',
'type' => 'columns'},
[8, 26, 50, 60, 70],
[5, 28, 50, 60, 70] ]
);
More information about the Catalyst
mailing list