Mercurial > pub > Impl
annotate Lib/IMPL/Web/Application/Action.pm @ 232:5c82eec23bb6
Fixed degradations due refactoring
author | sergey |
---|---|
date | Tue, 09 Oct 2012 20:12:47 +0400 |
parents | 6d8092d8ce1b |
children | b8c724f6de36 |
rev | line source |
---|---|
52 | 1 package IMPL::Web::Application::Action; |
55 | 2 use strict; |
52 | 3 |
166 | 4 use parent qw(IMPL::Object IMPL::Object::Autofill); |
52 | 5 |
63
76b878ad6596
Added serialization support for the IMPL::Object::List
wizard
parents:
62
diff
changeset
|
6 __PACKAGE__->PassThroughArgs; |
76b878ad6596
Added serialization support for the IMPL::Object::List
wizard
parents:
62
diff
changeset
|
7 |
52 | 8 use IMPL::Class::Property; |
206 | 9 use Carp qw(carp); |
52 | 10 |
11 BEGIN { | |
194 | 12 public property application => prop_get | owner_set; |
13 public property query => prop_get | owner_set; | |
14 private property _entryPoint => prop_all; | |
55 | 15 } |
16 | |
65 | 17 sub CTOR { |
194 | 18 my ($this) = @_; |
65 | 19 } |
63
76b878ad6596
Added serialization support for the IMPL::Object::List
wizard
parents:
62
diff
changeset
|
20 |
55 | 21 sub Invoke { |
194 | 22 my ($this) = @_; |
23 | |
24 if ($this->_entryPoint) { | |
25 $this->_entryPoint->(); | |
26 } else { | |
27 die new IMPL::InvalidOperationException("At least one handler is required"); | |
28 } | |
55 | 29 } |
30 | |
144
b56ebc31bf18
Empty nodes no more created while transforming a post request to the DOM document
wizard
parents:
67
diff
changeset
|
31 sub cookie { |
194 | 32 my ($this,$name,$rx) = @_; |
33 | |
34 $this->_launder(scalar( $this->query->cookie($name) ), $rx ); | |
144
b56ebc31bf18
Empty nodes no more created while transforming a post request to the DOM document
wizard
parents:
67
diff
changeset
|
35 } |
b56ebc31bf18
Empty nodes no more created while transforming a post request to the DOM document
wizard
parents:
67
diff
changeset
|
36 |
b56ebc31bf18
Empty nodes no more created while transforming a post request to the DOM document
wizard
parents:
67
diff
changeset
|
37 sub param { |
194 | 38 my ($this,$name,$rx) = @_; |
39 | |
40 $this->_launder(scalar( $this->query->param($name) ), $rx ); | |
144
b56ebc31bf18
Empty nodes no more created while transforming a post request to the DOM document
wizard
parents:
67
diff
changeset
|
41 } |
b56ebc31bf18
Empty nodes no more created while transforming a post request to the DOM document
wizard
parents:
67
diff
changeset
|
42 |
229
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
206
diff
changeset
|
43 sub requestMethod { |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
206
diff
changeset
|
44 my ($this) = @_; |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
206
diff
changeset
|
45 return $this->query->request_method; |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
206
diff
changeset
|
46 } |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
206
diff
changeset
|
47 |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
206
diff
changeset
|
48 sub pathInfo { |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
206
diff
changeset
|
49 my ($this) = @_; |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
206
diff
changeset
|
50 return $this->query->path_info; |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
206
diff
changeset
|
51 } |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
206
diff
changeset
|
52 |
144
b56ebc31bf18
Empty nodes no more created while transforming a post request to the DOM document
wizard
parents:
67
diff
changeset
|
53 sub _launder { |
194 | 54 my ($this,$value,$rx) = @_; |
55 | |
56 if ( $value ) { | |
57 if ($rx) { | |
58 if ( my @result = ($value =~ m/$rx/) ) { | |
59 return @result > 1 ? \@result : $result[0]; | |
60 } else { | |
229
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
206
diff
changeset
|
61 return; |
194 | 62 } |
63 } else { | |
64 return $value; | |
65 } | |
66 } else { | |
229
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
206
diff
changeset
|
67 return; |
194 | 68 } |
144
b56ebc31bf18
Empty nodes no more created while transforming a post request to the DOM document
wizard
parents:
67
diff
changeset
|
69 } |
b56ebc31bf18
Empty nodes no more created while transforming a post request to the DOM document
wizard
parents:
67
diff
changeset
|
70 |
52 | 71 1; |
72 | |
73 __END__ | |
74 | |
75 =pod | |
76 | |
67 | 77 =head1 NAME |
78 | |
180 | 79 C<IMPL::Web::Application::Action> - Обертка вокруг C<CGI> запроса. |
67 | 80 |
52 | 81 =head1 DESCRIPTION |
82 | |
67 | 83 C<[Infrastructure]> |
206 | 84 Свзяывет CGI запрос, приложение, орабатывающее его и ответ, который будет отправлен клиенту. |
52 | 85 |
67 | 86 =head1 MEMBERS |
87 | |
229
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
206
diff
changeset
|
88 =head2 C<CTOR(%args)> |
67 | 89 |
229
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
206
diff
changeset
|
90 Инициализирует новый экземпляр. Именованными параметрами передаются значения |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
206
diff
changeset
|
91 свойств. |
67 | 92 |
229
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
206
diff
changeset
|
93 =head2 C< [get]application> |
67 | 94 |
180 | 95 Экземпляр приложения создавшего текущий объект |
67 | 96 |
97 =item C< [get] query > | |
98 | |
180 | 99 Экземпляр C<CGI> запроса |
67 | 100 |
101 =back | |
102 | |
103 | |
180 | 104 =cut |