Mailing List CGatePro@mail.stalker.com Message #92391
From: Technical Support, Stalker Labs <support@stalker.com>
Subject: Re: Deleting several accounts using perl program - Case[VYRY0829-812ZI]
Date: Thu, 30 Aug 2007 04:52:22 +0400
To: Germain MAURICE <maurice@essec.fr>
Hello,
 Germain MAURICE on 29.08.2007 18:58 wrote:

Hello,

I have a problem with using Communigate v5.1.9, CGP Perl CLI module version 2.7.1.
My platform is a RHEL r3.

The accounts seem to be not entirely deleted in the same session, if I launch the program several times, at the end of the differents execution, the job is done. It's very weird. Do you have any idea of the source of this problem ?

I really hope you can help me to fix it.

Regards,
Germain

So, my perl program named importlist.pl contains these parts of code :
###############################################

Include this statement to the beginning of your program to avoid many programming errors:

use strict;

use CGP::CLI;
$Deleted_Success = 0;
$d=0;
$i=0;
for ($i = 0; $i < 4; $i++ ){
        &list_accounts_and_delete_lists ;
        # Defini Deleted_Success = 1 systematiquement
        $Deleted_Success = 1;
        $d=1;
        system("sleep 5");
        print "Deleted_Success = $d $Deleted_Success\n";
        $d = &testing_deleted_accounts;
        print "Deleted_Success = $d $Deleted_Success\n";
        # Defini Deleted_Success = 0 si au moins un "mlo-" existe encore
        printf FICSTAT ">global DS = $d $Deleted_Success\n";
}
printf FICSTAT "global DS = $d $Deleted_Success\n";
&create_accounts_and_lists ;


sub list_accounts_and_delete_lists
 {
   &open_cli;
    printf FICSTAT "Module: list_accounts_and_delete_lists STARTED \n";

  $AccountList = $cli->ListAccounts($domain)
         || die "Alerte Interface MListes:Error:(1) ".$cli->getErrMessage.", quitting";
  foreach(keys %$AccountList)
          {
          print "$_\n";
          if ($_ =~ /mlo-/)
               {
                $cli->DeleteAccount($_)

Note that the accounts are returned without the domain part, you need to append the domain name explicitly, i.e. it must be

      $cli->DeleteAccount("$_\@$domain")

Without the domain part it will delete accounts from the main domain.

                        || print "Alerte Interface MListes:Error(Delete $_): $cli->getErrMessage , quitting\n";

You're not actually quitting on the error here...

          printf FICSTAT "$_ has been successfully deleted \n";
          print "$_ has been successfully deleted \n";

               }
          }
 $cli->Logout;
 printf FICSTAT "Module: list_accounts_and_delete_lists ENDED \n\n";
 }



--
Sincerely,
Roman

=======================================================================
When answering to letters sent to you by the tech.support staff, make
sure the original message you have received is included into your reply.
Subscribe (FEED) Subscribe (DIGEST) Subscribe (INDEX) Unsubscribe Mail to Listmaster