in reply to While Loop in Before Modifier Gives Error

It's got nothing to with while or with Moose. _wafer_parse is clobbering its caller's $_. Don't assign to a global variable without localising it first.
sub _wafer_parse { my $self = shift; open my $FILE, "<", $self->{file}; local *_; while ( <$FILE> ) { ... } }

Better yet, don't assign to global variables.

sub _wafer_parse { my $self = shift; open my $FILE, "<", $self->{file}; while ( my $line = <$FILE> ) { ... } }

Replies are listed 'Best First'.
Re^2: While Loop in Before Modifier Gives Error
by ~~David~~ (Hermit) on Jun 24, 2009 at 21:33 UTC
    Thank you very much. That solved my problem.