Cyrus::IMAP::Admin headaches
Tornoci Laszlo
torlasz at xenia.sote.hu
Mon Nov 4 13:19:53 EST 2002
Hi,
I am trying to build a perl package for web based Cyrus user
administration, accessing cyrus-imap and mysql.
I have cyrus-imapd 2.1.9 compiled on a redhat 8.0 box.
My perl package works ok, but every time the package gets
called it spits to STDERR:
Use of uninitialized value in subroutine entry at
/usr/local/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/Cyrus/IMAP/Admin.pm
line 106 during global destruction.
(in cleanup) client is not of type Cyrus::IMAP at
/usr/local/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/Cyrus/IMAP/Admin.pm
line 106 during global destruction.
Line 106 in Cyrus::IMAP::Admin looks like this:
101:sub AUTOLOAD {
102: use vars qw($AUTOLOAD);
103: no strict 'refs';
104: $AUTOLOAD =~ s/^.*:://;
105: my $sub = $Cyrus::IMAP::{$AUTOLOAD};
106: *$AUTOLOAD = sub { &$sub($_[0]->{cyrus}, @_[1..$#_]); };
107: goto &$AUTOLOAD;
108:}
If I use Cyrus::IMAP::Admin directly form a script, everything is fine,
I get no errors, the IMAP connection gets made:
#########################################################
#!/usr/bin/perl -w
use lib "/usr/local/lib/perl5/site_perl";
use strict;
use Cyrus::IMAP::Admin;
use vars qw(%Imap_dsn $Imaph);
%Imap_dsn = ( 'host' => 'localhost',
'user' => 'cyrus',
'password' => 'cyrus-password',
'authz' => '',
'mech' => 'login'
);
$Imaph = Cyrus::IMAP::Admin->new($Imap_dsn{host});
$Imaph->authenticate( -authz => "$Imap_dsn{authz}",
-user => "$Imap_dsn{user}",
-password => "$Imap_dsn{password}",
-mechanism => "$Imap_dsn{mech}"
) or die "Cannot connect to $Imap_dsn{host} !\n";
########################################################
However, if I put this stuff into a package, that I call from a
script, it works as before, but gives me the error message I
mentioned above. This is the script:
########################################################
#!/usr/bin/perl -w
use lib "/usr/local/lib/perl5/site_perl";
use strict;
use UM;
########################################################
where UM.pm contains:
########################################################
#!/usr/bin/perl -w
use strict;
use CGI;
use Cyrus::IMAP::Admin;
package UM;
BEGIN {
use vars qw(%Imap_dsn $Imaph);
$Imaph = Cyrus::IMAP::Admin->new($Imap_dsn{host});
%Imap_dsn = ( 'host' => 'localhost',
'user' => 'cyrus',
'password' => 'cyrus-password',
'authz' => '',
'mech' => 'login'
);
$Imaph->authenticate( -authz => "$Imap_dsn{authz}",
-user => "$Imap_dsn{user}",
-password => "$Imap_dsn{password}",
-mechanism => "$Imap_dsn{mech}"
) or die "Cannot connect to $Imap_dsn{host} !\n";
} # end BEGIN
1;
############################################################
The package works, but I just can't get rid of the error messages.
(The package is much larger, but this part is enough to reproduce the
problem.) The interesting thing is, I developed the perl package with
cyrus-imapd 2.0.16, on redhat 7.3 (also different perl version) where I
didn't get the error message.
Can anyone with better understanding of the perl package mechanism help
me? I just dont like to have my error logs cluttered up with this.
Yours: Laszlo
--
----------------------------------------------------------------------
Laszlo L Tornoci Inst Pathophysiology
E-mail: torlasz at xenia.sote.hu Semmelweis Univ Med School
torlasz at net.sote.hu Nagyvarad ter 4.
fax: (36-1)-210-4409 Budapest, H-1089, Hungary
----------------------------------------------------------------------
More information about the Info-cyrus
mailing list