CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner: Re: [ogit2] SFTP: Edit Log



FishMonger
Veteran / Moderator

Mar 16, 2018, 7:12 AM


Views: 8485
Re: [ogit2] SFTP


Quote
Hi this is a tricky one as Net::SFTP::Foreign will install on Active Perl Windows but then errors as it requires Net::SFTP installed. It requests backend Net_SSH2 module which is the Net::SFTP module which cannot be installed on Windows.

You are mistaken. Net::SFTP::Foreign AND Net::SFTP can be installed on Windows.


Code
c:\test>perl -MNet::SFTP -e 1 

c:\test>perl -MNet::SFTP::Foreign -e 1

c:\test>

I installed them using cpan and did not have any proplems.


Using Win32::OLE and winscp is not the choice I'd make, but if you want a Windows only solution then go ahead and use it.

I would, however, strongly recommend changing the way you build your $todaydate string. That is perl 4 coding style and is very messy/ugly. Instead, use the strftime function from the POSIX module.


Code
use POSIX qw( strftime ); 

my $todaydate = strftime("%Y%m%d_%H%M%S\n", localtime);


This is perl not php. That trim sub could be replaced with a single call to the sprintf() function, but even that is not needed if you use the strftime function like I showed.

Also, ALWAYS use the warnings and strict pragmas in your scripts. They will point out lots of your coding mistakes.


(This post was edited by FishMonger on Mar 16, 2018, 7:16 AM)


Edit Log:
Post edited by FishMonger (Veteran) on Mar 16, 2018, 7:15 AM
Post edited by FishMonger (Veteran) on Mar 16, 2018, 7:16 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives