1package TestApp::Controller::Root;
2
3use strict;
4use warnings;
5use parent qw/Catalyst::Controller::RateLimit 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(
12    namespace => '',
13    rate_limit => {
14        default => [
15            {
16                period =>  3600,
17                attempts => 30
18            }, {
19                period => 60,
20                attempts => 5
21            }
22        ]
23    }
24);
25
26=head1 NAME
27
28TestApp::Controller::Root - Root Controller for TestApp
29
30=head1 DESCRIPTION
31
32[enter your description here]
33
34=head1 METHODS
35
36=cut
37
38=head2 index
39
40=cut
41
42sub checked_page :Local :Args(0) {
43    my ( $self, $c ) = @_;
44    if ( $self->flood_control->is_user_overrated( default => 'test' . $$ ) ) {
45        $c->response->status( 500 );
46    };
47    $c->response->body( 'превед' );
48}
49
50sub protected_page :Local :Args(0) {
51    my ( $self, $c ) = @_;
52    my $flood_control = $self->flood_control;
53    if ( $flood_control->register_attempt( default => 'test' . $$ ) ) {
54        $c->response->status( 500 );
55    };
56    $c->response->body( 'превед' );
57}
58
59sub kick_robot :Local :Args(0) {
60    my ( $self, $c ) = @_;
61    $c->response->status( 500 );
62    $c->response->body( 'ненененене' );
63}
64
65sub default :Path {
66    my ( $self, $c ) = @_;
67    $c->response->body( 'Page not found' );
68    $c->response->status(404);
69
70}
71
72
73
74=head1 AUTHOR
75
76Andrey Kostenko <andrey@kostenko.name>
77
78=head1 LICENSE
79
80This library is free software, you can redistribute it and/or modify
81it under the same terms as Perl itself.
82
83=cut
84
851;
86