perl: || die -> or die

Usage was fifty-fifty between these syntaxes before this patch.

Closes #22036
This commit is contained in:
Viktor Szakats 2026-06-15 01:26:04 +02:00
parent 5d1ac48088
commit 678e63934c
No known key found for this signature in database
29 changed files with 69 additions and 69 deletions

View file

@ -30,7 +30,7 @@ use warnings;
sub convert {
my ($dir) = @_;
opendir(my $dh, $dir) || die "could not open $dir";
opendir(my $dh, $dir) or die "could not open $dir";
my @cd = grep { /\.md\z/ && -f "$dir/$_" } readdir($dh);
closedir $dh;

View file

@ -13,7 +13,7 @@ use Cwd 'abs_path';
my @files;
my $is_git = 0;
if(system('git rev-parse --is-inside-work-tree >/dev/null 2>&1') == 0) {
open(O, '-|', 'git', 'ls-files', '*.[ch]') || die; push @files, <O>; close(O);
open(O, '-|', 'git', 'ls-files', '*.[ch]') or die; push @files, <O>; close(O);
$is_git = 1;
}
else {
@ -34,7 +34,7 @@ my $anyfailed = 0;
for my $dir (@dirs) {
if($is_git) {
@files = ();
open(O, '-|', 'git', 'ls-files', ":(glob)$dir/*.[ch]") || die; push @files, <O>; close(O);
open(O, '-|', 'git', 'ls-files', ":(glob)$dir/*.[ch]") or die; push @files, <O>; close(O);
chomp(@files);
}
else {

View file

@ -541,7 +541,7 @@ sub scanfile {
printf "Checking file: $file\n";
}
open(my $R, '<', $file) || die "failed to open $file";
open(my $R, '<', $file) or die "failed to open $file";
my $incomment = 0;
my @copyright = ();

View file

@ -80,21 +80,21 @@ sub parse_main_opts {
my (@files, @list);
my ($dir_handle, $file_content);
opendir($dir_handle, $opts_dir) || die "Unable to open dir: $opts_dir due to error: $!";
opendir($dir_handle, $opts_dir) or die "Unable to open dir: $opts_dir due to error: $!";
@files = readdir($dir_handle);
closedir($dir_handle) || die "Unable to close handle on dir: $opts_dir due to error: $!";
closedir($dir_handle) or die "Unable to close handle on dir: $opts_dir due to error: $!";
# We want regular files that end with .md and do not start with an underscore
# Edge case: MANPAGE.md does not start with an underscore but also is not documentation for an option
@files = grep { $_ =~ /\.md$/i && !/^_/ && -f "$opts_dir/$_" && $_ ne "MANPAGE.md" } @files;
for my $file (@files) {
open(my $doc_handle, '<', "$opts_dir/$file") || die "Unable to open file: $file due to error: $!";
open(my $doc_handle, '<', "$opts_dir/$file") or die "Unable to open file: $file due to error: $!";
$file_content = join('', <$doc_handle>);
close($doc_handle) || die "Unable to close file: $file due to error: $!";
close($doc_handle) or die "Unable to close file: $file due to error: $!";
# Extract the curldown header section demarcated by ---
$file_content =~ /^---\s*\n(.*?)\n---\s*\n/s || die "Unable to parse file $file";
$file_content =~ /^---\s*\n(.*?)\n---\s*\n/s or die "Unable to parse file $file";
$file_content = $1;
my ($short, $long, $arg, $desc);

View file

@ -35,7 +35,7 @@ my $error;
sub scanfile {
my ($file) = @_;
open(F, "<$file") || die "$file failed";
open(F, "<$file") or die "$file failed";
my $unit = 0;
my $line = 0;
my $unitref = 0;

View file

@ -1365,7 +1365,7 @@ if($ENV{'CURL_MAKETGZ_VERSION'}) {
$version = $ENV{'CURL_MAKETGZ_VERSION'};
}
else {
open(INC, "<$include/curl/curlver.h") || die "no $include/curl/curlver.h";
open(INC, "<$include/curl/curlver.h") or die "no $include/curl/curlver.h";
while(<INC>) {
if($_ =~ /^#define LIBCURL_VERSION \"([0-9.]*)/) {
$version = $1;

View file

@ -182,7 +182,7 @@ sub doublecheck {
return @also;
}
open(N, '-|', 'nm', $file) || die;
open(N, '-|', 'nm', $file) or die;
my %exist;
my %uses;