use autodie to simplify code for open & $? == 0

This commit is contained in:
Bradley M. Kuhn 2015-01-02 12:50:57 -05:00
parent 6be85a448e
commit 6c544426dd

View file

@ -2,7 +2,9 @@
# -*- mode: cperl -*- # -*- mode: cperl -*-
use Test::More; use Test::More;
use strict; use strict;
use autodie qw(:all);
use Cwd; use Cwd;
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';
@ -26,9 +28,7 @@ These tests verify the options work.
=cut =cut
open(OPTIONS_PAY_HTML, ">", "options-payment.html");
open(OPTIONS_PAY_HTML, ">", "options-payment.html")
or die "unable to open options-payment.html: $!";
print OPTIONS_PAY_HTML <<_OPTIONS_PAYMENT_DATA_ print OPTIONS_PAY_HTML <<_OPTIONS_PAYMENT_DATA_
<html> <html>
<body> <body>
@ -46,7 +46,7 @@ print OPTIONS_PAY_HTML <<_OPTIONS_PAYMENT_DATA_
</form></body></html> </form></body></html>
_OPTIONS_PAYMENT_DATA_ _OPTIONS_PAYMENT_DATA_
; ;
close(OPTIONS_PAY_HTML); die "unable to write options-payment.html: $!" if ($? != 0); close(OPTIONS_PAY_HTML);
my $cwd = getcwd; my $cwd = getcwd;