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 -*- # -*- mode: cperl -*-
use Test::More; use Test::More;
use strict; use strict;
use autodie qw(:all);
if ( !$ENV{WPP_TEST} || !-f $ENV{WPP_TEST} ) { if ( !$ENV{WPP_TEST} || !-f $ENV{WPP_TEST} ) {
plan skip_all => plan skip_all =>
'No WPP_TEST env var set. Please see README to run tests'; '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 =cut
open(SUBSCRIPTION_PAY_HTML, ">", "subscription-payment.html") open(SUBSCRIPTION_PAY_HTML, ">", "subscription-payment.html");
or die "unable to open subscription-payment.html: $!";
print SUBSCRIPTION_PAY_HTML <<_SUBSCRIPTION_PAYMENT_DATA_ print SUBSCRIPTION_PAY_HTML <<_SUBSCRIPTION_PAYMENT_DATA_
<html> <html>
<body> <body>
@ -55,7 +57,7 @@ print SUBSCRIPTION_PAY_HTML <<_SUBSCRIPTION_PAYMENT_DATA_
</html> </html>
_SUBSCRIPTION_PAYMENT_DATA_ _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; use Cwd; my $cwd = getcwd;