Object-InsideOut - When are Getters defined?

Posted on Thu Feb 2 23:41:16 2006 by earl
When are Getters defined?

I'm curious; I want to understand when the Getter is defined. I'm using Object::InsideOut v1.33.

This is Foo.pm.
package Foo; use Object::InsideOut; my %goo :Field('Get' => 'get_goo'); warn(defined(&Foo::get_goo) ? 'yes' : 'no'); 1;

I define a subroutine called Foo::get_goo and I check to make sure it is defined.

And this is the main script

#!/usr/bin/perl -w use Foo; warn(defined(&Foo::get_goo) ? 'yes' : 'no'); print "hello.\n";

Here, I check again to make sure Foo::get_goo is defined. When I run this script I get ...

perl test17.pl no at Foo.pm line 6. yes at test17.pl line 4. hello.
Why isn't Foo::get_goo defined within the Foo package? Earl
Direct Responses: 1752 | Write a response