mirror of
https://github.com/imapsync/imapsync.git
synced 2025-08-03 23:41:52 +02:00
1.580
This commit is contained in:
parent
8f266abab8
commit
6a0efa6bc8
86 changed files with 1747 additions and 28151 deletions
41
W/learn/copy
Executable file
41
W/learn/copy
Executable file
|
@ -0,0 +1,41 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
use warnings;
|
||||
use strict;
|
||||
use English;
|
||||
use Mail::IMAPClient;
|
||||
|
||||
my $rcs = '$Id: append,v 1.1 2011/07/14 16:49:02 gilles Exp gilles $ ';
|
||||
|
||||
$ARGV[3] or die "usage: $0 host user password folder uid\n";
|
||||
|
||||
my $host = $ARGV[0];
|
||||
my $user = $ARGV[1];
|
||||
my $password = $ARGV[2];
|
||||
my $folder_1 = $ARGV[3];
|
||||
my $folder_2 = $ARGV[4];
|
||||
|
||||
my $imap = Mail::IMAPClient->new( );
|
||||
$imap->Debug( 1 );
|
||||
$imap->Server( $host );
|
||||
$imap->connect( ) or die;
|
||||
$imap->User( $user );
|
||||
$imap->Password( $password ) ;
|
||||
$imap->login( ) or die;
|
||||
$imap->Uid( 1 ) ;
|
||||
$imap->Peek( 1 ) ;
|
||||
$imap->Clear( 0 ) ;
|
||||
|
||||
#print map {"$_\n"} $imap->folders( ) ;
|
||||
|
||||
$imap->select( $folder_1 ) or die ;
|
||||
my @msgs_1 = $imap->messages ;
|
||||
print "LIST_1: @msgs_1\n" ;
|
||||
my $copy = $imap->copy( $folder_2, $msgs_1[0] ) ;
|
||||
print "copy: $copy\n" ;
|
||||
$imap->select( $folder_2 ) or die ;
|
||||
my @msgs_2 = $imap->messages ;
|
||||
print "LIST_2: @msgs_2\n" ;
|
||||
|
||||
$imap->close( ) ;
|
||||
|
37
W/learn/hashes_set
Executable file
37
W/learn/hashes_set
Executable file
|
@ -0,0 +1,37 @@
|
|||
#!/usr/bin/perl -w
|
||||
|
||||
use Data::Dumper ;
|
||||
use strict ;
|
||||
|
||||
my %hash_1 = (
|
||||
'abcd' => 'zzz',
|
||||
'efgh' => 'zzz',
|
||||
) ;
|
||||
|
||||
my %hash_2 = (
|
||||
'2345' => 'zzz',
|
||||
'8888' => 'zzz',
|
||||
'efgh' => 'zzz',
|
||||
) ;
|
||||
|
||||
|
||||
print Data::Dumper->Dump( [ \%hash_1 ] ) ;
|
||||
|
||||
my %hash_X ;
|
||||
|
||||
foreach my $k ( keys( %hash_1 ) ) {
|
||||
$hash_X{ $k }->{ 'folder_1' } ++ ;
|
||||
}
|
||||
|
||||
foreach my $k ( keys( %hash_2 ) ) {
|
||||
$hash_X{ $k }->{ 'folder_2'} ++ ;
|
||||
}
|
||||
|
||||
foreach my $k ( keys( %hash_1 ) ) {
|
||||
$hash_X{ $k }->{ 'folder_1' } ++ ;
|
||||
}
|
||||
|
||||
print Data::Dumper->Dump( [ \%hash_X ] ) ;
|
||||
|
||||
print keys( %{ $hash_X{ 'efgh' } } ) ;
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue