1
0
Fork 0
mirror of https://gitlab.alpinelinux.org/alpine/aports.git synced 2025-07-13 11:19:50 +03:00
aports/testing/perl-command-runner/remove-win32-shellquote-dep.patch
Celeste cf5f72e0e5 testing/perl-command-runner: new aport
https://metacpan.org/release/Command-Runner/
Run external commands and Perl code refs

Needed by testing/perl-app-cpm
2023-10-21 08:44:48 +00:00

39 lines
890 B
Diff

Avoid having to add perl-win32-shellquote aport
which won't be used anyway as this isn't Windows
--- a/lib/Command/Runner/Quote.pm
+++ b/lib/Command/Runner/Quote.pm
@@ -2,15 +2,31 @@
use strict;
use warnings;
-use Win32::ShellQuote ();
use String::ShellQuote ();
use Exporter 'import';
our @EXPORT_OK = qw(quote quote_win32 quote_unix);
+sub win32_quote_literal {
+ my ($text, $force) = @_;
+
+ # basic argument quoting. uses backslashes and quotes to escape
+ # everything.
+ if (!$force && $text ne '' && $text !~ /[ \t\n\x0b"]/) {
+ # no quoting needed
+ }
+ else {
+ $text =~ s{(\\*)(?="|\z)}{$1$1}g;
+ $text =~ s{"}{\\"}g;
+ $text = qq{"$text"};
+ }
+
+ return $text;
+}
+
sub quote_win32 {
my $str = shift;
- Win32::ShellQuote::quote_literal($str, 1);
+ win32_quote_literal($str, 1);
}
sub quote_unix {