>>>>> "Dermot" == Dermot  <paik...@googlemail.com> writes:

Dermot> I have a parent class and I want it to contain some configuration
Dermot> information. I'm using AppConfig and that returns configuration as
Dermot> instance. But when I try and access data from the configuration, such
Dermot> as `print $self->config->media_root`, I am getting "unblessed
Dermot> reference" errors.

I'm using stuff like this:

use MooseX::Declare;

has config => (is => 'rw', lazy_build => 1);
method _build_config {
  require Non::Moose::Class::Config;
  return Non::Moose::Class::Config->new($self->thingA, $self->thingB);
}

That way, by the time I refer to config, hopefully $self is sane and
I can use parts of it to create my non-moose attribute.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<mer...@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion

Reply via email to