1 package TreeOfTexts::Controller::Stemmagraph;
3 use namespace::autoclean;
4 use Text::Tradition::Collation;
5 use Text::Tradition::Stemma;
7 BEGIN { extends 'Catalyst::Controller' }
10 # Sets the actions in this controller to be registered with no prefix
11 # so they function identically to actions created in MyApp.pm
13 __PACKAGE__->config(namespace => '');
17 TreeOfTexts::Controller::Root - Root Controller for TreeOfTexts
21 [enter your description here]
25 sub get_graph :Local {
27 # If called interactively, we have params 'display', 'output', 'witnesses'
28 # If called non-interactively, we look at headers and content.
29 # The body is actually a File::Temp object; this is undocumented but
31 my $dot_fh = $c->request->body;
34 # Render the dot in the given format.
35 my $collation = Text::Tradition::Collation->new();
36 my $stemma = Text::Tradition::Stemma->new( 'collation' => $collation, 'dot' => $dot_fh );
37 $c->stash->{result} = $stemma->as_svg;
38 $c->forward( "View::SVG" );
43 Standard 404 error page
48 my ( $self, $c ) = @_;
49 $c->response->body( 'Page not found' );
50 $c->response->status(404);
55 Attempt to render a view, if needed.
59 sub end : ActionClass('RenderView') {}
67 This library is free software. You can redistribute it and/or modify
68 it under the same terms as Perl itself.
72 __PACKAGE__->meta->make_immutable;