in reply to (Moose/Hash): Can't call method "kv" on unblessed reference
Unfortunately... no dice. Using the copied example-code, as shown above with the change you suggested:
Can't call method "option_pairs" on unblessed reference at foo.pl line 19.
I’m afraid that this does not look to be “just an obvious tpyo.” Something about this doesn’t work, and I sincerely don’t know why.
The perldoc makes no mention of, say, Perl-version dependencies, and I see no bug-reports that seem to be relevant.
For completeness, the code being discussed now reads:
package Stuff; use Moose; has 'options' => ( traits => ['Hash'], is => 'ro', isa => 'HashRef[Str]', default => sub { {} }, handles => { set_option => 'set', get_option => 'get', has_no_options => 'is_empty', num_options => 'count', delete_option => 'delete', option_pairs => 'kv', }, ); my $object=Stuff->new(); for my $pair ( $object->options->option_pairs ) { print "$pair->[0] = $pair->[1]\n"; }