in reply to Moose: I want builder method to run every time I call an attribute
Don't make it an attribute:
sub cmd_logfile { my $self = shift; my $inner = $self->dl_inner_dir; defined $inner or die "Error: DL_ +INNER_DIR not set."; my $b4_ext = "$inner/transfer"; my $ext = "log"; my $filename = "$b4_ext.$ext"; my $i = 2; while (-s $filename) { $filename = "$b4_ext-$i.$ext"; $i++; } return $filename; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Moose: I want builder method to run every time I call an attribute
by boftx (Deacon) on Sep 26, 2013 at 23:08 UTC | |
by tye (Sage) on Sep 27, 2013 at 01:14 UTC | |
by boftx (Deacon) on Sep 27, 2013 at 04:47 UTC | |
by tye (Sage) on Sep 27, 2013 at 06:04 UTC | |
by davido (Cardinal) on Sep 27, 2013 at 06:23 UTC | |
| |
by italdesign (Novice) on Sep 27, 2013 at 14:14 UTC | |
by Anonymous Monk on Sep 27, 2013 at 07:42 UTC |