Skip Menu |

This queue is for tickets about the Moose CPAN distribution.

Report information
The Basics
Id: 68837
Status: resolved
Priority: 0/
Queue: Moose

People
Owner: Nobody in particular
Requestors: SUGOIK [...] cpan.org
Cc:
AdminCc:

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



Subject: Delegating 'accessor' method of native Hash rejects values as invalid keys
The native Hash trait's method 'accessor' rejects its $value argument as being an invalid key with the message "The key passed to accessor must be a defined value". That is, $obj->delegated_accessor(foo => undef); will fail despite the definedness of 'foo'. Attached is a simple test case; note that the bug exists in both forms of delegation.
Subject: attr-delegation.pl
#!/usr/bin/perl use warnings; use strict; package Thing; use Moose; has hashref => ( is => 'ro', traits => ['Hash'], default => sub { {} }, handles => { attr => [qw(accessor attr)], access => 'accessor', }, ); __PACKAGE__->meta->make_immutable; package main; my $thing = Thing->new; eval { $thing->attr(undef); }; warn if $@; eval { $thing->access(attr => undef); }; warn if $@;
Fixed in 2.0008.