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