my code is here
sub FtpToDCLKServer(\%$\$\$) {
my $V_ConfigHashRef = shift;
my $V_LocalFile = shift;
my $V_RemoteFileNameRef = shift;
my $V_RemoteFileSizeRef = shift;
my $V_CurrentDate = GetTheCurrentDate(); #get today's date
my $V_HostName = $V_ConfigHashRef->{FTPHostName}; #get ftp hostname from the hash
my $V_UserName = $V_ConfigHashRef->{FTPUserName}; #get ftp user name from the hash
my $V_Password = $V_ConfigHashRef->{FTPPassword}; #get ftp password from the hash
my $V_Directory = $V_ConfigHashRef->{FTPDir}; #get the ftp directory on to which we have to place the files
my $V_Ftp;
if ( $V_Ftp = Net::FTP->new($V_HostName) ) { #instantiate new ftp object
unless ($V_Ftp->login($V_UserName,$V_Password)) { #login to the ftp server
WriteToLogFile($V_CurrentDate,GetTheCurrentTime(),"Error","Could not login:$@");
return 0;
}
$V_Ftp->pasv(); #continue the session in passive mode
unless ($V_Ftp->cwd($V_Directory)) { #change the current working directory to $V_Directory
WriteToLogFile($V_CurrentDate,GetTheCurrentTime(),"Error","Could not change the current working directory to $V_Directory");
return 0;
}
unless($V_Ftp->ascii) { #transfer the data in ascii mode
WriteToLogFile($V_CurrentDate,GetTheCurrentTime(),"Error","Could not change to ASCII mode");
return 0;
}
unless ($$V_RemoteFileNameRef = $V_Ftp->put($V_LocalFile,"Curve_"."$V_CurrentDate"."\.dat")) { #upload the file
WriteToLogFile($V_CurrentDate,GetTheCurrentTime(),"Error","$V_Ftp->message");
return 0;
}
$$V_RemoteFileSizeRef = $V_Ftp->size($$V_RemoteFileNameRef);
$V_Ftp->close(); #close the ftp session
}else {
WriteToLogFile($V_CurrentDate,GetTheCurrentTime(),"Error","Could not connect:$@");
return 0;
}
return 1;
}
thanx
kamesh
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.