use to_json and from_json in more places instead of encode_json and decode_json
This commit is contained in:
parent
b249b98a86
commit
315ce0941f
5 changed files with 11 additions and 11 deletions
|
|
@ -19,7 +19,7 @@ use base 'WebGUI::Asset::File::GalleryFile';
|
||||||
|
|
||||||
use Carp qw( carp croak );
|
use Carp qw( carp croak );
|
||||||
use Image::ExifTool qw( :Public );
|
use Image::ExifTool qw( :Public );
|
||||||
use JSON qw/ encode_json decode_json /;
|
use JSON qw/ to_json from_json /;
|
||||||
use URI::Escape;
|
use URI::Escape;
|
||||||
use Tie::IxHash;
|
use Tie::IxHash;
|
||||||
use List::MoreUtils;
|
use List::MoreUtils;
|
||||||
|
|
@ -221,7 +221,7 @@ sub getExifData {
|
||||||
|
|
||||||
# Our processing and eliminating of bad / unparsable keys
|
# Our processing and eliminating of bad / unparsable keys
|
||||||
# isn't perfect, so handle errors gracefully
|
# isn't perfect, so handle errors gracefully
|
||||||
my $exif = eval { decode_json( $self->get('exifData') ) };
|
my $exif = eval { from_json( $self->get('exifData') ) };
|
||||||
if ( $@ ) {
|
if ( $@ ) {
|
||||||
$self->session->errorHandler->warn(
|
$self->session->errorHandler->warn(
|
||||||
"Could not parse JSON data for EXIF in Photo '" . $self->get('title')
|
"Could not parse JSON data for EXIF in Photo '" . $self->get('title')
|
||||||
|
|
@ -461,7 +461,7 @@ sub updateExifDataFromFile {
|
||||||
}
|
}
|
||||||
|
|
||||||
$self->update({
|
$self->update({
|
||||||
exifData => encode_json( $info ),
|
exifData => to_json( $info ),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -192,7 +192,7 @@ sub freezeGraphConfig {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $obj = shift;
|
my $obj = shift;
|
||||||
|
|
||||||
return JSON::encode_json($obj);
|
return JSON::to_json($obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -404,7 +404,7 @@ sub thawGraphConfig {
|
||||||
my $string = shift;
|
my $string = shift;
|
||||||
|
|
||||||
return unless $string;
|
return unless $string;
|
||||||
return JSON::decode_json($string);
|
return JSON::from_json($string);
|
||||||
}
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ package WebGUI::Content::AssetManager;
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
|
||||||
use JSON qw( decode_json encode_json );
|
use JSON qw( from_json to_json );
|
||||||
use URI;
|
use URI;
|
||||||
use WebGUI::Form;
|
use WebGUI::Form;
|
||||||
use WebGUI::Paginator;
|
use WebGUI::Paginator;
|
||||||
|
|
@ -221,7 +221,7 @@ sub getMoreMenu {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
return encode_json \@more_fields;
|
return to_json \@more_fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
|
|
@ -309,7 +309,7 @@ sub www_ajaxGetManagerPage {
|
||||||
|
|
||||||
$session->http->setMimeType( 'application/json' );
|
$session->http->setMimeType( 'application/json' );
|
||||||
|
|
||||||
return encode_json( $assetInfo );
|
return to_json( $assetInfo );
|
||||||
}
|
}
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -454,7 +454,7 @@ a:visited { color: '.$form->get("visitedLinkColor").'; }
|
||||||
description => $i18n->get("We welcome your feedback."),
|
description => $i18n->get("We welcome your feedback."),
|
||||||
acknowledgement => $i18n->get("Thanks for for your interest in ^c;. We will review your message shortly."),
|
acknowledgement => $i18n->get("Thanks for for your interest in ^c;. We will review your message shortly."),
|
||||||
mailData => 1,
|
mailData => 1,
|
||||||
fieldConfiguration => JSON::encode_json(\@fieldConfig),
|
fieldConfiguration => JSON::to_json(\@fieldConfig),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -158,7 +158,7 @@ sub get {
|
||||||
$opts = {};
|
$opts = {};
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$opts = decode_json($opts);
|
$opts = JSON::from_json($opts);
|
||||||
}
|
}
|
||||||
if (defined $param) {
|
if (defined $param) {
|
||||||
return $opts->{$param};
|
return $opts->{$param};
|
||||||
|
|
@ -303,7 +303,7 @@ sub update {
|
||||||
my $options = shift || {};
|
my $options = shift || {};
|
||||||
WebGUI::Error::InvalidParam->throw(error => 'update was not sent a hashref of options to store in the database')
|
WebGUI::Error::InvalidParam->throw(error => 'update was not sent a hashref of options to store in the database')
|
||||||
unless ref $options eq 'HASH' and scalar keys %{ $options };
|
unless ref $options eq 'HASH' and scalar keys %{ $options };
|
||||||
my $jsonOptions = encode_json($options);
|
my $jsonOptions = JSON::to_json($options);
|
||||||
$options{id $self} = $jsonOptions;
|
$options{id $self} = $jsonOptions;
|
||||||
$self->session->db->write('update shipper set options=? where shipperId=?', [$jsonOptions, $self->getId]);
|
$self->session->db->write('update shipper set options=? where shipperId=?', [$jsonOptions, $self->getId]);
|
||||||
return undef;
|
return undef;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue