I went away and now I'm back ...
I read up on predicate, clearer and trigger attribute options and have revised the code. Though it bombs with the following error:
Can't call method "Dbase" on an undefined value at pizzle.pm line 29.
Compilation failed in require at test_pizzle.pl line 4.
Let me know if you have any further comments, before I begin to start to hit head here
XXXXXXXXXXXX
XXXXXXXXXXXX
XXXXXXXXXXXX
XXXXXXXXXXXX
XXXXXXXXXXXX
XXXXXXXXXXXX
package pizzle; use Moose; my $self; # 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 => '/willy/wonka', lazy => 1, predicate => 'has_Dbase' ); has 'Dbin' => ( is => 'rw', isa => 'Str', default => $self->{Dbase}.'/come/on/now', lazy => 1, predicate => 'has_Dbin' );
More directory attributes ...
# 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' );
More diagnostic attributes ...
# 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`; }
More diagnostic builders ...
# Methods sub CleanDproc { 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;
End of pizzle.pm
Then test_pizzle.pl
#!/usr/bin/perl use strict; use pizzle; my $keepgoing = 1; #infinite loop while ($keepgoing eq 1) { my $piz = pizzle->new( site => 'binky' ); $piz->DiagCCS; $piz->DiagCCG; if ($piz->DiagCCS) { $keepgoing = 0; } }
In reply to Re^4: Moose Attribute Default Dependency
by dpath2o
in thread Moose Attribute Default Dependency
by dpath2o
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |