annotate Lib/IMPL/Web/QueryHandler.pm @ 62:c64bd1bf727d

Web application Page query handler
author wizard
date Fri, 12 Mar 2010 16:23:46 +0300
parents
children 2840c4c85db8
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
c64bd1bf727d Web application
wizard
parents:
diff changeset
3 use base qw(IMPL::Object IMPL::Object::Autofill);
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
c64bd1bf727d Web application
wizard
parents:
diff changeset
13 if (not ref $self or UNIVERSAL::isa($self,'IMPL::Object::Factory')) {
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 {
c64bd1bf727d Web application
wizard
parents:
diff changeset
21 die new NotImplementedException("The method isn't implemented", __PACKAGE__, 'Process');
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
c64bd1bf727d Web application
wizard
parents:
diff changeset
30 =head1 DESCRIPTION
c64bd1bf727d Web application
wizard
parents:
diff changeset
31
c64bd1bf727d Web application
wizard
parents:
diff changeset
32 Базовый класс для обработчиков запросов.
c64bd1bf727d Web application
wizard
parents:
diff changeset
33
c64bd1bf727d Web application
wizard
parents:
diff changeset
34 =head1 MEMBERS
c64bd1bf727d Web application
wizard
parents:
diff changeset
35
c64bd1bf727d Web application
wizard
parents:
diff changeset
36 =over 4
c64bd1bf727d Web application
wizard
parents:
diff changeset
37
c64bd1bf727d Web application
wizard
parents:
diff changeset
38 =item C< Invoke($action,$nextHandler) >
c64bd1bf727d Web application
wizard
parents:
diff changeset
39
c64bd1bf727d Web application
wizard
parents:
diff changeset
40 Вызывается механизмом обработки запроса, для передачи управления обработчику. Данная реализация
c64bd1bf727d Web application
wizard
parents:
diff changeset
41 проверяет как была вызвана, если как статический метод, то создает экземпляр класса и вызывает
c64bd1bf727d Web application
wizard
parents:
diff changeset
42 у созданного объекта метод C< Invoke > с параметрами C< $action >, C< $nextHandler >.
c64bd1bf727d Web application
wizard
parents:
diff changeset
43
c64bd1bf727d Web application
wizard
parents:
diff changeset
44 Если метод был вызван у объекта, то управление передается методу C< Process >
c64bd1bf727d Web application
wizard
parents:
diff changeset
45
c64bd1bf727d Web application
wizard
parents:
diff changeset
46 C< $action > Экземпляр запроса
c64bd1bf727d Web application
wizard
parents:
diff changeset
47
c64bd1bf727d Web application
wizard
parents:
diff changeset
48 C< $nextHandler > Делегат для вызова следующего обработчика. Вызывается без параметров, но следующему обработчику
c64bd1bf727d Web application
wizard
parents:
diff changeset
49 втоматически будут переданы необходимые параметры.
c64bd1bf727d Web application
wizard
parents:
diff changeset
50
c64bd1bf727d Web application
wizard
parents:
diff changeset
51 =back
c64bd1bf727d Web application
wizard
parents:
diff changeset
52
c64bd1bf727d Web application
wizard
parents:
diff changeset
53 =cut