comparison Lib/IMPL/Resources/Format.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 e6447ad85cb4
children 010ceafd0c5a
comparison
equal deleted inserted replaced
193:8e8401c0aea4 194:4d0e1962161c
19 19
20 sub _getvalue { 20 sub _getvalue {
21 my ($obj,$path,$default,$resolver) = @_; 21 my ($obj,$path,$default,$resolver) = @_;
22 22
23 foreach my $chunk (split /\./,$path) { 23 foreach my $chunk (split /\./,$path) {
24 return $default unless $obj; 24 return $default unless $obj;
25 if (ref $obj eq 'HASH') { 25 if (ref $obj eq 'HASH') {
26 $obj = $obj->{$chunk}; 26 $obj = $obj->{$chunk};
27 } else { 27 } else {
28 $obj = $resolver->($obj,$chunk); 28 $obj = $resolver->($obj,$chunk);
29 } 29 }
30 } 30 }
31 return $obj; 31 return $obj;
32 } 32 }
33 33
34 sub _defaultResolver { 34 sub _defaultResolver {
35 my ($obj,$prop) = @_; 35 my ($obj,$prop) = @_;
36 36
37 return ( eval { $obj->can($prop) } ? $obj->$prop() : undef ); 37 return ( eval { $obj->can($prop) } ? $obj->$prop() : undef );
38 } 38 }
39 39
40 1; 40 1;