Mercurial > pub > Impl
comparison Lib/IMPL/DOM/Schema/SimpleNode.pm @ 194:4d0e1962161c
Replaced tabs with spaces
IMPL::Web::View - fixed document model, new features (control classes, document constructor parameters)
| author | cin | 
|---|---|
| date | Tue, 10 Apr 2012 20:08:29 +0400 | 
| parents | d1676be8afcc | 
| children | b8c724f6de36 | 
   comparison
  equal
  deleted
  inserted
  replaced
| 193:8e8401c0aea4 | 194:4d0e1962161c | 
|---|---|
| 6 use IMPL::Class::Property; | 6 use IMPL::Class::Property; | 
| 7 use IMPL::Class::Property::Direct; | 7 use IMPL::Class::Property::Direct; | 
| 8 use IMPL::DOM::Property qw(_dom); | 8 use IMPL::DOM::Property qw(_dom); | 
| 9 | 9 | 
| 10 BEGIN { | 10 BEGIN { | 
| 11 public _dom _direct property inflator => prop_get; | 11 public _dom _direct property inflator => prop_get; | 
| 12 public _dom _direct property messageInflateError => prop_get; | 12 public _dom _direct property messageInflateError => prop_get; | 
| 13 } | 13 } | 
| 14 | 14 | 
| 15 our %CTOR = ( | 15 our %CTOR = ( | 
| 16 'IMPL::DOM::Schema::Node' => sub { | 16 'IMPL::DOM::Schema::Node' => sub { | 
| 17 my %args = @_; | 17 my %args = @_; | 
| 18 $args{nodeName} ||= 'SimpleNode'; | 18 $args{nodeName} ||= 'SimpleNode'; | 
| 19 delete @args{qw(inflator messageInflateError)}; | 19 delete @args{qw(inflator messageInflateError)}; | 
| 20 %args | 20 %args | 
| 21 } | 21 } | 
| 22 ); | 22 ); | 
| 23 | 23 | 
| 24 sub CTOR { | 24 sub CTOR { | 
| 25 my ($this,%args) = @_; | 25 my ($this,%args) = @_; | 
| 26 | 26 | 
| 27 if ( $args{inflator} ) { | 27 if ( $args{inflator} ) { | 
| 28 $this->{$inflator} = $args{inflator} ; | 28 $this->{$inflator} = $args{inflator} ; | 
| 29 $this->{$messageInflateError} = exists $args{messageInflateError} ? $args{messageInflateError} : 'Failed to inflate nodeValue %Node.path%: %Error%'; | 29 $this->{$messageInflateError} = exists $args{messageInflateError} ? $args{messageInflateError} : 'Failed to inflate nodeValue %Node.path%: %Error%'; | 
| 30 } | 30 } | 
| 31 } | 31 } | 
| 32 | 32 | 
| 33 sub Validate { | 33 sub Validate { | 
| 34 my ($this,$node,$ctx) = @_; | 34 my ($this,$node,$ctx) = @_; | 
| 35 | 35 | 
| 39 | 39 | 
| 40 return @result; | 40 return @result; | 
| 41 } | 41 } | 
| 42 | 42 | 
| 43 sub inflateValue { | 43 sub inflateValue { | 
| 44 my ($this,$value) = @_; | 44 my ($this,$value) = @_; | 
| 45 | 45 | 
| 46 if ( my $inflator = $this->inflator ) { | 46 if ( my $inflator = $this->inflator ) { | 
| 47 return $inflator->new($value); | 47 return $inflator->new($value); | 
| 48 } else { | 48 } else { | 
| 49 return $value; | 49 return $value; | 
| 50 } | 50 } | 
| 51 } | 51 } | 
| 52 | 52 | 
| 53 1; | 53 1; | 
| 54 | 54 | 
| 55 __END__ | 55 __END__ | 
