http://www.perlmonks.org?node_id=1155657

neilwatson has asked for the wisdom of the Perl Monks concerning the following question:

Greetings Avout,

Why am I getting this error:

#!/usr/bin/perl use strict; use warnings; my $person = My::Person->new( 'neil', 'watson' ); print 'Name is', $person->given_name(); package My::Person; use strict; use warnings; use Class::InsideOut qw[public readonly private register id]; # declare the attributes readonly given_name => my %given_name; readonly surname => my %surname; # object constructor sub new { my $self = shift; register( $self ); $given_name{ id $self } = shift; $surname { id $self } = shift; } 1; $ ./indsideout.pl Use of uninitialized value in hash element at ./indsideout.pl line 23. Use of uninitialized value in hash element at ./indsideout.pl line 24. Can't locate object method "given_name" via package "watson" (perhaps +you forgot to load "watson"?) at ./indsideout.pl line 7.

Neil Watson
watson-wilson.ca