Subject: | Argument "6.78_99" isn't numeric in numeric eq (==) at MooseX/Storage/Engine.pm |
Version comparison fails on MooseX::Storage::Engine when an attribute is
an object also using MooseX::Storage and has an alpha version as in the
attached example:
$ perl point.pl
p1: x=1 y=2
Argument "6.78_99" isn't numeric in numeric eq (==) at
/home/alexm/perl5/perlbrew/perls/uoc-perl/lib/site_perl/5.12.2/MooseX/Storage/Engine.pm
line 183.
Argument "6.78_99" isn't numeric in numeric eq (==) at
/home/alexm/perl5/perlbrew/perls/uoc-perl/lib/site_perl/5.12.2/MooseX/Storage/Engine.pm
line 183.
p2: x=1 y=2
Using version module on both operands before comparison should fix this
issue for alpha version numbers.
Thanks!
Subject: | point.pl |
#!perl
use strict;
use warnings;
package Point;
use Moose;
use MooseX::Storage;
our $VERSION = '1.23_45';
with Storage;
has 'x' => (is => 'rw', isa => 'Int');
has 'y' => (is => 'rw', isa => 'YPoint');
package YPoint;
use Moose;
use MooseX::Storage;
our $VERSION = '6.78_99';
with Storage;
has value => (is => 'rw', isa => 'Int');
package main;
my $p1 = Point->new( x => 1, y => YPoint->new( value => 2 ) );
my $pack = $p1->pack();
print "p1: x=", $pack->{x}, " y=", $pack->{y}{value}, "\n";
my $p2 = Point->unpack($pack);
print "p2: x=", $p2->x, " y=", $p2->y->value, "\n";
__END__