From 9045d3d5115da7353027a334c6fb9d79d1ff4585 Mon Sep 17 00:00:00 2001 From: "Bradley M. Kuhn" Date: Fri, 2 Jan 2015 11:42:10 -0500 Subject: [PATCH] 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. --- t/SubscriptionPayments.t | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/t/SubscriptionPayments.t b/t/SubscriptionPayments.t index 91cff12..2a197bd 100644 --- a/t/SubscriptionPayments.t +++ b/t/SubscriptionPayments.t @@ -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_ @@ -55,7 +57,7 @@ print SUBSCRIPTION_PAY_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;