Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^2: Net::OpenSSH quoting problems

by jhuijsing (Acolyte)
on May 13, 2014 at 05:53 UTC ( [id://1085865]=note: print w/replies, xml ) Need Help??


in reply to Re: Net::OpenSSH quoting problems
in thread Net::OpenSSH quoting problems

That doesn't work
#with the debug flag set $Net::OpenSSH::debug |= 16; $object =~ s/( \d+-\d+)/\\$1/g; $cmd = qq|blah blah $object blah blah|; ( $output, $errput ) = $ssh->capture2( $cmd ) or $logger->logdie( "bad".$ssh->error ); using the debugger x $object item 0-7 0-9 after substitution x $object item \\ 0-7\\ 0-9' # lot of stuff removed the #open_ex ...... 'blah blah item\\ 0-7\\ 0-9
It sending a \\ not "item\ 0-7\ 0-9"

Replies are listed 'Best First'.
Re^3: Net::OpenSSH quoting problems
by Laurent_R (Canon) on May 13, 2014 at 07:44 UTC
    This works for me:
    DB<5> $object = "2-4 5-12" DB<6> $object =~ s/([-\d]+)/\\$1/g DB<7> p $object \2-4 \5-12
    Or you could store the backslash in a variable and use that variable:
    DB<11> $c = '\\'; DB<12> p $c \ DB<13> $object = "2-4 5-12" DB<14> $object =~ s/([-\d]+)/$c$1/g; DB<15> p $object \2-4 \5-12
Re^3: Net::OpenSSH quoting problems
by soonix (Canon) on May 13, 2014 at 13:08 UTC
      Ok so when I use p to look the variable it look correct But, it still not right when I look at the debug from NET::OPENssh The string being sent still has the double \\ and the appliance reject this and I get an error
        Set $Net::OpenSSH::debug = -1 in order to see what is the module actually sending to the remote host.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2024-04-23 17:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found