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:
Colin Kuskie 2009-03-30 19:47:27 +00:00
parent 05d62c92b7
commit 4e2a8bab91
4 changed files with 14 additions and 16 deletions

View file

@ -51,10 +51,7 @@ use JSON;
use Params::Validate qw(:all);
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
# because Colin uncovered some Clone bugs in Perl 5.10
#use Clone qw/clone/;
use Storable qw/dclone/;
use Clone qw/clone/;
# The maximum value of questionsPerPage is currently hardcoded here
my $MAX_QUESTIONS_PER_PAGE = 20;
@ -366,13 +363,13 @@ sub getObject {
return if !$count;
if ( $count == 1 ) {
return dclone $self->sections->[ sIndex($address) ];
return clone $self->sections->[ sIndex($address) ];
}
elsif ( $count == 2 ) {
return dclone $self->sections->[ sIndex($address) ]->{questions}->[ qIndex($address) ];
return clone $self->sections->[ sIndex($address) ]->{questions}->[ qIndex($address) ];
}
else {
return dclone $self->sections->[ sIndex($address) ]->{questions}->[ qIndex($address) ]->{answers}
return clone $self->sections->[ sIndex($address) ]->{questions}->[ qIndex($address) ]->{answers}
->[ aIndex($address) ];
}
}
@ -777,14 +774,14 @@ sub copy {
if ( $count == 1 ) {
# 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
$address->[0] = $self->lastSectionIndex;
}
elsif ( $count == 2 ) {
# 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
$address->[1] = $self->lastQuestionIndex($address);

View file

@ -123,6 +123,7 @@ checkModule("File::Path", "2.04" );
checkModule("Module::Find", "0.06" );
checkModule("Class::C3", "0.19" );
checkModule("Params::Validate", "0.81" );
checkModule("Clone", "0.31" );
failAndExit("Required modules are missing, running no more checks.") if $missingModule;

View file

@ -13,8 +13,8 @@ use Data::Dumper;
use WebGUI::Test; # Must use this before any other WebGUI modules
use WebGUI::Session;
use JSON;
#use Clone qw/clone/;
use Storable qw/dclone/;
use Clone qw/clone/;
#use Storable qw/dclone/;
#----------------------------------------------------------------------------
# Init
@ -2123,13 +2123,13 @@ sub buildSectionSkeleton {
my $sections = [];
my ($bareSection, $bareQuestion, $bareAnswer) = getBareSkeletons();
foreach my $questionSpec ( @{ $spec } ) {
my $section = dclone $bareSection;
my $section = clone $bareSection;
push @{ $sections }, $section;
foreach my $answers ( @{$questionSpec} ) {
my $question = dclone $bareQuestion;
my $question = clone $bareQuestion;
push @{ $section->{questions} }, $question;
while ($answers-- > 0) {
my $answer = dclone $bareAnswer;
my $answer = clone $bareAnswer;
push @{ $question->{answers} }, $answer;
}
}

View file

@ -2,7 +2,7 @@ package WebGUI::Test;
use strict;
use warnings;
use Storable qw/dclone/;
use Clone qw/clone/;
=head1 LEGAL
@ -356,7 +356,7 @@ sub originalConfig {
my ($class, $param) = @_;
my $safeValue = my $value = $SESSION->config->get($param);
if (ref $value) {
$safeValue = dclone $value;
$safeValue = clone $value;
}
$originalConfig{$param} = $safeValue;
}