annotate Lib/IMPL/Web/Application/CustomResource.pm @ 367:608e74bc309f

form metadata, mostly done
author cin
date Tue, 03 Dec 2013 17:55:36 +0400
parents e8be9062ecf2
children e12c14177848
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
229
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
1 package IMPL::Web::Application::CustomResource;
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
230
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 229
diff changeset
4 use IMPL::Const qw(:prop);
229
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
5
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
6 use IMPL::declare {
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
7 require => {
334
71221d79e6b4 removing web resources contracts
cin
parents: 332
diff changeset
8 NotAllowedException => 'IMPL::Web::NotAllowedException',
71221d79e6b4 removing web resources contracts
cin
parents: 332
diff changeset
9 HttpResponse => 'IMPL::Web::HttpResponse'
229
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
10 },
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
11 base => [
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
12 'IMPL::Web::Application::Resource' => '@_'
330
fe725fad2d90 Added access checking to web resources
sergey
parents: 295
diff changeset
13 ],
fe725fad2d90 Added access checking to web resources
sergey
parents: 295
diff changeset
14 props => [
335
e8be9062ecf2 improved resource classes, contracts are deprecated
cin
parents: 334
diff changeset
15 accessCheck => PROP_RW,
e8be9062ecf2 improved resource classes, contracts are deprecated
cin
parents: 334
diff changeset
16 resources => PROP_RO,
e8be9062ecf2 improved resource classes, contracts are deprecated
cin
parents: 334
diff changeset
17 verbs => PROP_RO,
e8be9062ecf2 improved resource classes, contracts are deprecated
cin
parents: 334
diff changeset
18 namedResources => PROP_RO,
e8be9062ecf2 improved resource classes, contracts are deprecated
cin
parents: 334
diff changeset
19 regexResources => PROP_RO
229
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 };
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
22
334
71221d79e6b4 removing web resources contracts
cin
parents: 332
diff changeset
23 our %RESOURCE_BINDINGS = (
71221d79e6b4 removing web resources contracts
cin
parents: 332
diff changeset
24 GET => 'HttpGet',
71221d79e6b4 removing web resources contracts
cin
parents: 332
diff changeset
25 POST => 'HttpPost',
71221d79e6b4 removing web resources contracts
cin
parents: 332
diff changeset
26 PUT => 'HttpPut',
71221d79e6b4 removing web resources contracts
cin
parents: 332
diff changeset
27 DELETE => 'HttpDelete',
335
e8be9062ecf2 improved resource classes, contracts are deprecated
cin
parents: 334
diff changeset
28 HEAD => 'HttpHead',
e8be9062ecf2 improved resource classes, contracts are deprecated
cin
parents: 334
diff changeset
29 OPTIONS => 'HttpOptions',
e8be9062ecf2 improved resource classes, contracts are deprecated
cin
parents: 334
diff changeset
30 TRACE => 'HttpTrace'
334
71221d79e6b4 removing web resources contracts
cin
parents: 332
diff changeset
31 );
71221d79e6b4 removing web resources contracts
cin
parents: 332
diff changeset
32
330
fe725fad2d90 Added access checking to web resources
sergey
parents: 295
diff changeset
33 sub CTOR {
fe725fad2d90 Added access checking to web resources
sergey
parents: 295
diff changeset
34 my ($this,%args) = @_;
fe725fad2d90 Added access checking to web resources
sergey
parents: 295
diff changeset
35
335
e8be9062ecf2 improved resource classes, contracts are deprecated
cin
parents: 334
diff changeset
36 $this->verbs($args{verbs} || {});
e8be9062ecf2 improved resource classes, contracts are deprecated
cin
parents: 334
diff changeset
37 $this->resources($args{resources} || []);
e8be9062ecf2 improved resource classes, contracts are deprecated
cin
parents: 334
diff changeset
38
330
fe725fad2d90 Added access checking to web resources
sergey
parents: 295
diff changeset
39 $this->accessCheck($args{accessCheck})
fe725fad2d90 Added access checking to web resources
sergey
parents: 295
diff changeset
40 if $args{accessCheck};
334
71221d79e6b4 removing web resources contracts
cin
parents: 332
diff changeset
41
71221d79e6b4 removing web resources contracts
cin
parents: 332
diff changeset
42 while(my ($verb,$methodName) = each %RESOURCE_BINDINGS) {
335
e8be9062ecf2 improved resource classes, contracts are deprecated
cin
parents: 334
diff changeset
43 if(my $method = $this->can($methodName)) {
e8be9062ecf2 improved resource classes, contracts are deprecated
cin
parents: 334
diff changeset
44 $this->verbs->{lc($verb)} ||= $method;
e8be9062ecf2 improved resource classes, contracts are deprecated
cin
parents: 334
diff changeset
45 }
334
71221d79e6b4 removing web resources contracts
cin
parents: 332
diff changeset
46 }
330
fe725fad2d90 Added access checking to web resources
sergey
parents: 295
diff changeset
47 }
fe725fad2d90 Added access checking to web resources
sergey
parents: 295
diff changeset
48
334
71221d79e6b4 removing web resources contracts
cin
parents: 332
diff changeset
49 sub FindChildResourceInfo {
71221d79e6b4 removing web resources contracts
cin
parents: 332
diff changeset
50 my ( $this, $name ) = @_;
229
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
51
335
e8be9062ecf2 improved resource classes, contracts are deprecated
cin
parents: 334
diff changeset
52 $this->PrepareResourcesCache()
e8be9062ecf2 improved resource classes, contracts are deprecated
cin
parents: 334
diff changeset
53 unless $this->namedResources;
e8be9062ecf2 improved resource classes, contracts are deprecated
cin
parents: 334
diff changeset
54
e8be9062ecf2 improved resource classes, contracts are deprecated
cin
parents: 334
diff changeset
55 if ( my $info = $this->namedResources->{$name} ) {
e8be9062ecf2 improved resource classes, contracts are deprecated
cin
parents: 334
diff changeset
56 return $info, [$name];
e8be9062ecf2 improved resource classes, contracts are deprecated
cin
parents: 334
diff changeset
57 }
e8be9062ecf2 improved resource classes, contracts are deprecated
cin
parents: 334
diff changeset
58 else {
e8be9062ecf2 improved resource classes, contracts are deprecated
cin
parents: 334
diff changeset
59 foreach my $info ( @{$this->regexResources} ) {
e8be9062ecf2 improved resource classes, contracts are deprecated
cin
parents: 334
diff changeset
60 my $rx = $info->{match};
e8be9062ecf2 improved resource classes, contracts are deprecated
cin
parents: 334
diff changeset
61 if(my @childId = $name =~ m/$rx/) {
e8be9062ecf2 improved resource classes, contracts are deprecated
cin
parents: 334
diff changeset
62 return $info, \@childId;
e8be9062ecf2 improved resource classes, contracts are deprecated
cin
parents: 334
diff changeset
63 }
e8be9062ecf2 improved resource classes, contracts are deprecated
cin
parents: 334
diff changeset
64 }
e8be9062ecf2 improved resource classes, contracts are deprecated
cin
parents: 334
diff changeset
65 }
e8be9062ecf2 improved resource classes, contracts are deprecated
cin
parents: 334
diff changeset
66
e8be9062ecf2 improved resource classes, contracts are deprecated
cin
parents: 334
diff changeset
67 return;
e8be9062ecf2 improved resource classes, contracts are deprecated
cin
parents: 334
diff changeset
68 }
e8be9062ecf2 improved resource classes, contracts are deprecated
cin
parents: 334
diff changeset
69
e8be9062ecf2 improved resource classes, contracts are deprecated
cin
parents: 334
diff changeset
70 sub GetAllowedMethods {
e8be9062ecf2 improved resource classes, contracts are deprecated
cin
parents: 334
diff changeset
71 map( uc, keys %{ shift->verbs } );
229
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
334
71221d79e6b4 removing web resources contracts
cin
parents: 332
diff changeset
74 sub PrepareResourcesCache {
335
e8be9062ecf2 improved resource classes, contracts are deprecated
cin
parents: 334
diff changeset
75 my ($this) = @_;
e8be9062ecf2 improved resource classes, contracts are deprecated
cin
parents: 334
diff changeset
76
e8be9062ecf2 improved resource classes, contracts are deprecated
cin
parents: 334
diff changeset
77 my @resources = ($this->GetChildResources(), @{$this->resources});
e8be9062ecf2 improved resource classes, contracts are deprecated
cin
parents: 334
diff changeset
78
334
71221d79e6b4 removing web resources contracts
cin
parents: 332
diff changeset
79 my %nameMap;
71221d79e6b4 removing web resources contracts
cin
parents: 332
diff changeset
80 my @rxMap;
248
814d755e5d12 Minor fixes
sergey
parents: 240
diff changeset
81
335
e8be9062ecf2 improved resource classes, contracts are deprecated
cin
parents: 334
diff changeset
82 foreach my $res (@resources) {
334
71221d79e6b4 removing web resources contracts
cin
parents: 332
diff changeset
83 #skip resources without contract
71221d79e6b4 removing web resources contracts
cin
parents: 332
diff changeset
84 next unless $res->{contract};
71221d79e6b4 removing web resources contracts
cin
parents: 332
diff changeset
85
71221d79e6b4 removing web resources contracts
cin
parents: 332
diff changeset
86 if ( my $name = $res->{name} ) {
71221d79e6b4 removing web resources contracts
cin
parents: 332
diff changeset
87 $nameMap{$name} = $res;
71221d79e6b4 removing web resources contracts
cin
parents: 332
diff changeset
88 }
71221d79e6b4 removing web resources contracts
cin
parents: 332
diff changeset
89 if ( $res->{match} ) {
71221d79e6b4 removing web resources contracts
cin
parents: 332
diff changeset
90 push @rxMap,$res;
71221d79e6b4 removing web resources contracts
cin
parents: 332
diff changeset
91 }
71221d79e6b4 removing web resources contracts
cin
parents: 332
diff changeset
92 }
71221d79e6b4 removing web resources contracts
cin
parents: 332
diff changeset
93
335
e8be9062ecf2 improved resource classes, contracts are deprecated
cin
parents: 334
diff changeset
94 $this->regexResources(\@rxMap);
e8be9062ecf2 improved resource classes, contracts are deprecated
cin
parents: 334
diff changeset
95 $this->namedResources(\%nameMap);
295
cin
parents: 248
diff changeset
96 }
cin
parents: 248
diff changeset
97
330
fe725fad2d90 Added access checking to web resources
sergey
parents: 295
diff changeset
98 sub AccessCheck {
fe725fad2d90 Added access checking to web resources
sergey
parents: 295
diff changeset
99 my ($this,$verb) = @_;
fe725fad2d90 Added access checking to web resources
sergey
parents: 295
diff changeset
100
fe725fad2d90 Added access checking to web resources
sergey
parents: 295
diff changeset
101 my $handler = $this->accessCheck;
fe725fad2d90 Added access checking to web resources
sergey
parents: 295
diff changeset
102
fe725fad2d90 Added access checking to web resources
sergey
parents: 295
diff changeset
103 if(ref($handler) eq 'CODE') {
334
71221d79e6b4 removing web resources contracts
cin
parents: 332
diff changeset
104 return &$handler($this,$verb);
330
fe725fad2d90 Added access checking to web resources
sergey
parents: 295
diff changeset
105 }
fe725fad2d90 Added access checking to web resources
sergey
parents: 295
diff changeset
106 }
fe725fad2d90 Added access checking to web resources
sergey
parents: 295
diff changeset
107
229
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
108 sub GetChildResources {
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
109
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
110 }
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
111
335
e8be9062ecf2 improved resource classes, contracts are deprecated
cin
parents: 334
diff changeset
112 sub HttpOptions {
334
71221d79e6b4 removing web resources contracts
cin
parents: 332
diff changeset
113 my ($this) = @_;
71221d79e6b4 removing web resources contracts
cin
parents: 332
diff changeset
114
335
e8be9062ecf2 improved resource classes, contracts are deprecated
cin
parents: 334
diff changeset
115 my @allow = $this->GetAllowedMethods();
334
71221d79e6b4 removing web resources contracts
cin
parents: 332
diff changeset
116 return HttpResponse->new(
71221d79e6b4 removing web resources contracts
cin
parents: 332
diff changeset
117 status => '200 OK',
71221d79e6b4 removing web resources contracts
cin
parents: 332
diff changeset
118 headers => {
71221d79e6b4 removing web resources contracts
cin
parents: 332
diff changeset
119 allow => join ( ',', @allow )
71221d79e6b4 removing web resources contracts
cin
parents: 332
diff changeset
120 }
71221d79e6b4 removing web resources contracts
cin
parents: 332
diff changeset
121 );
71221d79e6b4 removing web resources contracts
cin
parents: 332
diff changeset
122 }
71221d79e6b4 removing web resources contracts
cin
parents: 332
diff changeset
123
229
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
124 1;
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
125
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
126 __END__
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
127
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
128 =pod
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
129
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
130 =head1 NAME
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
131
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
132 C<IMPL::Web::Application::CustomResource> - базовый класс для ресурсов,
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
133 реальзуемых в коде.
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
134
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
135 =head1 SYNOPSIS
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
136
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
137 =begin code
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
138
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
139 package MyApp::Web::Resources::ProfileResource;
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
140 use IMPL::declare {
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
141 base => [
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
142 'IMPL::Web::Application::CustomResource' => '@_'
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
143 ]
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
144 }
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
145
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
146 sub HttpGet {
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
147 my ($this) = @_;
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
148 return $this->model;
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
149 }
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
150
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
151 sub HttpPut {
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
152 my ($this,$action) = @_;
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
153
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
154 my $form = MyApp::Web::Schema::UpdateUser->new();
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
155
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
156 $this->model->update( $form->Bind($action) );
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
157 }
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
158
334
71221d79e6b4 removing web resources contracts
cin
parents: 332
diff changeset
159 sub GetChildResources {
71221d79e6b4 removing web resources contracts
cin
parents: 332
diff changeset
160 return {
71221d79e6b4 removing web resources contracts
cin
parents: 332
diff changeset
161 name => 'create',
71221d79e6b4 removing web resources contracts
cin
parents: 332
diff changeset
162 contract => {
71221d79e6b4 removing web resources contracts
cin
parents: 332
diff changeset
163 class => 'My::Web::FormResource',
71221d79e6b4 removing web resources contracts
cin
parents: 332
diff changeset
164 formName => 'create',
71221d79e6b4 removing web resources contracts
cin
parents: 332
diff changeset
165 schema => 'profile.schema'
71221d79e6b4 removing web resources contracts
cin
parents: 332
diff changeset
166 }
71221d79e6b4 removing web resources contracts
cin
parents: 332
diff changeset
167 },
71221d79e6b4 removing web resources contracts
cin
parents: 332
diff changeset
168 {
71221d79e6b4 removing web resources contracts
cin
parents: 332
diff changeset
169 match => qr/^(.*)$/,
71221d79e6b4 removing web resources contracts
cin
parents: 332
diff changeset
170 contract => {
71221d79e6b4 removing web resources contracts
cin
parents: 332
diff changeset
171 class => 'My::Web::ItemResource'
71221d79e6b4 removing web resources contracts
cin
parents: 332
diff changeset
172 }
71221d79e6b4 removing web resources contracts
cin
parents: 332
diff changeset
173 }
71221d79e6b4 removing web resources contracts
cin
parents: 332
diff changeset
174 }
332
04a093f0a5a6 IMPL::Web::Application refactoring: resources are created per client request
cin
parents: 330
diff changeset
175
229
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
176 =end code
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
177
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
178 =head1 MEMBERS
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
179
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
180 =head2 C<[static]contractFactory>
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
181
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
182 Фабрика, используемая для получения контракта ресурса. По умолчанию
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
183 C<IMPL::Web::Application::CustomResourceContract>.
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
184
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
185 =head2 C<[static]contractInstance>
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
186
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
187 Экземпляр контракта для ресурса. Создается при первом обращении при помощи
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
188 метода C<InitContract()>.
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
189
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
190 =head2 C<[static]InitContract()>
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
191
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
192 Создает новый экземпляр контракта, используя фабрику из свойства C<contractFactory>.
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
193
248
814d755e5d12 Minor fixes
sergey
parents: 240
diff changeset
194 =head2 C<[static]CreateContract(%args)>
814d755e5d12 Minor fixes
sergey
parents: 240
diff changeset
195
814d755e5d12 Minor fixes
sergey
parents: 240
diff changeset
196 Создает новый контракт, который при создании ресурсов будет передавать им в
814d755e5d12 Minor fixes
sergey
parents: 240
diff changeset
197 конструкторе параметры C<%args>. Реализуется при помощи C<IMPL::Object::Factory>
814d755e5d12 Minor fixes
sergey
parents: 240
diff changeset
198 которой задается параметр ссылка на C<%args>, т.о. при создании ресурса, ему в
814d755e5d12 Minor fixes
sergey
parents: 240
diff changeset
199 конструкторе будет передан список из ключей и значений хеша C<%args>, а затем
814d755e5d12 Minor fixes
sergey
parents: 240
diff changeset
200 остальные аргументы.
814d755e5d12 Minor fixes
sergey
parents: 240
diff changeset
201
295
cin
parents: 248
diff changeset
202 =head2 C<[static]CreateResource(%args)>
cin
parents: 248
diff changeset
203
cin
parents: 248
diff changeset
204 Создает контракт по-умолчанию и вызывает у него метод C<CreateResource(%args)>.
cin
parents: 248
diff changeset
205
229
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
206 =head2 C<[static]GetChildResources()>
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
207
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
208 Статический метод, который должны переопределять новые классы ресурсов, у
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
209 которых есть дочерние ресурсы.
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
210
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
211 =begin code
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
212
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
213 package MyApp::Web::MyResource
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
214
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
215 sub GetChildResources {
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
216 my $self = shift;
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
217 return
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
218 $self->SUPER::GetChildResources(),
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
219 {
230
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 229
diff changeset
220 name => 'info',
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 229
diff changeset
221 contract => $contractInfo
229
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
222 };
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
223 }
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
224
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
225 =end code
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
226
230
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 229
diff changeset
227 Метод возвращает список из хешей, которые будут переданы в качестве параметра
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 229
diff changeset
228 C<resources> контракту данного ресурса.
229
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
229
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents:
diff changeset
230 =cut