On May 14, 2008, at 20:25, Robert Hicks wrote:

just "bad" pseudo code:

sub one {
$process->name(\$html) || $errors_from_one( $process->error() );

$process->name(\$text) || $errors_from_one( $process->error() );
}

sub errors_from_one {
  my $error = @_;

  push (my @errors, $error);

  # do stuff to make sure the errors are uniq

  return my @uniq_error_list;
}


I want to be able to get at those errors later. Will something like that work?

Robert

You may be better off creating a set of objects to handle this, but here is a lightweight solution:

{ #limit visibility of @queue to these two functions
my @queue;
sub save_errors { push @queue, @_; }
sub handle_errors {
   for my $error (@queue) {
       #do something
   }
}
}

sub one {
   $process->name(\$html) or save_errors($process->error);
   $process->name(\$text) or save_errors($process->error);
}

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to