in reply to Re^6: Moose Attribute Default Dependency
in thread Moose Attribute Default Dependency
Hmmm, start by using the attribute methods instead of the attribute elements as I mentioned earlier. On a side note, we need to get you more tools than just a hammer so everything doesn't look like a nail. :)
A double-dependency as you put it is fine, but if you are not using the attribute methods you might well lose the ability to have it work as expected. Again, use $self->Dbase and not $self->{Dbase} (and similarly for Dbin and Ddata.) Start with that change and see what happens. Oh, one more thing I just noticed: you need to use the "lazy" property to take full advantage of a deferred build in the proper sequence.
And maybe consider just what should be an attribute and what can be handled by a simple method call. I'm sure there are those here who would think that much of what you are doing can be done with just a very few attributes and the rest being methods, assuming that you really expect to default most (all?) of the derived directory names from Dbase and not provide values in the constructor. For example:
# instead of this (which should have "lazy" set as well): has 'Dbin' => ( is => 'rw', isa => 'Str', builder => '_build_Dbin', predicate => 'has_Dbin' ); sub _build_Dbin { my $self = shift; return $self->{Dbase}.'/apps/combinetools/combineprocessing'; } # consider this instead if you will never set the value of Dbin # in the constructor. Note the use of $self->Dbase and not $self->{Dba +se}. sub Dbin { my $self = shift; return $self->Dbase.'/apps/combinetools/combineprocessing'; }
|
|---|