Jay Savage wrote:
On 10/31/07, Tom Phoenix <[EMAIL PROTECTED]> wrote:
On 10/31/07, Jay Savage <[EMAIL PROTECTED]> wrote:
Take another look at the Net::SFTP docs, particularly the note about
what get() does when called in a void context.
I see a note about a non-void context, but I don't see one about a
void context. The OP didn't use the get() method in a void context.
Did you mean to write "non-void"?
http://search.cpan.org/~dbrobins/Net-SFTP-0.10/lib/Net/SFTP.pm
As I interpret the docs, the OP's code should be correct. But maybe
I'm missing something.
I suppose I should have said non-void, because that is the behavior
the doc actually describes.
The assumption, though, is that void context will yeild the opposite
result. And it looks to me like OP is calling $sftp->get() in a void
context:
$sftp->get( $file, $localFile ) || warn("errrrr0rrrrr_--->
$!".$sftp->status."\n");
At least I'm not aware that that '||' forces any particular context on
the lefthand operand. Perlop mentions propagating context WRT the
righthand operand, but doesn't say anything about the left. So I would
expect get() to return the same in the following cases:
$sftp->get( $file, $localFile);
$sftp->get( $file, $localFile), print "something";
$sftp->get( $file, $localFile ) || die();
Given that, I would expect, from the docs, for get() to return the
empty string on success and undef on failure, both of which are
equally false from the perspective of '||'.
Or maybe *I'm* missing something?
perl -e "@x=(1,2,3); print @x || 99;"
Rob
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/