Started the move to TT2.
[catagits/Gitalist.git] / Gitalist / lib / Gitalist / Controller / Root.pm
1 package Gitalist::Controller::Root;
2
3 use strict;
4 use warnings;
5 use parent 'Catalyst::Controller';
6
7 #
8 # Sets the actions in this controller to be registered with no prefix
9 # so they function identically to actions created in MyApp.pm
10 #
11 __PACKAGE__->config->{namespace} = '';
12
13 =head1 NAME
14
15 Gitalist::Controller::Root - Root Controller for Gitalist
16
17 =head1 DESCRIPTION
18
19 [enter your description here]
20
21 =head1 METHODS
22
23 =cut
24
25 =head2 index
26
27 =cut
28
29 #sub index :Path :Args(0) {
30 #    my ( $self, $c ) = @_;
31 #
32 #    # Hello World
33 #    $c->response->body( $c->welcome_message );
34 #}
35
36 use IO::Capture::Stdout;
37
38 sub default :Path {
39     my ( $self, $c ) = @_;
40
41         my $capture = IO::Capture::Stdout->new();
42         $capture->start();
43         eval { gitweb::main($c) };
44         $capture->stop();
45
46         my $output = join '', $capture->read;
47         $c->stash->{content} = $output;
48         $c->stash->{template} = 'default.tt2';
49 }
50
51 =head2 end
52
53 Attempt to render a view, if needed.
54
55 =cut
56
57 sub end : ActionClass('RenderView') {}
58
59 =head1 AUTHOR
60
61 Dan Brook,,,
62
63 =head1 LICENSE
64
65 This library is free software. You can redistribute it and/or modify
66 it under the same terms as Perl itself.
67
68 =cut
69
70 1;