Skip Menu |

This queue is for tickets about the Scalar-List-Utils CPAN distribution.

Report information
The Basics
Id: 61118
Status: resolved
Priority: 0/
Queue: Scalar-List-Utils

Owner: Nobody in particular
Requestors: jettero [...]

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)

Subject: overloaded xs magic makes assumption that breaks my stuff
Download (untitled) / with headers
text/plain 449b
This package works fine under List::Util::PP,but not under the XS. The reason is that the XS assumes once a type is magic, it stays magic under numeric operations. That's definitely not always true. use List::Util qw(sum); my $e1 = example->new(7, "test"); sum($e1, 7, 7); # works under ::PP, but not under XS -- If riding in an airplane is flying, then riding in a boat is swimming. 116 jumps, 48.6 minutes of freefall, 92.9 freefall miles.
text/x-perl 459b
package example; use Carp; use strict; use warnings; use overload '0+' => sub { $_[0][0] }, '""' => sub { my $r = "$_[0][0]"; $r = "+$r" unless $r =~ m/^\-/; $r .= " [$_[0][1]]"; $r }, fallback => 1; sub new { my $class = shift; croak "this package constructor requires precisely two arguments: number, description" unless @_ == 2; return undef unless defined $_[0]; my $this = bless [@_], $class; return $this; } 1;
THis is fixed in Scalar-List-Utils-1.23_03.tar.gz just uploaded to CPAN for testing

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to