Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Escape special chars in a path

by choroba (Cardinal)
on Aug 17, 2022 at 18:25 UTC ( [id://11146198]=note: print w/replies, xml ) Need Help??


in reply to Escape special chars in a path

There's String::ShellQuote on CPAN.

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

Replies are listed 'Best First'.
Re^2: Escape special chars in a path
by afoken (Chancellor) on Aug 18, 2022 at 13:51 UTC
    There's String::ShellQuote on CPAN.

    A name that promises much more than the module actually implements. With a good amount of luck, it may work for this very specific problem ("My Perl utility generates a bash script that consists of mkdir/rsync/cp commands. This bash script is later used by users [...]"). After all, bash should be a bourne-compatible shell. But don't assume that module can do everything its name promises.

    Quoting myself:

    The last two times I looked at String::ShellQuote (Re^2: Passing values from Perl script to shell script in 2009 and Re^4: quoting/escaping file names in 2014), it did not look good. The last change is from 2010. So, String::ShellQuote still has the same problems as in 2009 [...]: It works just for some unnamed version of some unnamed bourne shell. The author wanted to add more shells, but he did not since 2005. The test.t look very strange, especially I don't see any reasonable test for passing arguments via a shell. So, it's old, unmaintained, not well-tested, and broken for all shells except for that unspecified bourne shell.

    See also:

    Update:

    I had a closer look at the source code and did some tests: Problems with String::ShellQuote

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11146198]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2024-04-25 09:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found