[openwrt/openwrt] scripts: xxdi.pl: remove File::Slurp dependency

LEDE Commits lede-commits at lists.infradead.org
Mon Sep 5 23:05:36 PDT 2022


ynezz pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/8b278a76d90e3724815a5fde32be59f7796be1d8

commit 8b278a76d90e3724815a5fde32be59f7796be1d8
Author: Jo-Philipp Wich <jo at mein.io>
AuthorDate: Tue Aug 30 18:20:04 2022 +0200

    scripts: xxdi.pl: remove File::Slurp dependency
    
    In order to make it more portable.
    
    Signed-off-by: Jo-Philipp Wich <jo at mein.io>
    Signed-off-by: Petr Štetiar <ynezz at true.cz>
---
 scripts/xxdi.pl | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/scripts/xxdi.pl b/scripts/xxdi.pl
index acc974c4b3..1f960902be 100755
--- a/scripts/xxdi.pl
+++ b/scripts/xxdi.pl
@@ -14,9 +14,24 @@
 
 use strict;
 use warnings;
-use File::Slurp qw(slurp);
 
-my $indata = slurp(@ARGV ? $ARGV[0] : \*STDIN);
+my $indata;
+
+{
+	local $/;
+	my $fh;
+
+	if (@ARGV) {
+		open($fh, '<:raw', $ARGV[0]) || die("Unable to open $ARGV[0]: $!\n");
+	} else {
+		$fh = \*STDIN;
+	}
+
+	$indata = readline $fh;
+
+	close $fh;
+}
+
 my $len_data = length($indata);
 my $num_digits_per_line = 12;
 my $var_name;




More information about the lede-commits mailing list