Subject: | Object based on fields breaks with perl at least 5.10 |
Trying to upgrade some old 5.8 unit tests to a 5.10 install. I've run into a snag with objects based on fields.
I've attached a simple test case. Running it for me gives "Modification of a read-only value attempted"
I'm really not sure what the proper solution to this is.
Subject: | test-mockobject-extends-usecase.pl |
#!/usr/bin/env perl
package MyModule;
use strict;
use warnings;
use fields qw(field1 field2);
sub new {
my $self = shift;
unless (ref $self) {
$self = fields::new($self);
}
return $self;
}
package main;
use strict;
use warnings;
use Test::MockObject::Extends;
use Data::Dumper;
my $VAR1 = MyModule->new();
print Data::Dumper::Dumper($VAR1);
my $VAR2 = Test::MockObject::Extends->new($VAR1);