| Catalyst-View-GraphViz documentation | Contained in the Catalyst-View-GraphViz distribution. |
Catalyst::Helper::View::GraphView - Helper for GraphView Views
script/create.pl view GraphView GraphView
Helper for GraphView Views.
Catalyst::Manual, Catalyst::Test, Catalyst::Request, Catalyst::Response, Catalyst::Helper
Johan Lindstrom, johanl@cpan.org
This library is free software . You can redistribute it and/or modify it under the same terms as perl itself.
[% class %] - Catalyst GraphView View
See [% app %]
Catalyst GraphView View.
Render the object specified in
$c->stash->{graphview}->{object} and store the output
in $c->response->output.
[% author %]
This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself.
| Catalyst-View-GraphViz documentation | Contained in the Catalyst-View-GraphViz distribution. |
package Catalyst::Helper::View::GraphView; use strict;
sub mk_compclass { my ( $self, $helper ) = @_; my $file = $helper->{file}; $helper->render_file( 'compclass', $file ); }
1; __DATA__ __compclass__ package [% class %]; use strict; use base 'Catalyst::View';
sub process { my ($self, $c) = @_; #This is an example. Adjust to your needs. #1. This is your model object containing the abstract graph you are about # to render into a GraphViz object. my $graph = $c->stash->{graphview}->{object} or die('No object specified in $c->stash->{graphview}->{object} for rendering'); #2. Render the model object. This is your View code where you adapt the # look of the graph (node shape, color, etc.) my $graphViz = GraphViz->new(node => { fontname => "Verdana", fontsize => 7, name => "graph", }); $graphViz->add_node("something from $graph", shape => "triangle", color => "black"); #3. Forward to the GraphViz View $c->stash->{graphviz}->{graph} = $graphViz; $c->forward('[% app %]::V::GraphViz'); if($c->res->content_type eq "text/plain") { #imap #4. You may want to post-process imagemap output # Transform it here using something more interesting # than lc(). Useful e.g. for adding javascript events. $c->response->body( lc( $c->response->body ) ); } return 1; }
1;