Clone
view release on metacpan or search on metacpan
- making some tests optional (fixes RT81774) (GARU)
- modernizing synopsis (GARU)
0.33 2012-11-24 11:37:22 garu
- fix typo in croak message (Salvatore Bonaccorso)
0.32 2012-11-22 12:14:07 garu
- Stop skipping SvROK handling for all magical scalars. This fixes
RT issues 67105, 79730 and 80201 (FLORA).
- making the Changes file compliant to the CPAN::Changes spec (GARU).
- Fixing tests when Scalar::Util::weaken is not available. As a
result, tests should now pass even in odd OpenBSD versions (GARU).
- removed dubious documentation on the optional parameter until
it is 'fixed'. Right now it just increases the refcount when it's 0,
and clones otherwise (which isn't exactly what it says). This
fixes RT issue 57773 (GARU).
- updated remark on Storable's dclone() to address RT issue 50174 (GARU)
- updated Makefile.PL to include test dependencies (GARU)
0.31 2009-01-20 04:54:37 ray
- Made changes for build failure on Solaris, apparently compiler warnings
- added a test and fix for tainted variables.
- use a static VERSION in Clone.pm.
0.18 2005-05-23 15:34:31 ray
- moved declaration to top of function, M$ (and other) C compilers choke.
0.17 2005-05-05 22:26:01 ray
- Changed PERL_MAGIC_backref to '<' for compatability with 5.6
0.16 2005-04-20 15:49:35 ray
- Bug fix for id 11997, "Clone dies horribly when Scalar::Util::weaken
is around" see http://rt.cpan.org/Ticket/Display.html?id=11997
for details.
0.15.2.1 2005-05-05 21:55:30 ray
- changed PERL_MAGIC_backref to '<' for backward compatibility with 5.6
0.15 2003-09-07 22:02:35 ray
- VERSION 0.15
0.13.2.3 2003-09-07 21:51:03 ray
else if (SvROK (ref))
{
TRACEME(("clone = 0x%x(%d)\n", clone, SvREFCNT(clone)));
SvREFCNT_dec(SvRV(clone));
SvRV(clone) = sv_clone (SvRV(ref), hseen, depth); /* Clone the referent */
if (sv_isobject (ref))
{
sv_bless (clone, SvSTASH (SvRV (ref)));
}
if (SvWEAKREF(ref)) {
sv_rvweaken(clone);
}
}
TRACEME(("clone = 0x%x(%d)\n", clone, SvREFCNT(clone)));
return clone;
}
MODULE = Clone PACKAGE = Clone
PROTOTYPES: ENABLE
sv_resetpvn|5.017005||Viu
SvRMAGICAL|5.003007||Viu
SvRMAGICAL_off|5.003007||Viu
SvRMAGICAL_on|5.003007||Viu
SvROK|5.003007|5.003007|
SvROK_off|5.003007|5.003007|
SvROK_on|5.003007|5.003007|
SvRV|5.003007|5.003007|
SvRV_const|5.010001||Viu
SvRV_set|5.009003|5.003007|p
sv_rvunweaken|5.027004|5.027004|
sv_rvweaken|5.006000|5.006000|
SvRVx|5.003007||Viu
SvRX|5.009005|5.003007|p
SvRXOK|5.009005|5.003007|p
SV_SAVED_COPY|5.009005||Viu
SvSCREAM|5.003007||Viu
SvSCREAM_off|5.003007||Viu
SvSCREAM_on|5.003007||Viu
sv_setbool|5.035004|5.035004|
sv_setbool_mg|5.035004|5.035004|
sv_setgid|5.019001||Viu
t/06refcnt.t view on Meta::CPAN
# Change 1..1 below to 1..last_test_to_print .
# (It may become useful if the test is moved to ./t subdirectory.)
my $HAS_WEAKEN;
BEGIN {
$| = 1;
my $plan = 25;
eval 'use Scalar::Util qw( weaken isweak );';
if ($@) {
$HAS_WEAKEN = 0;
$plan = 15;
}
else {
$HAS_WEAKEN = 1;
}
print "1..$plan\n";
}
t/06refcnt.t view on Meta::CPAN
bless $a, 'Test::Hash';
bless $b, 'Test::Hash';
}
# test for cloning weak reference
if ($HAS_WEAKEN) {
{
my $a = Test::Hash->new;
my $b = { r => $a };
$a->{r} = $b;
weaken( $b->{'r'} );
my $c = clone($a);
}
# another weak reference problem, this one causes a segfault in 0.24
{
my $a = Test::Hash->new;
{
my $b = [ $a, $a ];
$a->{r} = $b;
weaken( $b->[0] );
weaken( $b->[1] );
}
my $c = clone($a);
# check that references point to the same thing
is( $c->{'r'}[0], $c->{'r'}[1], "references point to the same thing" );
isnt( $c->{'r'}[0], $a->{'r'}[0], "a->{r}->[0] ne c->{r}->[0]" );
require B;
my $c_obj = B::svref_2object($c);
t/07magic.t view on Meta::CPAN
use strict;
use Clone;
use Test::More tests => 10;
SKIP: {
eval "use Data::Dumper";
skip "Data::Dumper not installed", 1 if $@;
SKIP: {
eval "use Scalar::Util qw( weaken )";
skip "Scalar::Util not installed", 1 if $@;
my $x = { a => "worked\n" };
my $y = $x;
weaken($y);
my $z = Clone::clone($x);
ok( Dumper($x) eq Dumper($z), "Cloned weak reference");
}
## RT 21859: Clone segfault (isolated example)
SKIP: {
my $string = "HDDR-WD-250JS";
eval {
use utf8;
utf8::upgrade($string);
( run in 0.329 second using v1.01-cache-2.11-cpan-a9ef4e587e4 )