Skip to content

Commit c6738c4

Browse files
committed
Time::HiRes tests: remove bareword filehandles and '1;'
Bareword filehandles have been obsolete since 2000. There is no point in adding '1;' to scripts; only modules have return values.
1 parent aaaa854 commit c6738c4

File tree

11 files changed

+15
-35
lines changed

11 files changed

+15
-35
lines changed

dist/Time-HiRes/t/alarm.t

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ use Config;
1111
my $limit = 0.25; # 25% is acceptable slosh for testing timers
1212

1313
my $xdefine = '';
14-
if (open(XDEFINE, "<", "xdefine")) {
15-
chomp($xdefine = <XDEFINE> || "");
16-
close(XDEFINE);
14+
if (open(my $fh, "<", "xdefine")) {
15+
chomp($xdefine = <$fh> || "");
16+
close($fh);
1717
}
1818

1919
my $can_subsecond_alarm =
@@ -224,5 +224,3 @@ SKIP: {
224224
ok $got == 0 or print("# $got\n");
225225
}
226226
}
227-
228-
1;

dist/Time-HiRes/t/clock.t

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,5 +97,3 @@ SKIP: {
9797
$clock[2] > $clock[1] &&
9898
$clock[3] > $clock[2];
9999
}
100-
101-
1;

dist/Time-HiRes/t/gettimeofday.t

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,3 @@ ok $f - $two[0] < 2 or print("# $f - $two[0] >= 2\n");
3030
my $r = [Time::HiRes::gettimeofday()];
3131
my $g = Time::HiRes::tv_interval $r;
3232
ok $g < 2 or print("# $g\n");
33-
34-
1;

dist/Time-HiRes/t/itimer.t

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,5 +66,3 @@ print("# at end, i=$i\n");
6666
is($virt, 0, "time left should be zero");
6767

6868
$SIG{VTALRM} = 'DEFAULT';
69-
70-
1;

dist/Time-HiRes/t/nanosleep.t

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,3 @@ SKIP: {
3434
skip "flapping test - more than 0.9 sec could be necessary...", 1 if $ENV{CI};
3535
cmp_ok $d, '<', 0.9 or diag("# slept $d secs $f to $f2\n");
3636
}
37-
38-
1;

dist/Time-HiRes/t/sleep.t

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ SKIP: {
1515
}
1616

1717
my $xdefine = '';
18-
if (open(XDEFINE, "<", "xdefine")) {
19-
chomp($xdefine = <XDEFINE> || "");
20-
close(XDEFINE);
18+
if (open(my $fh, "<", "xdefine")) {
19+
chomp($xdefine = <$fh> || "");
20+
close($fh);
2121
}
2222

2323
my $can_subsecond_alarm =

dist/Time-HiRes/t/stat.t

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ my @mtime;
2222
for (1..5) {
2323
note "cycle $_";
2424
Time::HiRes::sleep(rand(0.1) + 0.1);
25-
open(X, '>', $$);
26-
print X $$;
27-
close(X);
25+
open(my $fh, '>', $$);
26+
print $fh $$;
27+
close($fh);
2828
my($a, $stat, $b) = ("a", [Time::HiRes::stat($$)], "b");
2929
is $a, "a", "stat stack discipline";
3030
is $b, "b", "stat stack discipline";
@@ -43,9 +43,9 @@ for (1..5) {
4343
}
4444
is_deeply $lstat, $stat, "write: stat and lstat returned same values";
4545
Time::HiRes::sleep(rand(0.1) + 0.1);
46-
open(X, '<', $$);
47-
<X>;
48-
close(X);
46+
open(my $fh, '<', $$);
47+
<$fh>;
48+
close($fh);
4949
$stat = [Time::HiRes::stat($$)];
5050
push @atime, $stat->[8];
5151
$lstat = [Time::HiRes::lstat($$)];
@@ -88,9 +88,9 @@ SKIP: {
8888
my $targetname = "tgt$$";
8989
my $linkname = "link$$";
9090
SKIP: {
91-
open(X, '>', $targetname);
92-
print X $$;
93-
close(X);
91+
open(my $fh, '>', $targetname);
92+
print $fh $$;
93+
close($fh);
9494
eval { symlink $targetname, $linkname or die "can't symlink: $!"; };
9595
skip "can't symlink", 7 if $@ ne "";
9696
note "compare Time::HiRes::stat with ::lstat";
@@ -111,5 +111,3 @@ SKIP: {
111111
}
112112
1 while unlink $linkname;
113113
1 while unlink $targetname;
114-
115-
1;

dist/Time-HiRes/t/tv_interval.t

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,3 @@ BEGIN { require_ok "Time::HiRes"; }
66

77
my $f = Time::HiRes::tv_interval [5, 100_000], [10, 500_000];
88
ok abs($f - 5.4) < 0.001 or print("# $f\n");
9-
10-
1;

dist/Time-HiRes/t/ualarm.t

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,5 +109,3 @@ for my $n (100_000, 1_100_000, 2_200_000, 4_300_000) {
109109
my $got2 = Time::HiRes::ualarm(0);
110110
ok $got2 == 0 or print("# $got2\n");
111111
}
112-
113-
1;

dist/Time-HiRes/t/usleep.t

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,5 +75,3 @@ SKIP: {
7575
ok $a < $limit or print("# $msg\n");
7676
}
7777
}
78-
79-
1;

0 commit comments

Comments
 (0)