Clone stopped working in several tests in 5.14.2. Remove it in favor of Storable::dclone.
Clone handles being passed scalar data, but dclone does not.
This commit is contained in:
parent
1b4f7c33fa
commit
be37f12ab1
23 changed files with 70 additions and 49 deletions
|
|
@ -16,7 +16,7 @@ package WebGUI::Asset;
|
|||
|
||||
use Carp qw( croak confess );
|
||||
use Scalar::Util qw( blessed weaken );
|
||||
use Clone qw(clone);
|
||||
use Storable qw/dclone/;
|
||||
use JSON;
|
||||
use HTML::Packer;
|
||||
|
||||
|
|
@ -2721,7 +2721,7 @@ to set the keywords for this asset.
|
|||
sub update {
|
||||
my $self = shift;
|
||||
my $requestedProperties = shift;
|
||||
my $properties = clone($requestedProperties);
|
||||
my $properties = dclone($requestedProperties);
|
||||
$properties->{lastModified} = time();
|
||||
|
||||
# if keywords were specified, then let's set them the right way
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ use WebGUI::Form;
|
|||
use WebGUI::Exception;
|
||||
use List::MoreUtils qw{ any };
|
||||
use Tie::IxHash;
|
||||
use Clone qw/clone/;
|
||||
use Storable qw/dclone/;
|
||||
use HTML::Packer;
|
||||
use JSON qw{ to_json from_json };
|
||||
use Try::Tiny;
|
||||
|
|
@ -914,8 +914,8 @@ on this being here.
|
|||
|
||||
sub update {
|
||||
my $self = shift;
|
||||
my $requestedProperties = shift;
|
||||
my $properties = clone($requestedProperties);
|
||||
my $requestedProperties = shift || {};
|
||||
my $properties = dclone($requestedProperties);
|
||||
|
||||
if (exists $properties->{headBlock}) {
|
||||
$properties->{extraHeadTags} .= $properties->{headBlock};
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ use strict;
|
|||
use JSON;
|
||||
use Params::Validate qw(:all);
|
||||
use List::Util qw(shuffle);
|
||||
use Clone qw/clone/;
|
||||
use Storable qw/dclone/;
|
||||
use Safe;
|
||||
use WebGUI::Asset::Wobject::Survey::ExpressionEngine;
|
||||
Params::Validate::validation_options( on_fail => sub { WebGUI::Error::InvalidParam->throw( error => shift ) } );
|
||||
|
|
@ -368,7 +368,12 @@ sub surveyOrderIndex {
|
|||
if ($variable) {
|
||||
return $self->response->{surveyOrderLookup}{$variable};
|
||||
} else {
|
||||
return clone $self->response->{surveyOrderLookup};
|
||||
if (ref $self->response->{surveyOrderLookup}) {
|
||||
return dclone $self->response->{surveyOrderLookup};
|
||||
}
|
||||
else {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1465,7 +1470,10 @@ sub responseReport {
|
|||
my $answer = $self->survey->answer( [ $sIndex, $qIndex, $aIndex ] );
|
||||
|
||||
# Massage each answer response and push it onto the list
|
||||
if ( my $response = clone $self->responses->{$answerId} ) {
|
||||
if ( my $response = $self->responses->{$answerId} ) {
|
||||
if (ref $response) {
|
||||
$response = dclone $response;
|
||||
}
|
||||
$response->{isCorrect} = $answer->{isCorrect} ? 1 : 0;
|
||||
$response->{id} = $aIndex;
|
||||
$response->{score} = $answer->{value}; # N.B. answer score is consistently misnamed 'value'
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ use strict;
|
|||
use JSON;
|
||||
use Params::Validate qw(:all);
|
||||
Params::Validate::validation_options( on_fail => sub { WebGUI::Error::InvalidParam->throw( error => shift ) } );
|
||||
use Clone qw/clone/;
|
||||
use Storable qw/dclone/;
|
||||
use WebGUI::Asset::Wobject::Survey::ExpressionEngine;
|
||||
|
||||
# The maximum value of questionsPerPage is currently hardcoded here
|
||||
|
|
@ -407,13 +407,13 @@ sub getObject {
|
|||
return if !$count;
|
||||
|
||||
if ( $count == 1 ) {
|
||||
return clone $self->sections->[ sIndex($address) ];
|
||||
return dclone $self->sections->[ sIndex($address) ];
|
||||
}
|
||||
elsif ( $count == 2 ) {
|
||||
return clone $self->sections->[ sIndex($address) ]->{questions}->[ qIndex($address) ];
|
||||
return dclone $self->sections->[ sIndex($address) ]->{questions}->[ qIndex($address) ];
|
||||
}
|
||||
else {
|
||||
return clone $self->sections->[ sIndex($address) ]->{questions}->[ qIndex($address) ]->{answers}
|
||||
return dclone $self->sections->[ sIndex($address) ]->{questions}->[ qIndex($address) ]->{answers}
|
||||
->[ aIndex($address) ];
|
||||
}
|
||||
}
|
||||
|
|
@ -950,21 +950,21 @@ sub copy {
|
|||
|
||||
if ( $count == 1 ) {
|
||||
# Clone the indexed section onto the end of the list of sections..
|
||||
push @{ $self->{_sections} }, clone $self->section($address);
|
||||
push @{ $self->{_sections} }, dclone $self->section($address);
|
||||
|
||||
# Update $address with the index of the newly created section
|
||||
$address->[0] = $self->lastSectionIndex;
|
||||
}
|
||||
elsif ( $count == 2 ) {
|
||||
# Clone the indexed question onto the end of the list of questions..
|
||||
push @{ $self->section($address)->{questions} }, clone $self->question($address);
|
||||
push @{ $self->section($address)->{questions} }, dclone $self->question($address);
|
||||
|
||||
# Update $address with the index of the newly created question
|
||||
$address->[1] = $self->lastQuestionIndex($address);
|
||||
}
|
||||
elsif ( $count == 3 ) {
|
||||
# Clone the indexed answer onto the end of the list of answers..
|
||||
push @{ $self->question($address)->{answers} }, clone $self->answer($address);
|
||||
push @{ $self->question($address)->{answers} }, dclone $self->answer($address);
|
||||
|
||||
# Update $address with the index of the newly created answer
|
||||
$address->[2]++;
|
||||
|
|
@ -1194,7 +1194,10 @@ sub getMultiChoiceBundle {
|
|||
my ($type) = validate_pos( @_, { type => SCALAR | UNDEF } );
|
||||
|
||||
# Return a cloned copy of the bundle structure
|
||||
return clone $self->{multipleChoiceTypes}->{$type};
|
||||
if ($self->{multipleChoiceTypes}->{$type}) {
|
||||
return dclone $self->{multipleChoiceTypes}->{$type};
|
||||
}
|
||||
return undef;
|
||||
}
|
||||
|
||||
=head2 addAnswersToQuestion ($address, $answers)
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ use HTML::Parser;
|
|||
use URI::Escape;
|
||||
use WebGUI::Form;
|
||||
use WebGUI::Search;
|
||||
use Clone qw/clone/;
|
||||
use Storable qw/dclone/;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
|
|
@ -618,7 +618,7 @@ sub getKeywordVariables {
|
|||
my $variables = [];
|
||||
|
||||
KEYWORD: foreach my $member (@{ $hierarchy }) {
|
||||
my $varBlock = clone $member;
|
||||
my $varBlock = dclone $member;
|
||||
$varBlock->{level} = $level;
|
||||
$varBlock->{isTopLevel} = $level == 0;
|
||||
$varBlock->{indent_loop} = [ map { { indent => $_ } } 1..$level ];
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package WebGUI::Cache::CHI;
|
|||
use strict;
|
||||
use base 'WebGUI::Cache';
|
||||
use File::Temp qw/tempdir/;
|
||||
use Clone qw/clone/;
|
||||
use Storable qw/dclone/;
|
||||
use CHI;
|
||||
|
||||
=head1 NAME
|
||||
|
|
@ -93,7 +93,7 @@ sub new {
|
|||
# Create CHI object from config
|
||||
my $chi;
|
||||
unless ( $chi = $session->stow->get( "CHI" ) ) {
|
||||
my $cacheConf = clone $session->config->get('cache');
|
||||
my $cacheConf = dclone $session->config->get('cache');
|
||||
$cacheConf->{namespace} = $namespace;
|
||||
$cacheConf->{is_size_aware} = 1;
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ use strict;
|
|||
use Class::InsideOut qw(readonly private id register);
|
||||
use JSON;
|
||||
use Tie::IxHash;
|
||||
use Clone qw/clone/;
|
||||
use Storable qw/dclone/;
|
||||
use WebGUI::DateTime;
|
||||
use WebGUI::Exception;
|
||||
use WebGUI::Utility;
|
||||
|
|
@ -579,11 +579,16 @@ sub get {
|
|||
|
||||
# return a specific property
|
||||
if (defined $name) {
|
||||
return clone $objectData{id $self}{$name};
|
||||
if (ref $objectData{id $self}{$name}) {
|
||||
return dclone $objectData{id $self}{$name};
|
||||
}
|
||||
else {
|
||||
return $objectData{id $self}{$name};
|
||||
}
|
||||
}
|
||||
|
||||
# return a copy of all properties
|
||||
return clone $objectData{id $self};
|
||||
return dclone $objectData{id $self};
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ use WebGUI::Macro;
|
|||
use WebGUI::User;
|
||||
use WebGUI::Shop::Cart;
|
||||
use JSON;
|
||||
use Clone qw/clone/;
|
||||
use Storable qw/dclone/;
|
||||
use Scalar::Util qw/blessed/;
|
||||
|
||||
=head1 NAME
|
||||
|
|
@ -708,7 +708,7 @@ sub update {
|
|||
$jsonOptions,
|
||||
$self->paymentGatewayId
|
||||
]);
|
||||
my $storedProperties = clone $properties;
|
||||
my $storedProperties = dclone $properties;
|
||||
$options{ id $self } = $storedProperties;
|
||||
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue