On Thu, 2003-06-05 at 21:58, Steve Dockter wrote:
> Hi,
>
> I have a Linux RedHat 7.3 machine that I am trying to install the
> Netmeeting Directory Kit on
> (http://www.freesoft.org/software/NetMeeting/). I have installed the
> Berkeley 4.0.14 database and OpenLDAP 2.0.27. I am using Perl 5.6.1
> with the LDAP module. While running the script nmaddentry I get the
> following message:
>
> ":all" is not exported by the Net::LDAP::Constant module at ./nmaddentry
> line 9
> Can't continue after import errors at ./nmaddentry line 9
> BEGIN failed--compilation aborted at ./nmaddentry line 9, <DATA> line
> 422.
>
> The first ten lines of the script are:
>
> #!/usr/bin/perl
> #
> # 14 Dec 2000 Brent Baccala [EMAIL PROTECTED]
> #
> # Perl script to add an entry to a NetMeeting LDAP server
>
> use Getopt::Std;
> use Socket;
> use Net::LDAP qw(:all);
Yes, it seems that :all support was dropped when I rewrote ::Constant.
I don't recommend using :all as it will import a LOT of symbols and
it will only get more as time goes by. Its far better to import what you
need.
However I have attached a patch that I will put in the next release
Graham.
Index: lib/Net/LDAP/Constant.pm
===================================================================
RCS file: /cvsroot/perl-ldap/ldap/lib/Net/LDAP/Constant.pm,v
retrieving revision 1.8
diff -u -u -r1.8 Constant.pm
--- lib/Net/LDAP/Constant.pm 20 May 2003 14:58:49 -0000 1.8
+++ lib/Net/LDAP/Constant.pm 28 May 2003 18:31:51 -0000
@@ -4,7 +4,7 @@
package Net::LDAP::Constant;
-$VERSION = "0.01";
+$VERSION = "0.02";
use Carp;
@@ -15,7 +15,8 @@
my $callpkg = caller(0);
_find(@_);
my $oops;
- foreach my $sym (@_) {
+ my $all = grep /:all/, @_;
+ foreach my $sym ($all ? keys %const : @_) {
if (my $sub = $const{$sym}) {
*{$callpkg . "::$sym"} = $sub;
}
@@ -30,11 +31,12 @@
sub _find {
if (my @need = grep { ! $const{$_} } @_) {
my %need; @[EMAIL PROTECTED] = ();
+ my $all = exists $need{':all'};
seek(DATA,0,0);
local $/=''; # paragraph mode
local $_;
while(<DATA>) {
- next unless /^=item\s+(LDAP_\S+)\s+\((.*)\)/ and exists $need{$1};
+ next unless /^=item\s+(LDAP_\S+)\s+\((.*)\)/ and ($all or exists $need{$1});
my ($name, $value) = ($1,$2);
delete $need{$name};
$const{$name} = sub () { $value };