Mercurial > pub > Impl
annotate Lib/IMPL/Web/Application/ResourceInterface.pm @ 375:441e84031c7b
docs
author | cin |
---|---|
date | Fri, 10 Jan 2014 16:33:00 +0400 |
parents | a8dbddf491dd |
children |
rev | line source |
---|---|
229
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
1 package IMPL::Web::Application::ResourceInterface; |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
2 use strict; |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
3 |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
4 use IMPL::require { |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
5 Exception => 'IMPL::Exception', |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
6 NotImplException => '-IMPL::NotImplementedException' |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
7 }; |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
8 |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
9 sub InvokeHttpVerb { |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
10 die NotImplException->new(); |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
11 } |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
12 |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
13 sub FetchChildResource { |
281 | 14 die NotImplException->new(); |
229
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
15 } |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
16 |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
17 1; |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
18 |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
19 __END__ |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
20 |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
21 =pod |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
22 |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
23 =head1 NAME |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
24 |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
25 C<IMPL::Web::Application::ResourceInterface> - Интерфейс для Web-ресурса. |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
26 |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
27 =head1 SYNOPSIS |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
28 |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
29 =begin code |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
30 |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
31 package MyApp::Web::Resource; |
230 | 32 use IMPL::Const qw(:prop); |
229
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
33 use IMPL::declare { |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
34 require => { |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
35 NotAllowedException => 'IMPL::Web::NotAllowedException' |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
36 }, |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
37 base => [ |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
38 'IMPL::Object' => undef, |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
39 'IMPL::Web::Application::ResourceInterface' => undef |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
40 ], |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
41 props => [ |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
42 model => PROP_ALL |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
43 ] |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
44 }; |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
45 |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
46 sub InvokeHttpVerb { |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
47 my ($this,$verb,$action) = @_; |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
48 |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
49 if($verb eq 'GET') { |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
50 return $this->model; |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
51 } else { |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
52 die NotAllowedException->new(allow => 'GET'); |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
53 } |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
54 } |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
55 |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
56 sub FetchChildResource { |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
57 # no child resources |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
58 return; |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
59 } |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
60 |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
61 =end code |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
62 |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
63 =head1 DESCRIPTION |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
64 |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
65 Данный модуль объявляет только интерфейс, тоесть в нем есть заглушки для функций |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
66 которые необходимо реализовать. |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
67 |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
68 Для создания класса, который может быть использоваться для создания Web-ресурсов |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
69 нужно унаследовать данный интерфейс и реализовать его методы. |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
70 |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
71 =head1 MEMBERS |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
72 |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
73 =head2 C<InvokeHttpVerb($verb,$action)> |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
74 |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
75 Выполняет операцию над ресурсом и возвращает результат ее выполнения. |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
76 Результатом может быть произвольный объект, который будет передан по цепочке |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
77 обработчиков приложения для формирования ответа вервера, либо |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
78 C<IMPL::Web::HttpResponse>, который описывает (не обязательно полностью) ответ. |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
79 В любом случае результат будет передан далее в цепочку обработчиков и может |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
80 быть изменен. |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
81 |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
82 =head2 C<FetchChildResource($childId)> |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
83 |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
84 Используется для получения дочернего ресурса (который содержится в данном |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
85 контейнере). Метод должен возвращать либо Web-ресурс |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
86 C<IMPL::Web::Application::ResourceInterface>, либо C<undef> если дочерний ресурс |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
87 не найден. |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
88 |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
diff
changeset
|
89 =cut |