Thanks boftx!
I am still confused and must go away and do some more reading on Moose because I have taken your suggestion, but still do not get the results I am after. Below is complete code and here the new errors and output:
Use of uninitialized value in concatenation (.) or string at cos_vectors.pm line 83.
Use of uninitialized value in concatenation (.) or string at cos_vectors.pm line 83.
Use of uninitialized value in concatenation (.) or string at cos_vectors.pm line 91.
Use of uninitialized value in concatenation (.) or string at cos_vectors.pm line 87.
Use of uninitialized value in concatenation (.) or string at cos_vectors.pm line 95.
/Codar/SeaSonde/apps/combinetools/combineprocessing/CheckForCombine 0 bonc 1 "" /processings/processing_
What's particularly annoying here is that it appears that one cannot build an attribute that is 'doubly' dependent -- i.e. look at
and notice that it depends on Ddata which in turn depends on Dbase. What's also frustrating that Dsite is not concatenating in
sub _build_Dproc, which is not dependent on another attribute.
Anyhow, thoroughly confused how to get this to work with Moose.
package cos_vectors; use Moose; ###################################################################### +######### # Package Attributes has 'class_ver' => ( is => 'rw', isa => 'Str', default => '10.5.1' ); ###################################################################### +######### # Required Attributes has 'site' => ( is => 'rw', isa => 'Str', required => 1 ); ###################################################################### +######### # Directory Attributes has 'Dbase' => ( is => 'rw', isa => 'Str', default => '/Codar/SeaSonde', predicate => 'has_Dbase' ); has 'Dbin' => ( is => 'rw', isa => 'Str', builder => '_build_Dbin', predicate => 'has_Dbin' ); has 'Detc' => ( is => 'rw', isa => 'Str', builder => '_build_Detc', predicate => 'has_Detc' ); has 'Ddata' => ( is => 'rw', isa => 'Str', builder => '_build_Ddata', predicate => 'has_Ddata' ); has 'Dproc' => ( is => 'rw', isa => 'Str', builder => '_build_Dproc', predicate => 'has_Dproc' ); has 'Ddiag' => ( is => 'rw', isa => 'Str', builder => '_build_Ddiag', predicate => 'has_Ddiag' ); has 'Drad' => ( is => 'rw', isa => 'Str', builder => '_build_Drad', predicate => 'has_Drad' ); has 'Fopt' => ( is => 'rw', isa => 'Str', builder => '_build_Fopt', predicate => 'has_Fopt' ); has 'Fverbose' => ( is => 'rw', isa => 'Str', builder => '_build_Fverbose', predicate => 'has_Fverbose' ); ###################################################################### +######### # Directory Builders sub _build_Dbin { my $self = shift; return $self->{Dbase}.'/apps/combinetools/combineprocessing'; } sub _build_Detc { my $self = shift; return $self->{Dbase}.'/configs/combineconfigs'; } sub _build_Ddata { my $self = shift; return $self->{Dbase}.'/data'; } sub _build_Dproc { my $self = shift; return $self->{Ddata}.'/processings/processing_'.$self->{site}; } sub _build_Ddiag { my $self = shift; return $self->{Ddata}.'/diagnostics'; } sub _build_Drad { my $self = shift; return $self->{Ddata}.'/radialsites'; } sub _build_Fopt { my $self = shift; return $self->{Dbin}.'/combinesite.opt'; } sub _build_Fverbose { my $self = shift; return $self->{Dbin}.'/combineverbocity.txt'; } ###################################################################### +######### # Diagnostic Attributes has 'diagCCS' => ( is => 'rw', isa => 'Str', lazy => 1, builder => '_build_diagCCS', predicate => 'has_diagCCS' ); has 'diagCFR' => ( is => 'rw', isa => 'Str', lazy => 1, builder => '_build_diagCFR', predicate => 'has_diagCFR' ); has 'diagCCG' => ( is => 'rw', isa => 'Str', lazy => 1, builder => '_build_diagCCG', predicate => 'has_diagCCG' ); has 'diagRTC' => ( is => 'rw', isa => 'Str', lazy => 1, builder => '_build_diagRTC', predicate => 'has_diagRTC' ); has 'diagTA' => ( is => 'rw', isa => 'Str', lazy => 1, builder => '_build_diagTA', predicate => 'has_diagTA' ); has 'diagTD' => ( is => 'rw', isa => 'Str', lazy => 1, builder => '_build_diagTD', predicate => 'has_diagTD' ); ###################################################################### +######### # Diagnostic Builders sub _build_diagCCS { my $self = shift; return `$self->{Dbin}/GetParameter $self->{Fverbose} 1 1 0 1`; } sub _build_diagCFR { my $self = shift; return `$self->{Dbin}/GetParameter $self->{Fverbose} 2 1 7 1`; } sub _build_diagCCG { my $self = shift; return `$self->{Dbin}/GetParameter $self->{Fverbose} 3 1 2 1`; } sub _build_diagRTC { my $self = shift; return `$self->{Dbin}/GetParameter $self->{Fverbose} 4 1 2 1`; } sub _build_diagTA { my $self = shift; return `$self->{Dbin}/GetParameter $self->{Fverbose} 5 1 2 1`; } sub _build_diagTD { my $self = shift; return `$self->{Dbin}/GetParameter $self->{Fverbose} 6 1 1 1`; } ###################################################################### +######### # Methods sub clean_Dproc { my $self = shift; unlink $self->{Dproc}.'LLUVToCombine.list'; unlink $self->{Dproc}.'MergeTotalsInfo.ctf'; unlink $self->{Dproc}.'XYUVToCombine.list'; unlink $self->{Dproc}.'TotalProcessed.txt'; unlink $self->{Dproc}.'TotalTime.txt'; unlink $self->{Dproc}.'TotalOutput.txt'; unlink $self->{Dproc}.'Tot_XXXX_00_00_00_0000.tv'; unlink $self->{Dproc}.'TotxXXXX_00_00_00_0000.tv'; } 1;
script
#!/usr/bin/perl use strict; use cos_vectors; my $keepgoing = 1; #infinite loop while ($keepgoing eq 1) { my $vec = cos_vectors->new( site => 'bonc' ); print $vec->site." ".$vec->Fverbose."\n"; $vec->clean_Dproc; my $syscall = sprintf("%s/CheckForCombine 0 %s 1 \"\" %s",$vec->Db +in,$vec->site,$vec->Dproc); print $syscall."\n"; #system("$vec->{Dbin}/CheckForCombine 0 $vec->{site} 1 '' $vec->{D +proc}"); $keepgoing = 0; }
In reply to Re^6: Moose Attribute Default Dependency
by dpath2o
in thread Moose Attribute Default Dependency
by dpath2o
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |