my X $self = shift;
$self = fields::new($self) unless ref $self;
$self->{X1} = "x1";
- # FIXME. This code is dead on blead becase the test is skipped.
- # The test states that it's being skipped becaues restricted hashes
- # don't support a feature. Presumably we need to make that feature
- # supported. Bah.
- # use Devel::Peek; Dump($self);
$self->{_X2} = "_x2";
return $self;
}
package main;
- if ($Has_PH) {
my Z $c = Z->new();
is($c->get_X2, '_x2', "empty intermediate class");
- }
- else {
- SKIP: {
- skip "restricted hashes don't support private fields properly", 1;
- }
- }
}
}
use vars qw(%attr $VERSION);
-$VERSION = '2.12';
+$VERSION = '2.13';
# constant.pm is slow
sub PUBLIC () { 2**0 }
my $self = bless {}, $class;
# The lock_keys() prototype won't work since we require Hash::Util :(
- &Hash::Util::lock_keys(\%$self, keys %{$class.'::FIELDS'});
+ &Hash::Util::lock_keys(\%$self, _accessible_keys($class));
return $self;
}
}
+sub _accessible_keys {
+ my ($class) = @_;
+ return (
+ keys %{$class.'::FIELDS'},
+ map(_accessible_keys($_), @{$class.'::ISA'}),
+ );
+}
+
sub phash {
die "Pseudo-hashes have been removed from Perl" if $] >= 5.009;
my $h;