projects
/
spider.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
a line to bump the build no up
[spider.git]
/
perl
/
DXJSON.pm
diff --git
a/perl/DXJSON.pm
b/perl/DXJSON.pm
index 1a26f1aa4f3a694a9781aa1ea902dc4afea7edc3..1091f2f10a07180f75fcff05ed906ff02cb93c4e 100644
(file)
--- a/
perl/DXJSON.pm
+++ b/
perl/DXJSON.pm
@@
-11,6
+11,7
@@
use warnings;
use JSON;
use Data::Structure::Util qw(unbless);
use JSON;
use Data::Structure::Util qw(unbless);
+use Scalar::Util qw(blessed);
use DXDebug;
use DXUtil;
use DXDebug;
use DXUtil;
@@
-25,14
+26,13
@@
sub encode
{
my $json = shift;
my $ref = shift;
{
my $json = shift;
my $ref = shift;
- my $name = ref $ref;
-
- unbless($ref) if $name && $name ne 'HASH';
+ my $name = blessed $ref;
+ unbless($ref) if $name;
my $s;
eval {$s = $json->SUPER::encode($ref) };
if ($s && !$@) {
my $s;
eval {$s = $json->SUPER::encode($ref) };
if ($s && !$@) {
- bless $ref, $name if $name
&& $name ne 'HASH'
;
+ bless $ref, $name if $name;
return $s;
}
else {
return $s;
}
else {