annotate Lib/IMPL/Web/QueryHandler.pm @ 263:0f59b2de72af

*fixed IMPL::DOM::Schema circular module references *modified IMPL::Object::Singleton, added auto-activation *code cleanups, docs
author sergey
date Wed, 09 Jan 2013 05:17:44 +0400
parents 4d0e1962161c
children
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
166
4267a2ac3d46 Added Class::Template,
wizard
parents: 77
diff changeset
3 use parent 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 {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
11 my ($self,$action,$nextHandler) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
12
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
13 if (not ref $self) {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
14 return $self->new( action => $action )->Invoke($action,$nextHandler);
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
15 } else {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
16 return $self->Process($action,$nextHandler);
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
17 }
62
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 {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
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
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 166
diff changeset
32 Базовый класс для обработчиков запросов.
62
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
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 166
diff changeset
36 Простой вариант
65
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
166
4267a2ac3d46 Added Class::Template,
wizard
parents: 77
diff changeset
42 use parent qw(IMPL::Web::QueryHandler);
65
2840c4c85db8 Application configuration improvements
wizard
parents: 62
diff changeset
43
2840c4c85db8 Application configuration improvements
wizard
parents: 62
diff changeset
44 sub CTOR {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
45 my ($this,%args) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
46
65
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 {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
50 my ($this,$action,$nextHandler) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
51
65
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
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 166
diff changeset
62 Вызывается механизмом обработки запроса, для передачи управления обработчику. Данная реализация
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 166
diff changeset
63 проверяет контекст вызова, если как статический метод, то создает экземпляр класса и вызывает
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 166
diff changeset
64 у созданного объекта метод C< Invoke > с параметрами C< $action >, C< $nextHandler >.
62
c64bd1bf727d Web application
wizard
parents:
diff changeset
65
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 166
diff changeset
66 При создании нового объекта в конструктор передается именованый параметр C<action>.
65
2840c4c85db8 Application configuration improvements
wizard
parents: 62
diff changeset
67
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 166
diff changeset
68 Если метод был вызван у объекта, то управление передается методу C< Process >.
65
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
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 166
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
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 166
diff changeset
78 Делегат для вызова следующего обработчика. Вызывается без параметров, но следующему обработчику
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 166
diff changeset
79 втоматически будут переданы необходимые параметры.
62
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
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 166
diff changeset
85 =cut