Unfortunately, I don't have a system where I can test at the moment, but here are some things I'd try:
- Split the command into a list, e.g. my @cmd = ('C:/Windows/System32/OpenSSH/scp', $src_file, 'vinothg@'.$server.':'.$target_path );
- Use either IPC::System::Simple's capturex (comes preinstalled with Strawberry Perl), as in: use IPC::System::Simple qw/capturex/; my $output = capturex(@cmd);
- Or, use Win32::ShellQuote's quote_system_string, as in: use Win32::ShellQuote qw/quote_system_string/; my $cmd = quote_system_string(@cmd); my $output = qx/$cmd/;
- In terms of error handling, the only case that indicates success is when $? is zero, so you shouldn't be checking $status the way you are, you should be checking if ( $? != 0 ). Update: Note that an advantage of IPC::System::Simple is that it does the error handling for you.
- Although I don't think this is the issue, try saying scp.exe instead of just scp. Also, do try backslashes in the command one more time, as in my @cmd = ('C:\\Windows\\System32\\OpenSSH\\scp.exe', ...
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|