NAME
Net::DownloadMirror - Perl extension for mirroring a remote location via FTP to the local directory
SYNOPSIS
use Net::DownloadMirror;
my $um = Net::DownloadMirror->new(
ftpserver => "my_ftp.hostname.com",
usr => "my_ftp_usr_name",
pass => "my_ftp_password",
);
$um->Update();
or more detailed
my $um = Net::DownloadMirror->new(
ftpserver => "my_ftp.hostname.com",
usr => "my_ftp_usr_name",
pass => "my_ftp_password",
localdir => "home/nameA/homepageA",
remotedir => "public",
debug => 1 # 1 for yes, 0 for no
timeout => 60 # default 30
delete => "enable" # default "disabled"
connection => $ftp_object, # default undef
exclusions => ["private.txt", "Thumbs.db", ".sys", ".log"],
);
$um->SetLocalDir("home/nameB/homepageB");
print("hostname : ", $um->get_ftpserver(), "\n");
$um->Update();
DESCRIPTION
This module is for mirroring a remote location to a local directory via FTP. For example websites, documentations or developmentstuff which ones were uploaded or changed in the net. It is not developt for mirroring large archivs. But there are not in principle any limits.
Constructor and Initialization
required optines
- ftpserver the hostname of the ftp-server
- usr the username for authentification
- pass password for authentification
optional optiones
- localdir local directory where the downloaded or updated files are stored, default '.'
- remotedir remote location from where the files are downloaded, default '/'
- debug set it true for more information about the download-process, default 1
- timeout the timeout for the ftp-serverconnection
- delete if you want files or directories removed on the remote server also removed from the local directory set this attribute to "enable", default "disabled"
- connection takes a Net::FTP-object you should not use that, it is produced automatically by the NetMirrorDir-object
- exclusions a reference to a list of strings interpreted as regular-expressios ("regex") matching to something in the local pathnames, you do not want to delete, default empty list [ ] It is recommended that the local directory no critical files contains!!!
- (value) get_option (void) =item (1) set_option (value) The functions are generated by AUTOLOAD for all options. The syntax is not case-sensitive and the character '_' is optional.
methods
- (1) Update (void) call this function for mirroring automatically, recommended!!!
- (ref_hash_local_files, ref_hash_local_dirs) ReadLocalDir (void) Returns two hashreferences first the local-files, second the local-directorys found in the directory, given by the DownloadMirror-object, uses the attribute "localdir". The values are in the keys.
- (ref_hash_remotefiles, ref_hash_remote_dirs) ReadRemoteDir (void) Returns two hashreferences first the remote-files, second the remote-directorys found in the directory, given by the DownloadMirror-object, uses the attribute "remotedir". The values are in the keys.
- (1) Connect (void) Makes the connection to the ftp-server. uses the attributes "ftpserver", "usr" and "pass", given by the DownloadMirror-object.
- (1) Quit (void) Closes the connection with the ftp-server.
- (ref_hash_local_paths, ref_hash_remote_paths) LocalNotInRemote (ref_list_new_paths) Takes two hashreferences, given by the functions ReadLocalDir(); and ReadRemoteDir(); to compare with each other. Returns a reference of a list with files or directorys found in the local directory but not in the remote location. Uses the attribute "localdir" and "remotedir", given by the DownloadMirror-object.
- (ref_hash_local_paths, ref_hash_remote_paths) RemoteNotInLocal (ref_list_deleted_paths) Takes two hashreferences, given by the functions ReadLocalDir(); and ReadRemoteDir(); to compare with each other. Returns a reference of a list with files or directorys found in the remote location but not in the local directory. Uses the attribure "localdir" and "remotedir" given by the DownloadMirror-object.
- (ref_hash_modified_files) CheckIfModified (ref_list_local_files) Takes a hashreference of remote files to compare the last modification stored in a file "lastmodified_remote" while downloading. Returns a reference of a list.
- (1) StoreFiles (ref_list_paths) Takes a listreference of remote-paths to download via FTP.
- (1) MakeDirs (ref_list_paths) Takes a listreference of directorys to make in the local directory.
- (1) DeleteFiles (ref_list_paths) Takes a listreference of files to delete in the local directory.
- (1) RemoveDirs (ref_list_paths) Takes a listreference of directories to remove in the local directory.
EXPORT
None by default.
SEE ALSO
Net::MirrorDir Net::UploadMirror http://www.planet-interkom.de/t.knorr/index.html
FILES
Net::MirrorDir Storable File::Basename File::Path
BUGS
Maybe you'll find some. Let me know.
AUTHOR
Torsten Knorr, <knorrcpan@tiscali.de>
COPYRIGHT AND LICENSE
Copyright (C) 2006 by Torsten Knorr
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.9.2 or, at your option, any later version of Perl 5 you may have available.
8 POD Errors
The following errors were encountered while parsing the POD:
- Around line 254:
'=item' outside of any '=over'
- Around line 256:
You forgot a '=back' before '=head2'
- Around line 258:
'=item' outside of any '=over'
- Around line 267:
You forgot a '=back' before '=head2'
- Around line 269:
'=item' outside of any '=over'
- Around line 300:
You forgot a '=back' before '=head2'
- Around line 302:
'=item' outside of any '=over'
- Around line 354:
You forgot a '=back' before '=head2'