Le dimanche 9 Juillet 2006 15:39, Nicolas Roudninski a écrit :
> Bonjour à tous,
> my $xdlg = "/usr/bin/zenity";
> my $pop;
> my $i;
> my $nom;
> my @amis;
> my $amis_data;
> my $email;
> #chomp(my $user = `whoami`);
> my $user = "nicolas";
> chomp(my $home_dir = "/home/$user");
>
> print "connection au serveur...\n";
> $pop = new Mail::POP3Client( USER => "nroudninski",
> PASSWORD => "YDjqCDDi",
> HOST => "pop.wanadoo.fr" );
>
> sub read_data {
> open DATAFILE, "$home_dir/amis.dat"
> or die "Fichier introuvable !";
> while (<DATAFILE>) {
> chomp;
> push @amis, $_."\n";
> }
> for ($i = 1; $i <= $pop->Count(); $i++) {
> # print @amis;
> foreach my $amis (@amis) {
> my @amis_data = split / *: */, $amis;
> $email = $amis_data[1];
> chomp($email);
> $nom = $amis_data[0];
> &compare;
> # print $email;
> }
> }
> close DATAFILE;
> return ;
> } # ---------- end of subroutine read_data ----------
>
> sub compare {
> # for ($i = 1; $i <= $pop->Count(); $i++) {
> foreach ( $pop->Head( $i ) ) {
> if (/From:.*$email/) {
> chomp;
> print "Un message de $nom [$email]\n";
> # s/From://;
> # print " [$_ ]\n";
> my $adresse = $_;
> system"$xdlg --info --text 'Un message
> de $nom'"; }
> }
> # }
> return ;
> } # ---------- end of subroutine compare ----------
>
> read_data;
> ----------------------------fin du script-------------------------------
>
Comment dans ta console lances tu le script ?
Car chez moi il me met : Can't locate object method "new" via package
"Mail::POP3Client" (perhaps you forgot to load "Mail::POP3Client"?) at
mail.pl line 16 ...
Mais bon c'est une autre histoire !