Mercurial > pub > Impl
comparison Lib/IMPL/Web/Application/ResourceContract.pm @ 227:70ad6bc20908
sync
author | sergey |
---|---|
date | Fri, 07 Sep 2012 16:32:17 +0400 |
parents | b6cde007a175 |
children | 431db7034a88 |
comparison
equal
deleted
inserted
replaced
226:b6cde007a175 | 227:70ad6bc20908 |
---|---|
1 package IMPL::Web::Application::ResourceContract; | 1 package IMPL::Web::Application::ResourceContract; |
2 use strict; | 2 use strict; |
3 use IMPL::lang qw(:declare); | 3 use IMPL::lang qw(:declare); |
4 use IMPL::declare { | 4 use IMPL::declare { |
5 require => { | |
6 'ResourceClass' => 'IMPL::Web::Application::Resource' | |
7 }, | |
5 base => [ | 8 base => [ |
6 'IMPL::Object' => undef | 9 'IMPL::Object' => undef |
7 ] | 10 ] |
8 }; | 11 }; |
9 | 12 |
10 BEGIN { | 13 BEGIN { |
14 public property resourceFactory => PROP_ALL; | |
11 public property operations => PROP_ALL; | 15 public property operations => PROP_ALL; |
12 private property _namedResources => PROP_ALL; | 16 private property _namedResources => PROP_ALL; |
13 private property _regexpResources => PROP_ALL; | 17 private property _regexpResources => PROP_ALL; |
18 } | |
19 | |
20 sub CTOR { | |
21 my $this = shift; | |
22 my %args = @_; | |
23 | |
24 $this->resourceFactory( $args{resourceFactory} || ResourceClass ); | |
25 } | |
26 | |
27 sub CreateResource { | |
28 my ($this,) | |
14 } | 29 } |
15 | 30 |
16 1; | 31 1; |
17 | 32 |
18 __END__ | 33 __END__ |
56 ) | 71 ) |
57 } | 72 } |
58 ] | 73 ] |
59 ) | 74 ) |
60 | 75 |
76 my $obj = My::App::Data->fetch('something'); | |
77 | |
78 my $resource = $contract->CreateResource( | |
79 model => $obj, | |
80 parent => $prentResource, | |
81 id => 'item-something' | |
82 ); | |
83 | |
61 =end code | 84 =end code |
62 | 85 |
63 =head1 DESCRIPTION | 86 =head1 DESCRIPTION |
64 | 87 |
65 =cut | 88 =cut |