Bump up the version for Clone, since the new version works with
perl 5.10. Have SurveyJSON use it instead of dclone.
This commit is contained in:
parent
05d62c92b7
commit
4e2a8bab91
4 changed files with 14 additions and 16 deletions
|
|
@ -51,10 +51,7 @@ use JSON;
|
||||||
use Params::Validate qw(:all);
|
use Params::Validate qw(:all);
|
||||||
Params::Validate::validation_options( on_fail => sub { WebGUI::Error::InvalidParam->throw( error => shift ) } );
|
Params::Validate::validation_options( on_fail => sub { WebGUI::Error::InvalidParam->throw( error => shift ) } );
|
||||||
|
|
||||||
# N.B. We're currently using Storable::dclone instead of Clone::clone
|
use Clone qw/clone/;
|
||||||
# because Colin uncovered some Clone bugs in Perl 5.10
|
|
||||||
#use Clone qw/clone/;
|
|
||||||
use Storable qw/dclone/;
|
|
||||||
|
|
||||||
# The maximum value of questionsPerPage is currently hardcoded here
|
# The maximum value of questionsPerPage is currently hardcoded here
|
||||||
my $MAX_QUESTIONS_PER_PAGE = 20;
|
my $MAX_QUESTIONS_PER_PAGE = 20;
|
||||||
|
|
@ -366,13 +363,13 @@ sub getObject {
|
||||||
return if !$count;
|
return if !$count;
|
||||||
|
|
||||||
if ( $count == 1 ) {
|
if ( $count == 1 ) {
|
||||||
return dclone $self->sections->[ sIndex($address) ];
|
return clone $self->sections->[ sIndex($address) ];
|
||||||
}
|
}
|
||||||
elsif ( $count == 2 ) {
|
elsif ( $count == 2 ) {
|
||||||
return dclone $self->sections->[ sIndex($address) ]->{questions}->[ qIndex($address) ];
|
return clone $self->sections->[ sIndex($address) ]->{questions}->[ qIndex($address) ];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return dclone $self->sections->[ sIndex($address) ]->{questions}->[ qIndex($address) ]->{answers}
|
return clone $self->sections->[ sIndex($address) ]->{questions}->[ qIndex($address) ]->{answers}
|
||||||
->[ aIndex($address) ];
|
->[ aIndex($address) ];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -777,14 +774,14 @@ sub copy {
|
||||||
|
|
||||||
if ( $count == 1 ) {
|
if ( $count == 1 ) {
|
||||||
# Clone the indexed section onto the end of the list of sections..
|
# Clone the indexed section onto the end of the list of sections..
|
||||||
push @{ $self->sections }, dclone $self->section($address);
|
push @{ $self->sections }, clone $self->section($address);
|
||||||
|
|
||||||
# Update $address with the index of the newly created section
|
# Update $address with the index of the newly created section
|
||||||
$address->[0] = $self->lastSectionIndex;
|
$address->[0] = $self->lastSectionIndex;
|
||||||
}
|
}
|
||||||
elsif ( $count == 2 ) {
|
elsif ( $count == 2 ) {
|
||||||
# Clone the indexed question onto the end of the list of questions..
|
# Clone the indexed question onto the end of the list of questions..
|
||||||
push @{ $self->questions($address) }, dclone $self->question($address);
|
push @{ $self->questions($address) }, clone $self->question($address);
|
||||||
|
|
||||||
# Update $address with the index of the newly created question
|
# Update $address with the index of the newly created question
|
||||||
$address->[1] = $self->lastQuestionIndex($address);
|
$address->[1] = $self->lastQuestionIndex($address);
|
||||||
|
|
|
||||||
|
|
@ -123,6 +123,7 @@ checkModule("File::Path", "2.04" );
|
||||||
checkModule("Module::Find", "0.06" );
|
checkModule("Module::Find", "0.06" );
|
||||||
checkModule("Class::C3", "0.19" );
|
checkModule("Class::C3", "0.19" );
|
||||||
checkModule("Params::Validate", "0.81" );
|
checkModule("Params::Validate", "0.81" );
|
||||||
|
checkModule("Clone", "0.31" );
|
||||||
|
|
||||||
failAndExit("Required modules are missing, running no more checks.") if $missingModule;
|
failAndExit("Required modules are missing, running no more checks.") if $missingModule;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,8 @@ use Data::Dumper;
|
||||||
use WebGUI::Test; # Must use this before any other WebGUI modules
|
use WebGUI::Test; # Must use this before any other WebGUI modules
|
||||||
use WebGUI::Session;
|
use WebGUI::Session;
|
||||||
use JSON;
|
use JSON;
|
||||||
#use Clone qw/clone/;
|
use Clone qw/clone/;
|
||||||
use Storable qw/dclone/;
|
#use Storable qw/dclone/;
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
# Init
|
# Init
|
||||||
|
|
@ -2123,13 +2123,13 @@ sub buildSectionSkeleton {
|
||||||
my $sections = [];
|
my $sections = [];
|
||||||
my ($bareSection, $bareQuestion, $bareAnswer) = getBareSkeletons();
|
my ($bareSection, $bareQuestion, $bareAnswer) = getBareSkeletons();
|
||||||
foreach my $questionSpec ( @{ $spec } ) {
|
foreach my $questionSpec ( @{ $spec } ) {
|
||||||
my $section = dclone $bareSection;
|
my $section = clone $bareSection;
|
||||||
push @{ $sections }, $section;
|
push @{ $sections }, $section;
|
||||||
foreach my $answers ( @{$questionSpec} ) {
|
foreach my $answers ( @{$questionSpec} ) {
|
||||||
my $question = dclone $bareQuestion;
|
my $question = clone $bareQuestion;
|
||||||
push @{ $section->{questions} }, $question;
|
push @{ $section->{questions} }, $question;
|
||||||
while ($answers-- > 0) {
|
while ($answers-- > 0) {
|
||||||
my $answer = dclone $bareAnswer;
|
my $answer = clone $bareAnswer;
|
||||||
push @{ $question->{answers} }, $answer;
|
push @{ $question->{answers} }, $answer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ package WebGUI::Test;
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use Storable qw/dclone/;
|
use Clone qw/clone/;
|
||||||
|
|
||||||
=head1 LEGAL
|
=head1 LEGAL
|
||||||
|
|
||||||
|
|
@ -356,7 +356,7 @@ sub originalConfig {
|
||||||
my ($class, $param) = @_;
|
my ($class, $param) = @_;
|
||||||
my $safeValue = my $value = $SESSION->config->get($param);
|
my $safeValue = my $value = $SESSION->config->get($param);
|
||||||
if (ref $value) {
|
if (ref $value) {
|
||||||
$safeValue = dclone $value;
|
$safeValue = clone $value;
|
||||||
}
|
}
|
||||||
$originalConfig{$param} = $safeValue;
|
$originalConfig{$param} = $safeValue;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue