lib/javonet-ruby-sdk/Binaries/Perl/Linux/X64/deps/lib/perl5/ExtUtils/Helpers/Unix.pm in javonet-ruby-sdk-2.4.4 vs lib/javonet-ruby-sdk/Binaries/Perl/Linux/X64/deps/lib/perl5/ExtUtils/Helpers/Unix.pm in javonet-ruby-sdk-2.4.5
- old
+ new
@@ -1,15 +1,16 @@
package ExtUtils::Helpers::Unix;
-$ExtUtils::Helpers::Unix::VERSION = '0.026';
+$ExtUtils::Helpers::Unix::VERSION = '0.027';
use strict;
use warnings FATAL => 'all';
use Exporter 5.57 'import';
-our @EXPORT = qw/make_executable detildefy/;
+our @EXPORT = qw/make_executable split_like_shell detildefy/;
use Carp qw/croak/;
use Config;
+use Text::ParseWords 3.24 qw/shellwords/;
my $layer = $] >= 5.008001 ? ":raw" : "";
sub make_executable {
my $filename = shift;
@@ -28,10 +29,20 @@
}
chmod $current_mode | oct(111), $filename;
return;
}
+sub split_like_shell {
+ my ($string) = @_;
+
+ return if not defined $string;
+ $string =~ s/^\s+|\s+$//g;
+ return if not length $string;
+
+ return shellwords($string);
+}
+
sub detildefy {
my $value = shift;
# tilde with optional username
for ($value) {
s{ ^ ~ (?= /|$)} [ $ENV{HOME} || (getpwuid $>)[7] ]ex or # tilde without user name
@@ -54,10 +65,10 @@
ExtUtils::Helpers::Unix - Unix specific helper bits
=head1 VERSION
-version 0.026
+version 0.027
=for Pod::Coverage make_executable
split_like_shell
detildefy