annotate Lib/IMPL/Web/QueryHandler.pm @ 130:06a34c197b05

Added support for utf-8 and old versions of CGI module
author wizard
date Wed, 16 Jun 2010 01:50:56 +0400
parents 9d24db321029
children 4267a2ac3d46
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
62
c64bd1bf727d Web application
wizard
parents:
diff changeset
1 package IMPL::Web::QueryHandler;
c64bd1bf727d Web application
wizard
parents:
diff changeset
2
65
2840c4c85db8 Application configuration improvements
wizard
parents: 62
diff changeset
3 use base qw(IMPL::Object IMPL::Object::Autofill IMPL::Object::Serializable);
62
c64bd1bf727d Web application
wizard
parents:
diff changeset
4 use IMPL::Class::Property;
c64bd1bf727d Web application
wizard
parents:
diff changeset
5
c64bd1bf727d Web application
wizard
parents:
diff changeset
6 __PACKAGE__->PassThroughArgs;
c64bd1bf727d Web application
wizard
parents:
diff changeset
7
c64bd1bf727d Web application
wizard
parents:
diff changeset
8 use IMPL::Exception;
c64bd1bf727d Web application
wizard
parents:
diff changeset
9
c64bd1bf727d Web application
wizard
parents:
diff changeset
10 sub Invoke {
c64bd1bf727d Web application
wizard
parents:
diff changeset
11 my ($self,$action,$nextHandler) = @_;
c64bd1bf727d Web application
wizard
parents:
diff changeset
12
65
2840c4c85db8 Application configuration improvements
wizard
parents: 62
diff changeset
13 if (not ref $self) {
62
c64bd1bf727d Web application
wizard
parents:
diff changeset
14 return $self->new( action => $action )->Invoke($action,$nextHandler);
c64bd1bf727d Web application
wizard
parents:
diff changeset
15 } else {
c64bd1bf727d Web application
wizard
parents:
diff changeset
16 return $self->Process($action,$nextHandler);
c64bd1bf727d Web application
wizard
parents:
diff changeset
17 }
c64bd1bf727d Web application
wizard
parents:
diff changeset
18 }
c64bd1bf727d Web application
wizard
parents:
diff changeset
19
c64bd1bf727d Web application
wizard
parents:
diff changeset
20 sub Process {
77
9d24db321029 Refactoring Web::TT
wizard
parents: 65
diff changeset
21 die new IMPL::NotImplementedException("The method isn't implemented", __PACKAGE__, 'Process');
62
c64bd1bf727d Web application
wizard
parents:
diff changeset
22 }
c64bd1bf727d Web application
wizard
parents:
diff changeset
23
c64bd1bf727d Web application
wizard
parents:
diff changeset
24 1;
c64bd1bf727d Web application
wizard
parents:
diff changeset
25
c64bd1bf727d Web application
wizard
parents:
diff changeset
26 __END__
c64bd1bf727d Web application
wizard
parents:
diff changeset
27
c64bd1bf727d Web application
wizard
parents:
diff changeset
28 =pod
c64bd1bf727d Web application
wizard
parents:
diff changeset
29
65
2840c4c85db8 Application configuration improvements
wizard
parents: 62
diff changeset
30 =head1 NAME
62
c64bd1bf727d Web application
wizard
parents:
diff changeset
31
c64bd1bf727d Web application
wizard
parents:
diff changeset
32 Базовый класс для обработчиков запросов.
c64bd1bf727d Web application
wizard
parents:
diff changeset
33
65
2840c4c85db8 Application configuration improvements
wizard
parents: 62
diff changeset
34 =head1 SYNOPSIS
2840c4c85db8 Application configuration improvements
wizard
parents: 62
diff changeset
35
2840c4c85db8 Application configuration improvements
wizard
parents: 62
diff changeset
36 Простой вариант
2840c4c85db8 Application configuration improvements
wizard
parents: 62
diff changeset
37
2840c4c85db8 Application configuration improvements
wizard
parents: 62
diff changeset
38 =begin code
2840c4c85db8 Application configuration improvements
wizard
parents: 62
diff changeset
39
2840c4c85db8 Application configuration improvements
wizard
parents: 62
diff changeset
40 package MyHandler;
2840c4c85db8 Application configuration improvements
wizard
parents: 62
diff changeset
41
2840c4c85db8 Application configuration improvements
wizard
parents: 62
diff changeset
42 use base qw(IMPL::Web::QueryHandler);
2840c4c85db8 Application configuration improvements
wizard
parents: 62
diff changeset
43
2840c4c85db8 Application configuration improvements
wizard
parents: 62
diff changeset
44 sub CTOR {
2840c4c85db8 Application configuration improvements
wizard
parents: 62
diff changeset
45 my ($this,%args) = @_;
2840c4c85db8 Application configuration improvements
wizard
parents: 62
diff changeset
46
2840c4c85db8 Application configuration improvements
wizard
parents: 62
diff changeset
47 }
2840c4c85db8 Application configuration improvements
wizard
parents: 62
diff changeset
48
2840c4c85db8 Application configuration improvements
wizard
parents: 62
diff changeset
49 sub Process {
2840c4c85db8 Application configuration improvements
wizard
parents: 62
diff changeset
50 my ($this,$action,$nextHandler) = @_;
2840c4c85db8 Application configuration improvements
wizard
parents: 62
diff changeset
51
2840c4c85db8 Application configuration improvements
wizard
parents: 62
diff changeset
52 }
2840c4c85db8 Application configuration improvements
wizard
parents: 62
diff changeset
53
2840c4c85db8 Application configuration improvements
wizard
parents: 62
diff changeset
54 =end code
2840c4c85db8 Application configuration improvements
wizard
parents: 62
diff changeset
55
62
c64bd1bf727d Web application
wizard
parents:
diff changeset
56 =head1 MEMBERS
c64bd1bf727d Web application
wizard
parents:
diff changeset
57
c64bd1bf727d Web application
wizard
parents:
diff changeset
58 =over 4
c64bd1bf727d Web application
wizard
parents:
diff changeset
59
c64bd1bf727d Web application
wizard
parents:
diff changeset
60 =item C< Invoke($action,$nextHandler) >
c64bd1bf727d Web application
wizard
parents:
diff changeset
61
c64bd1bf727d Web application
wizard
parents:
diff changeset
62 Вызывается механизмом обработки запроса, для передачи управления обработчику. Данная реализация
65
2840c4c85db8 Application configuration improvements
wizard
parents: 62
diff changeset
63 проверяет контекст вызова, если как статический метод, то создает экземпляр класса и вызывает
62
c64bd1bf727d Web application
wizard
parents:
diff changeset
64 у созданного объекта метод C< Invoke > с параметрами C< $action >, C< $nextHandler >.
c64bd1bf727d Web application
wizard
parents:
diff changeset
65
65
2840c4c85db8 Application configuration improvements
wizard
parents: 62
diff changeset
66 При создании нового объекта в конструктор передается именованый параметр C<action>.
2840c4c85db8 Application configuration improvements
wizard
parents: 62
diff changeset
67
2840c4c85db8 Application configuration improvements
wizard
parents: 62
diff changeset
68 Если метод был вызван у объекта, то управление передается методу C< Process >.
2840c4c85db8 Application configuration improvements
wizard
parents: 62
diff changeset
69
2840c4c85db8 Application configuration improvements
wizard
parents: 62
diff changeset
70 =over
62
c64bd1bf727d Web application
wizard
parents:
diff changeset
71
65
2840c4c85db8 Application configuration improvements
wizard
parents: 62
diff changeset
72 =item C< $action >
2840c4c85db8 Application configuration improvements
wizard
parents: 62
diff changeset
73
2840c4c85db8 Application configuration improvements
wizard
parents: 62
diff changeset
74 Экземпляр запроса
62
c64bd1bf727d Web application
wizard
parents:
diff changeset
75
65
2840c4c85db8 Application configuration improvements
wizard
parents: 62
diff changeset
76 =item C< $nextHandler >
2840c4c85db8 Application configuration improvements
wizard
parents: 62
diff changeset
77
2840c4c85db8 Application configuration improvements
wizard
parents: 62
diff changeset
78 Делегат для вызова следующего обработчика. Вызывается без параметров, но следующему обработчику
62
c64bd1bf727d Web application
wizard
parents:
diff changeset
79 втоматически будут переданы необходимые параметры.
c64bd1bf727d Web application
wizard
parents:
diff changeset
80
c64bd1bf727d Web application
wizard
parents:
diff changeset
81 =back
c64bd1bf727d Web application
wizard
parents:
diff changeset
82
65
2840c4c85db8 Application configuration improvements
wizard
parents: 62
diff changeset
83 =back
2840c4c85db8 Application configuration improvements
wizard
parents: 62
diff changeset
84
62
c64bd1bf727d Web application
wizard
parents:
diff changeset
85 =cut