Skip Menu |
 

This queue is for tickets about the Socket CPAN distribution.

Report information
The Basics
Id: 132846
Status: patched
Priority: 0/
Queue: Socket

People
Owner: Nobody in particular
Requestors: nicolas [...] atoomic.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 2.029
Fixed in: (no value)

Attachments
0001-Enforce-strict-warnings-on-unit-tests.patch



Subject: Enforce strict/warnings on unit tests
Download (untitled) / with headers
text/plain 196b
view attached patch you can also view the PR online at: https://github.com/atoomic/perl-Socket/pull/2 CI run output available here: https://github.com/atoomic/perl-Socket/actions/runs/141145196
Subject: 0001-Enforce-strict-warnings-on-unit-tests.patch
From b99b7d54376f3d99ddd2006bad966ed9d7e7533d Mon Sep 17 00:00:00 2001 From: Nicolas R <nicolas@atoomic.org> Date: Fri, 19 Jun 2020 11:38:52 -0600 Subject: [PATCH] Enforce strict/warnings on unit tests --- t/Socket.t | 15 +++++++++++---- t/socketpair.t | 4 ++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/t/Socket.t b/t/Socket.t index a73f6d4..03483ee 100644 --- a/t/Socket.t +++ b/t/Socket.t @@ -1,5 +1,10 @@ #!./perl +use strict; +use warnings; + +our %Config; +my $has_alarm; BEGIN { require Config; import Config; if ($Config{'extensions'} !~ /\bSocket\b/ && @@ -13,8 +18,8 @@ BEGIN { use Socket qw(:all); use Test::More tests => 6; -$has_echo = $^O ne 'MSWin32'; -$alarmed = 0; +my $has_echo = $^O ne 'MSWin32'; +my $alarmed = 0; sub arm { $alarmed = 0; alarm(shift) if $has_alarm } sub alarmed { $alarmed = 1 } $SIG{ALRM} = 'alarmed' if $has_alarm; @@ -48,7 +53,8 @@ SKIP: { arm(0); arm(5); - $read = sysread(T,$buff,10); # Connection may be granted, then closed! + my $buff; + my $read = sysread(T,$buff,10); # Connection may be granted, then closed! arm(0); while ($read > 0 && length($buff) < 5) { @@ -87,7 +93,8 @@ SKIP: { arm(0); arm(5); - $read = sysread(S,$buff,10); # Connection may be granted, then closed! + my $buff; + my $read = sysread(S,$buff,10); # Connection may be granted, then closed! arm(0); while ($read > 0 && length($buff) < 5) { diff --git a/t/socketpair.t b/t/socketpair.t index cb11e26..2bad360 100644 --- a/t/socketpair.t +++ b/t/socketpair.t @@ -1,9 +1,13 @@ #!./perl -w +use strict; +use warnings; + my $child; my $can_fork; my $has_perlio; +our %Config; BEGIN { require Config; import Config; $can_fork = $Config{'d_fork'} || $Config{'d_pseudofork'}; -- 2.24.3 (Apple Git-128)
Download (untitled) / with headers
text/plain 182b
Looks good. Though I think I will additionally take the step to "use v5" everywhere, in defence of a possible upcoming Perl 7 which will for some reason require it. -- Paul Evans


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.