Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit56a79a5

Browse files
committed
Avoid odd portability problem in TestLib.pm's slurp_file function.
For unclear reasons, this function doesn't always read the expected datain some old Perl versions. Rewriting it to avoid use of ARGV seems tododge the problem, and this version is clearer anyway if you ask me.In passing, also improve error message in adjacent append_to_file function.
1 parent0901d68 commit56a79a5

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

‎src/test/perl/TestLib.pm

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,12 @@ sub slurp_dir
242242

243243
subslurp_file
244244
{
245+
my ($filename) =@_;
245246
local$/;
246-
local@ARGV =@_;
247-
my$contents = <>;
247+
open(my$in,'<',$filename)
248+
ordie"could not read\"$filename\":$!";
249+
my$contents = <$in>;
250+
close$in;
248251
$contents =~s/\r//gif$Config{osname}eq'msys';
249252
return$contents;
250253
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp