Subject: | my @data :Field( 'Standard' => 'data', 'Permission' => 'private'); |
When I try out a simple Object::InsideOut class with only one line (see
subject) I get an error when I try to instantiate the class. The
documentation shows the line from the subject in question but running it
gives a failure while creating an accessor for the class.
Subject: | TryOut.pm |
package TryOut;
{
use strict;
use warnings;
use Object::InsideOut;
my @data :Field( 'Standard' => 'data', 'Permission' => 'private');
sub johan {
my $self = shift;
$self->set(\@data, "johan" );
}
sub get_johan {
my $self = shift;
return $data[ $$self ];
}
}
package TryOutTest;
{
use strict;
use warnings;
use Object::InsideOut qw/TryOut/;
sub foo {
my $self = shift;
return $self->get_johan;
}
}
1;
Subject: | main.pl |
#!/usr/bin/perl
use strict;
use warnings;
use TryOut;
my $obj = TryOut->new();
$obj->johan();
print $obj->get_johan() . "\n";
my $obj2 = TryOutTest->new();
$obj2->johan();
print $obj2->get_johan() . "\n";