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]
31 sub index :Path :Args(0) {
32 my ( $self, $c ) = @_;
33 $c->stash->{template} = 'dotinput.tt2';
36 sub get_graph :Local {
38 # If called interactively, we have params 'display', 'output', 'witnesses'
39 # If called non-interactively, we look at headers and content.
40 # The body is actually a File::Temp object; this is undocumented but
42 my $dot_fh = $c->request->body;
45 # Render the dot in the given format.
46 my $collation = Text::Tradition::Collation->new();
47 my $stemma = Text::Tradition::Stemma->new( 'collation' => $collation, 'dot' => $dot_fh );
48 $c->stash->{result} = $stemma->as_svg;
49 $c->forward( "View::SVG" );
54 Standard 404 error page
59 my ( $self, $c ) = @_;
60 $c->response->body( 'Page not found' );
61 $c->response->status(404);
66 Attempt to render a view, if needed.
70 sub end : ActionClass('RenderView') {}
78 This library is free software. You can redistribute it and/or modify
79 it under the same terms as Perl itself.
83 __PACKAGE__->meta->make_immutable;