|
I defined a GET accessor (":Get(first_name)" below) and I then used that accessor with a parameter value. The "first_name" accessor retrieved the old field value and quietly ignored the parameter value, '*** SetValue ***'. No error message was given! This happened with OIO version 3.38, Perl 5.8.8 on Windows.
What is the correct behavior if GET-ONLY accessor are given parameter values?
Thanks, Bill
use strict;
use warnings;
package My_Class; {
use Object::InsideOut ;
my @first_name :Field
:Arg(first_name)
:Get(first_name) #-- Only define a getter, no setter!
:Default('***Default***')
;
} #-- end of package scope.
package main;
my $obj = My_Class->new(first_name => 'Larry');
#-- Note that this SET OPERATION does not give error.
#-- The SET value is silently ignored!
print "1. Object field is: ", $obj->first_name('*** SetValue ***'), "\n";
print "2. Object field is: ", $obj->first_name(), "\n";
print "**** Normal Exit **** \n";
exit;
The output is:
1. Object field is: Larry
2. Object field is: Larry
**** Normal Exit ****
.
|