Revision 613

Date:
2016/11/02 17:01:28
Author:
ahitrov
Revision Log:
Short circuit breaker for json_eval.
Object's store_binary() method in addition to { attr => $attr } now can directly get { prop => $prop } feature.

Files:

Legend:

 
Added
 
Removed
 
Modified
  • utf8/core/lib/Contenido/Object.pm

     
    1065 1065 sub eval_json {
    1066 1066 return undef unless ${$_[0]};
    1067 1067 my $str = ${$_[0]};
    1068 if ( $str =~ /^\$VAR/ ) {
    1069 return Data::Recursive::Encode->decode_utf8(Contenido::Object::eval_dump( \$str ));
    1070 }
    1068 1071 my $chr = substr($str, 0, 1); return $str unless $chr eq '{' || $chr eq '[';
    1069 1072 my $value = $json_u->decode( $str );
    1070 1073 return $value;
     
    1263 1266 my $input = shift;
    1264 1267 my (%opts) = @_;
    1265 1268
    1266 return Contenido::File::store_binary( $input, object => $self, attr => $opts{attr} );
    1269 return Contenido::File::store_binary( $input, object => $self, %opts );
    1267 1270 }
    1268 1271
    1269 1272 # ----------------------------------------------------------------------------