Mercurial > pub > Impl
comparison Lib/IMPL/Web/Application/ControllerUnit.pm @ 170:b88b7fe60aa3
refactoring
author | sourcer |
---|---|
date | Tue, 24 May 2011 01:11:16 +0400 |
parents | 4267a2ac3d46 |
children | 59e5fcb59d86 |
comparison
equal
deleted
inserted
replaced
169:fd92830036c3 | 170:b88b7fe60aa3 |
---|---|
24 public property formData => prop_get | owner_set; | 24 public property formData => prop_get | owner_set; |
25 public property formSchema => prop_get | owner_set; | 25 public property formSchema => prop_get | owner_set; |
26 public property formErrors => prop_get | owner_set; | 26 public property formErrors => prop_get | owner_set; |
27 } | 27 } |
28 | 28 |
29 my %publicProps = map {$_->Name , 1} __PACKAGE__->get_meta(typeof IMPL::Class::PropertyInfo); | 29 my %publicProps = map {$_->Name , 1} __PACKAGE__->get_meta(typeof IMPL::Class::PropertyInfo); |
30 | 30 |
31 __PACKAGE__->class_data(CONTROLLER_METHODS,{}); | 31 __PACKAGE__->class_data(CONTROLLER_METHODS,{}); |
32 | |
33 our @schemaInc; | |
32 | 34 |
33 sub CTOR { | 35 sub CTOR { |
34 my ($this,$action,$args) = @_; | 36 my ($this,$action,$args) = @_; |
35 | 37 |
36 $this->action($action); | 38 $this->action($action); |
183 return \%result; | 185 return \%result; |
184 } | 186 } |
185 | 187 |
186 sub loadSchema { | 188 sub loadSchema { |
187 my ($self,$name) = @_; | 189 my ($self,$name) = @_; |
188 | 190 |
189 if (-f $name) { | 191 foreach my $path (map File::Spec->catfile($_,$name) ,@schemaInc) { |
190 return IMPL::DOM::Schema->LoadSchema($name); | 192 return IMPL::DOM::Schema->LoadSchema($path) if -f $path; |
191 } else { | 193 } |
192 my ($vol,$dir,$file) = File::Spec->splitpath( Class::Inspector->resolved_filename(ref $self || $self) ); | 194 |
195 die new IMPL::Exception("A schema isn't found", $name); | |
196 } | |
197 | |
198 sub unitSchema { | |
199 my ($self) = @_; | |
200 | |
201 my $class = ref $self || $self; | |
202 | |
203 my @parts = split(/:+/, $class); | |
204 | |
205 my $file = pop @parts; | |
206 $file = "${file}.schema.xml"; | |
207 | |
208 foreach my $inc ( @schemaInc ) { | |
209 my $path = File::Spec->catfile($inc,@parts,$file); | |
193 | 210 |
194 return IMPL::DOM::Schema->LoadSchema(File::Spec->catfile($vol,$dir,$name)); | 211 return IMPL::DOM::Schema->LoadSchema($path) if -f $path; |
195 } | 212 } |
213 | |
214 return undef; | |
196 } | 215 } |
197 | 216 |
198 sub discover { | 217 sub discover { |
199 my ($this) = @_; | 218 my ($this) = @_; |
200 | 219 |