Net::MirrorDir - Perl extension for compare local-directories and remote-directories with each other


Net-MirrorDir documentation  | view source Contained in the Net-MirrorDir distribution.

Index


NAME

Top

Net::MirrorDir - Perl extension for compare local-directories and remote-directories with each other

SYNOPSIS

Top

  use Net::MirrorDir;
  my $md = Net::MirrorDir->new(
 	ftpserver		=> "my_ftp.hostname.com",
 	user		=> "my_ftp_user_name",
 	pass		=> "my_ftp_password",
 	);
 my ($ref_h_local_files, $ref_h_local_dirs) = $md->ReadLocalDir();
 my ($ref_h_remote_files, $ref_h_remote_dirs) = $md->ReadRemoteDir();
 my $ref_a_remote_files_not_in_local = $md->RemoteNotInLocal(
 	$ref_h_local_files, 
 	$ref_h_remote_files
 	);
 my $ref_a_local_files_not_in_remote = $md->LocalNotInRemote(
 	$ref_h_local_files, 
 	$ref_h_remote_files
 	);
 $md->Quit();

 or more detailed
 my $md = Net::MirrorDir->new(
 	ftpserver		=> "my_ftp.hostname.com",
 	user		=> "my_ftp_user_name",
 	pass		=> "my_ftp_password",
 	localdir		=> "home/nameA/homepageA",
 	remotedir	=> "public",
 	debug		=> 1 # 1 for yes, 0 for no
 	timeout		=> 60 # default 30
 	connection	=> $ftp_object, # default undef
# "exclusions" default references to a empty array []
 	exclusions	=> ["private.txt", "Thumbs.db", ".sys", ".log"],
# "subset" default references to a empty array []
 	subset		=> [".txt, ".pl", ".html", "htm", ".gif", ".jpg", ".css", ".js", ".png"]
# or substrings in pathnames
#	exclusions	=> ["psw", "forbidden_code"]
#	subset		=> ["name", "my_files"]
# or you can use regular expressions
# 	exclusions	=> [qr/SYSTEM/i, $regex]
# 	subset		=> [qr/(?i:HOME)(?i:PAGE)?/, $regex]
 	);
 $md->SetLocalDir("home/name/homepage");
 print("hostname : ", $md->get_ftpserver(), "\n");
 $md->Connect();
 my ($ref_h_local_files, $ref_h_local_dirs) = $md->ReadLocalDir();
 if($md->{_debug})
 	{
 	print("local files : $_\n") for(sort keys %{$ref_h_local_files});
 	print("local dirs : $_\n") for(sort keys %{$ref_h_local_dirs});
 	}	
 my ($ref_h_remote_files, $ref_h_remote_dirs) = $md->ReadRemoteDir();
 if($md->{_debug})
 	{
 	print("remote files : $_\n") for(sort keys %{$ref_h_remote_files});
 	print("remote dirs : $_\n") for(sort keys %{$ref_h_remote_dirs});
 	}
 my $ref_a_local_files_not_in_remote = $md->LocalNotInRemote(
 	$ref_h_local_files, 
 	$ref_h_remote_files
 	);
 if($md->{_debug})
 	{
 	print("new local files : $_\n") for(@{$ref_a_local_files_not_in_remote});
 	}
 my $ref_a_local_dirs_not_in_remote = $md->LocalNotInRemote(
 	$ref_h_local_dirs, 
 	$ref_h_remote_dirs
 	);
 if($md->{_debug})
 	{
 	print("new local dirs : $_\n") for(@{$ref_a_local_dirs_not_in_remote});
 	}
 my $ref_a_remote_files_not_in_local = $md->RemoteNotInLocal(
 	$ref_h_local_files, 
 	$ref_h_remote_files
 	);
 if($md->{_debug})
 	{
 	print("new remote files : $_\n") for(@{$ref_a_remote_files_not_in_local});
 	}
 my $ref_a_remote_dirs_not_in_local = $md->RemoteNotInLocal(
 	$ref_h_local_dirs, 
 	$ref_h_remote_dirs
 	);
 if($md->{_debug})
 	{
 	print("new remote dirs : $_\n") for(@{$ref_a_remote_dirs_not_in_local});
 	}
 $md->Quit();

DESCRIPTION

Top

This module is written as base class for Net::UploadMirror and Net::DownloadMirror. However, it can be used, also for themselves alone. It can compare local-directories and remote-directories with each other. To find which files where in which directory available.

Constructor and Initialization

Top

required optines

optional optiones

methods

EXPORT

None by default.

SEE ALSO

Top

Net::UploadMirror Net::DownloadMirror Net::FTP http://www.freenet-homepage.de/torstenknorr

FILES

Top

Net::FTP

BUGS

Top

Maybe you'll find some. Let me know.

REPORTING BUGS

Top

When reporting bugs/problems please include as much information as possible.

AUTHOR

Top

Torsten Knorr, <create-soft@freenet.de>

COPYRIGHT AND LICENSE

Top


Net-MirrorDir documentation  | view source Contained in the Net-MirrorDir distribution.