import my old svn repo here
[catagits/Catalyst-Component-ACCEPT_CONTEXT.git] / t / lib / TestApp / Controller / Root.pm
CommitLineData
75f37967 1# Copyright (c) 2007 Jonathan Rockway <jrockway@cpan.org>
2
6166f03d 3package TestApp::Controller::Root;
4use strict;
5use warnings;
75f37967 6use base qw/Catalyst::Component::ACCEPT_CONTEXT Catalyst::Controller/;
7use Devel::Cycle;
8
9__PACKAGE__->config(namespace => '');
10
11sub model : Global {
12 my ($self, $c) = @_;
13 $c->stash->{message} = "model";
14 $c->res->body($c->model('Test')->message);
15}
16
17sub view : Global {
18 my ($self, $c) = @_;
19 $c->stash->{message} = "view";
20 $c->res->body($c->view('Test')->message);
21}
6166f03d 22
75f37967 23sub controller : Global {
24 my ($self, $c) = @_;
25 $c->res->body("controller");
26}
6166f03d 27
75f37967 28sub foo : Global {
29 my ($self, $c) = @_;
30 $c->res->body($c->model('Test')->foo);
31}
6166f03d 32
75f37967 33sub stash : Global {
34 my ($self, $c) = @_;
35 $c->model('StashMe')->test;
36 $c->res->body($c->stash->{stashme}->foo);
37}
38
39sub cycle : Global {
40 my ($self, $c) = @_;
41 $c->model('StashMe')->test;
42 my $cycle_ok = 1;
43 my $got_cycle = sub { $cycle_ok = 0 };
44 find_cycle($c, $got_cycle);
45 $c->res->body($cycle_ok);
46}
47
48sub weak_cycle :Global {
49 my ($self, $c) = @_;
50 $c->model('StashMe')->test;
51 my $cycle_ok = 0;
52 my $got_cycle = sub { $cycle_ok = 1 };
53 find_weakened_cycle($c, $got_cycle);
54 $c->res->body($cycle_ok);
55}
6166f03d 56
571;
75f37967 58