Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Quotemeta is safe under these assumptions:</p> <ol> <li>Only non-alphanumeric characters have a special meaning.</li> <li>If a non-alphanumeric character has a special meaning, putting a backslash in front of it will always make it non-special.</li> <li>If a non-alphanumeric character doesn't have a special meaning, putting a backslash in front of it will do nothing.</li> </ol> <p>The shell violates rules 2 and 3 no matter what quote context you use -- outside of quotes, backslash-newline doesn't generate newline; in double-quotes, backslash-punctuation puts a backslash into the output (outside of a certain list of punctuation); and in single-quotes, everything is literal and backslash doesn't even protect you against a closing single-quote.</p> <p>I still recommend <code>String::ShellQuote</code> if you need to quote things for the shell. I also recommend avoiding letting the shell process your filenames entirely, if you can, by using <code>LIST</code>-form <code>system</code>/<code>exec</code>/<code>open</code> or <a href="http://search.cpan.org/perldoc/IPC::Open2" rel="noreferrer">IPC::Open2</a>, <a href="http://search.cpan.org/perldoc/IPC::Open3" rel="noreferrer">IPC::Open3</a>, or <a href="http://search.cpan.org/perldoc/IPC::System::Simple" rel="noreferrer">IPC::System::Simple</a>.</p> <p>As for things besides the shell... lots of different things violate one or more of the rules. For example, obsolete POSIX "basic" regexes and various kinds of editor regexes have punctuation characters that are non-special by default, but <em>become special</em> when preceded by backslash. Basically what I'm saying is, know the thing that you're feeding your data to very well, and escape properly. Only use <code>quotemeta</code> if it's an exact fit, or if you're using it for something that's not very important.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload