Switch to use autodie to simplify code.

@oalders suggests in a pull request comment:
> If we use autodie then we won't need to check for success on open().

I've made this change to accommodate that suggestion.
This commit is contained in:
Bradley M. Kuhn 2015-01-02 11:42:10 -05:00
parent c5f62dbdb1
commit 9045d3d511

View file

@ -1,6 +1,8 @@
# -*- mode: cperl -*-
use Test::More;
use strict;
use autodie qw(:all);
if ( !$ENV{WPP_TEST} || !-f $ENV{WPP_TEST} ) {
plan skip_all =>
'No WPP_TEST env var set. Please see README to run tests';
@ -30,8 +32,8 @@ This works, and seems to be correct, albeit odd.
=cut
open(SUBSCRIPTION_PAY_HTML, ">", "subscription-payment.html")
or die "unable to open subscription-payment.html: $!";
open(SUBSCRIPTION_PAY_HTML, ">", "subscription-payment.html");
print SUBSCRIPTION_PAY_HTML <<_SUBSCRIPTION_PAYMENT_DATA_
<html>
<body>
@ -55,7 +57,7 @@ print SUBSCRIPTION_PAY_HTML <<_SUBSCRIPTION_PAYMENT_DATA_
</html>
_SUBSCRIPTION_PAYMENT_DATA_
;
close(SUBSCRIPTION_PAY_HTML); die "unable to write subscription-payment.html: $!" if ($? != 0);
close(SUBSCRIPTION_PAY_HTML);
use Cwd; my $cwd = getcwd;