I wanted to build an awesome place for people to discuss module specific issues, but I don't have any more time for this, and there are much better places to discuss Perl-related issues. I'd recommend asking your question on Stack Overflow or on Perl Monks.
If you are looking for a Perl tutorial or Perl-related news, I hope these links will serve you well.
Posted on 2006-02-02 21:41:16-08 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