1#!perl 2 3use Test::Without::Module ("Module::Runtime"); 4use strict ("subs", "vars", "refs"); 5use warnings ("all"); 6BEGIN { $ENV{CLONE_CHOOSE_PREFERRED_BACKEND} = "Storable"; } 7END { delete $ENV{CLONE_CHOOSE_PREFERRED_BACKEND} } # for VMS 8 9use Scalar::Util qw(refaddr); 10use Test::More; 11 12BEGIN 13{ 14 $ENV{CLONE_CHOOSE_PREFERRED_BACKEND} and eval "use $ENV{CLONE_CHOOSE_PREFERRED_BACKEND}; 1;"; 15 $@ and plan skip_all => "No $ENV{CLONE_CHOOSE_PREFERRED_BACKEND} found."; 16} 17 18use Clone::Choose; 19 20my $string = "Scalar"; 21$string = \$string; 22my $cloned_string = clone $string; 23 24ok(refaddr $string != refaddr $cloned_string, "Scalar String"); 25 26my $numeric = 3.141; 27$numeric = \$numeric; 28my $cloned_numeric = clone $numeric; 29 30ok(refaddr $numeric != refaddr $cloned_numeric, "Scalar Numeric"); 31 32my $undef = undef; 33$undef = \$undef; 34my $cloned_undef = clone $undef; 35 36ok(refaddr $undef != refaddr $cloned_undef, "Scalar Undef"); 37 38done_testing; 39 40 41