Skip Menu |

This queue is for tickets about the Net-xFTP CPAN distribution.

Report information
The Basics
Id: 58915
Status: resolved
Priority: 0/
Queue: Net-xFTP

People
Owner: turnerjw784 [...] yahoo.com
Requestors: Paul.Findlay [...] fonterra.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Problem passing arguments to backends
Date: Tue, 29 Jun 2010 11:12:37 +1200
To: <bug-Net-xFTP [...] rt.cpan.org>
From: "Paul Findlay" <Paul.Findlay [...] fonterra.com>
Hi again I am trying to pass arguments through to backends to provide the SSH identity file for example: my $xftp = Net::xFTP->new( 'Net::SFTP::Foreign', $config->{remote_host}, Debug => $PINS::Debug::g_debug_level, user => $config->{user}, foreign_more => [-i => $file] ); But your argument parsing code passed foreign_more unmodified so Net::SFTP::Foreign throws an error. I replaced all instances of this: foreach $i (keys %args) { foreach $j (@supported_mods) { if ($i =~ /^${j}_/o) { if ($j eq 'local') { ($t = $i) =~ s/^${j}_//; $args{$t} = $args{$i}; } delete $args{$i}; } } } With this: my $pattern = join('|', sort(@supported_mods)); $supported_arg = qr/\A($pattern)_(.*)\Z/m; ... foreach my $arg (keys %args) { my ($prefix, $key) = ($arg =~ $supported_arg); next unless ($prefix && $prefix eq 'local'); $args{$key} = delete $args{$arg}; } And it seems to work.. Regards Paul Findlay DISCLAIMER: This email contains confidential information and may be legally privileged. If you are not the intended recipient or have received this email in error, please notify the sender immediately and destroy this email. You may not use, disclose or copy this email or its attachments in any way. Any opinions expressed in this email are those of the author and are not necessarily those of the Fonterra Co-operative Group. http://www.fonterra.com/
Sorry this took so long, but this should now be fixed by new version 0.44. Thanks again! Jim On Mon Jun 28 19:13:23 2010, Paul.Findlay@fonterra.com wrote: Show quoted text
> Hi again > > I am trying to pass arguments through to backends to provide the SSH > identity file for example: > > my $xftp = Net::xFTP->new( > 'Net::SFTP::Foreign', > $config->{remote_host}, > Debug => $PINS::Debug::g_debug_level, > user => $config->{user}, > foreign_more => [-i => $file] > ); > > But your argument parsing code passed foreign_more unmodified so > Net::SFTP::Foreign throws an error. > > I replaced all instances of this: > > foreach $i (keys %args) > { > foreach $j (@supported_mods) > { > if ($i =~ /^${j}_/o) > { > if ($j eq 'local') > { > ($t = $i) =~ s/^${j}_//; > $args{$t} = $args{$i}; > } > delete $args{$i}; > } > } > } > > With this: > > my $pattern = join('|', sort(@supported_mods)); > $supported_arg = qr/\A($pattern)_(.*)\Z/m; > > ... > > foreach my $arg (keys %args) > { > my ($prefix, $key) = ($arg =~ $supported_arg); > next unless ($prefix && $prefix eq 'local'); > $args{$key} = delete $args{$arg}; > } > > And it seems to work.. > > Regards > > Paul Findlay > > > DISCLAIMER: > This email contains confidential information and may be legally > privileged. If you are not the intended recipient or have received > this email in error, please notify the sender immediately and > destroy this email. > You may not use, disclose or copy this email or its attachments in any > way. > Any opinions expressed in this email are those of the author and are > not necessarily those of the Fonterra Co-operative Group. > http://www.fonterra.com/ >
Version 0.44 resolves this.