# from Eric Wilhelm # on Saturday 27 September 2008: ># from David E. Wheeler ># on Saturday 27 September 2008 22:36: >>> my $x = do { no strict 'refs'; $self->{properties} }; >>> return $x->{$property} unless @_; >> >>Oh, big time. But that was how I got the tests to pass. I have no idea >>why properties need to work in a class context.
Right. So that's part of why I like many small patches. Something like that makes the test pass, but it usually points to a bigger problem. >I think it needs to just go with "no strict 'refs'" in each of those >blocks (with a comment mentioning "class method"!) and then we'll >triage the symbolic ref issue in another go. Well, it appears that they only ever get called as $class->quiet() and $class->get_options(), both of which are our own fault. As for the rest of the world... We'll have to see what we discover during the alpha run and perhaps we'll find some stale copy+pasted methods there, but for now (I think perhaps a release or two) I think the thing to do is to carp() and return undef. In the long run, it should either croak() or do something useful. That is, If I'm reading this correctly, anybody using $class->foo('bar') as a setter is not going to get 'bar' back in $class->new->foo() anyway (because it went in $Module::Build{foo} = 'bar' - which is afaict not referenced during object construction), so it seems safe to "break this unexpected behavior". As for the rest of your patch David, would you mind porting it forward to fit this refactor? I think the API you'll want is basically like: _make_accessor($property, %opts). --Eric -- Speak softly and carry a big carrot. --------------------------------------------------- http://scratchcomputing.com ---------------------------------------------------