in reply to trying to get Net::SFTP::Foreign to work
G'day misterperl,
my $ftph; eval { $ftph = Net::SFTP::Foreign( "$user\@$host", more=>'-v', autodie=>0 ); };
That appears to have a number of problems:
After reading Net::SFTP::Foreign, I'm pretty sure you want something more like this:
my $ftph = Net::SFTP::Foreign::->new($host, user => $user, ...);
Alternatively, you could collect arguments into a hash, perhaps based on user options, and then supply that hash as the sole argument to new(). Something like this:
my %args = (host => $host, user => $user); push @{$args{more}}, '-v' if $opt_verbose; $args{autodie} = $opt_autodie; my $ftph = Net::SFTP::Foreign::->new(%args);
If you're wondering why I appended :: to Net::SFTP::Foreign, read "perlobj: Invoking Class Methods".
— Ken
|
|---|