From: David K. <dk...@li...> - 2002-03-05 17:08:18
|
Dear Colleagues -- I am new to Perl-Ldap and to this list. I have just installed Perl-Ldap-0.25 and have already run headlong into a brick wall. I've paged through this list's archive without finding any subject line that even vaguely suggests my situation, but please forgive me if I've missed something obvious and this matter has already been discussed. I shall first describe my problem, then I'll describe what I tried that failed to solve the problem, then I'll describe my system and installed prerequisites, so you'll know where I'm coming from. I'm building a proxy server using Apache built with mod_perl and mod_ssl, and I need to do secure (viz. SSL) LDAP searches against our campus LDAP server for authentication/authorization processing. I am currently trying to use Net::LDAPS because I have been unable to get a secure connection to our LDAP server using Net::LDAP and the start_tls() method. (I hope you're still willing to talk to me!) I have been very successful in making a secure connection and running searches with this syntax: use Net::LDAPS; my $ldap = new Net::LDAPS($directoryURL, port => "636") or die "$@"; but only from a simple perl script. When I try to add the LDAPS stuff to my Apache authentication module, everything falls apart: [Mon Mar 4 09:51:59 2002] [error] Bareword "gensym" not allowed while "strict subs" in use at /usr/local/perl-5.6/lib/5.6.0/i386-linux/IO/Handle.pm line 286. BEGIN not safe after errors--compilation aborted at /usr/local/perl-5.6/lib/5.6.0/i386-linux/IO/Handle.pm line 573. Compilation failed in require at /usr/local/perl-5.6/lib/5.6.0/i386-linux/IO/Socket.pm line 11. BEGIN failed--compilation aborted at /usr/local/perl-5.6/lib/5.6.0/i386-linux/IO/Socket.pm line 11. Compilation failed in require at /usr/local/perl-5.6/lib/site_perl/5.6.0/Net/LDAP.pm line 8. BEGIN failed--compilation aborted at /usr/local/perl-5.6/lib/site_perl/5.6.0/Net/LDAP.pm line 8. Compilation failed in require at /usr/local/perl-5.6/lib/site_perl/5.6.0/Net/LDAPS.pm line 11. BEGIN failed--compilation aborted at /usr/local/perl-5.6/lib/site_perl/5.6.0/Net/LDAPS.pm line 11. Compilation failed in require at /usr/local/apache.test/http-calnet/lib/Apache/AccessMan.pm line 30. BEGIN failed--compilation aborted at /usr/local/apache.test/http-calnet/lib/Apache/AccessMan.pm line 30. Compilation failed in require at (eval 11) line 3. Examining the IO::Handle module, I see that this refers to its new() constructor method: sub new { my $class = ref($_[0]) || $_[0] || "IO::Handle"; @_ == 1 or croak "usage: new $class"; my $io = gensym; bless $io, $class; } where the pragmas "use Symbol" and "use strict" have already been issued. Well, "gensym" is a function in the Symbol package (part of the standard Perl library) which is supposed to return a reference to an anonymous glob. For some reason in this context, the token "gensym" is being considered a "bareword". So I tried to rectify this flop by adding a "no strict subs" to this function: sub new { no strict subs; my $class = ref($_[0]) || $_[0] || "IO::Handle"; @_ == 1 or croak "usage: new $class"; my $io = gensym; bless $io, $class; } Now, however, my module crashes with this error: [Mon Mar 4 11:11:22 2002] [error] Can't bless non-reference value at /usr/local/perl-5.6/lib/5.6. 0/i386-linux/IO/Handle.pm line 288. So I took out the "no strict subs" and put parentheses after "gensym": sub new { my $class = ref($_[0]) || $_[0] || "IO::Handle"; @_ == 1 or croak "usage: new $class"; my $io = gensym(); bless $io, $class; } Now, however, my module crashes with this error: [Mon Mar 4 11:32:26 2002] [error] Undefined subroutine &IO::Handle::gensym called at /usr/local/p erl-5.6/lib/5.6.0/i386-linux/IO/Handle.pm line 286. So I tried to qualify the path to the gensym function: sub new { my $class = ref($_[0]) || $_[0] || "IO::Handle"; @_ == 1 or croak "usage: new $class"; my $io = Symbol::gensym(); bless $io, $class; } Now, however, my module crashes with this error: [Mon Mar 4 11:38:00 2002] [error] Undefined subroutine &Symbol::gensym called at /usr/local/perl- 5.6/lib/5.6.0/i386-linux/IO/Handle.pm line 286. This message is generated, even if I write the pragma "use Symbol" right in the new() constructor method itself. Can anyone help me get this to work? Is tweeking IO::Handle the way to go? Help!!! Here is what my system looks like: My OS is linux 2.2.16-3 (from "uname -a") perl 5.6.0 apache 1.3.17 mod_perl 1.25 mod_ssl 2.8.0 OpenSSL 0.9.6 Convert-ASN1-0.15 IO-Socket-SSL-0.80 Net_SSLeay.pm-1.06 Perl-Ldap-0.25 glibc-2.1.3-19 glibc-devel-2.1.3-19 gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release) GNU make 3.77 Thanks in advance, and sorry for the length of this message. David Kalins, Programmer/Analyst III Library Systems Office Univeristy of California, Berkeley |