Bug#677588: perl: Storing shared_clone with overload in shared_clone strips off overload

2012-06-15 Thread James McCoy
tag 677588 fixed-upstream
thanks

On Thu, Jun 14, 2012 at 11:52:03PM -0400, James McCoy wrote:
 The attached script demonstrates the problem through a series of tests.
 Basically, after
 
   my $arr = shared_clone([$objWithOverloads]);
   my $obj = $arr-[0];
 
 $obj no longer behaves the same as $objWithOverloads.  Any of the
 overloaded methods defined are no longer invoked automatically in the
 relevant contexts.

Which I just noticed was fixed in 5.17.0 by a series of commits ending
with a1cd65be3e8d2e7a6b4edef2ff5eee74e79cf497.

I'm not sure if the shared_clone tests would be useful additions to
upstream's lib/overload.t or if their tests already cover the same paths
the shared_clone stuff covers.

-- 
James
GPG Key: 4096R/331BA3DB 2011-12-05 James McCoy james...@debian.org



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#677588: perl: Storing shared_clone with overload in shared_clone strips off overload

2012-06-14 Thread James McCoy
Package: perl
Version: 5.14.2-11
Severity: normal
Tags: upstream

The attached script demonstrates the problem through a series of tests.
Basically, after

  my $arr = shared_clone([$objWithOverloads]);
  my $obj = $arr-[0];

$obj no longer behaves the same as $objWithOverloads.  Any of the
overloaded methods defined are no longer invoked automatically in the
relevant contexts.

-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.2.0-2-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages perl depends on:
ii  libbz2-1.01.0.6-3
ii  libc6 2.13-33
ii  libdb5.1  5.1.29-4
ii  libgdbm3  1.8.3-11
ii  perl-base 5.14.2-11
ii  perl-modules  5.14.2-11
ii  zlib1g1:1.2.7.dfsg-11

Versions of packages perl recommends:
ii  netbase  5.0

Versions of packages perl suggests:
ii  libterm-readline-gnu-perl  1.20-2+b1
ii  make   3.81-8.2
ii  perl-doc   5.14.2-11

-- no debconf information
package FailOverload;
use threads;
use threads::shared;
use overload '' = 'str',
 'eq' = 'eq';

sub new { return bless({}, $_[0]); }
sub str { is_shared($_[0]) || ref($_[0]) }
sub eq {
my ($self, $other, $swap) = @_;
$self eq $other;
}

package main;
use strict;
use threads;
use threads::shared;
use Test::Simple tests = 11;

my $fo = FailOverload-new();
ok($fo eq 'FailOverload', 'stringify overload');

my $sFo = shared_clone($fo);
my $id = $sFo;
ok($sFo eq $id, 'stringify overload shared_clone');

my %h = (fo = $fo, sFo = $sFo);
ok($h{fo} eq 'FailOverload', 'stringify overload from hash');
ok($h{sFo} eq $id, 'stringify overload shared_clone from hash');

my @arr = ($fo, $sFo);
ok($arr[0] eq 'FailOverload', 'stringify overload from array');
ok($arr[1] eq $id, 'stringify overload shared_clone from array');

my $ssFo = shared_clone($sFo);
ok($ssFo eq $id, 'stringify overload double shared');

my $h = shared_clone({sFo = $sFo});
ok($h-{sFo} eq $id, 'stringify overload shared_clone from shared_clone hash');
ok($h-{sFo}-str eq $id, 'call overload str directly');

my $arr = shared_clone([$sFo]);
ok($arr-[0] eq $id, 'stringify overload shared_clone from shared_clone array');
ok($arr-[0]-str eq $id, 'call overload str directly');