On Mon, 25 Aug 2003, Kai wrote:
> Hi List,
> I want to display the quota of each mailbox when user login to webmail.
> I try to write a Perl script using Cyrus::IMAP::Admin module.It like
> following..
> ----
>
> #!/usr/bin/perl -w
> use Cyrus::IMAP::Admin;
> my $client=Cyrus::IMAP::Admin->new('www.server.com');
> $client->authenticate(-authz=>'',
> -user=>'cyrus',
> -password=>'test',
> -mechanism=>'PLAIN');
> my $rc=$client->listquotaroot('[EMAIL PROTECTED]');
> print "$rc\n";
> -----
> I just got a result "2". But the result of running the command cyradm is
> -----
> www.server.com> lq [EMAIL PROTECTED]
> STORAGE 892/1024 (87.109375%)
> -----
> Where is the problem ? Please give me a hint.
> And ,I found the method that get the quota by inviting Cyrus::IMAP::Admin
> module is very slowly.Someone have a nice solution ?
You're using listquotaroot the wrong way. Try this instead:
my @quota = $client->listquotaroot('[EMAIL PROTECTED]');
print "Quota root: $quota[0]\n";
print "Usage: $quota[1]\n";
print "Limit: $quota[2]\n";
listquotaroot actually returns an array, not a scalar value.
Andy