diff --git a/lib/WebGUI/Asset/Wobject/Survey/SurveyJSON.pm b/lib/WebGUI/Asset/Wobject/Survey/SurveyJSON.pm index ac216260b..facb7484e 100644 --- a/lib/WebGUI/Asset/Wobject/Survey/SurveyJSON.pm +++ b/lib/WebGUI/Asset/Wobject/Survey/SurveyJSON.pm @@ -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); diff --git a/sbin/testEnvironment.pl b/sbin/testEnvironment.pl index 56a78ba9b..af0a6f09d 100755 --- a/sbin/testEnvironment.pl +++ b/sbin/testEnvironment.pl @@ -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; diff --git a/t/Asset/Wobject/Survey/SurveyJSON.t b/t/Asset/Wobject/Survey/SurveyJSON.t index 42f68a3ef..24ba997c0 100644 --- a/t/Asset/Wobject/Survey/SurveyJSON.t +++ b/t/Asset/Wobject/Survey/SurveyJSON.t @@ -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; } } diff --git a/t/lib/WebGUI/Test.pm b/t/lib/WebGUI/Test.pm index 75ee57659..c826f1fb1 100644 --- a/t/lib/WebGUI/Test.pm +++ b/t/lib/WebGUI/Test.pm @@ -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; }