AWS-CLIWrapper

 view release on metacpan or  search on metacpan

t/bin/mock-aws  view on Meta::CPAN


sub handle_die_with_error {
  my $counter_file = $ENV{AWS_CLIWRAPPER_TEST_ERROR_COUNTER_FILE};

  return unless -f $counter_file;

  open my $fh, "<", $counter_file or die "Cannot open $counter_file for read: $!";
  my $counter = <$fh>;
  close $fh;

  # This logic is the opposite of usual retries: we throw an error for the counter
  # number of times and then proceed normally after.
  if ($counter-- > 0) {
    open $fh, ">", $counter_file or die "Cannot open $counter_file for write: $!";
    print $fh $counter;
    close $fh;

    die $ENV{AWS_CLIWRAPPER_TEST_DIE_WITH_ERROR};
  }
}



( run in 0.340 second using v1.01-cache-2.11-cpan-496ff517765 )