Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Which initializes my module...it's purpose is to make administering an ldap-aware mail server easier in my company.sub new { my $self = {}; $self->{_ldap} = Net::LDAP->new($LDAP_SERVER); bless $self; return $self; }
This is the first of many subs which returns the error: Global symbol "%self" requires explicit package name at MyModule.pm line xxx, where xxx references the $result = line.sub alias_add_entry { my $self = shift; my $alias = shift; my $user = shift; my $result; die "Not enough args to alias_add_entry() $@" if not defined ( +$alias and $user); $result = $self{"_ldap"}->modify ( dn => "cn=$alias,ou=Aliases,dc=mydomain,dc=com", add => { rfc822mailmember => $user } ); return $result; }
sub authenticate { my $self = shift; my $pw = shift; my $user = shift; die "Not enough args to authenticate() $@" if not defined $pw; $user = "Manager" if ($user eq ""); my $result = $self->{"_ldap"}->bind ( dn => "cn=$user, dc=sigmatel, dc=com", password => $pw ); return $result; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: My first Perl module...
by snax (Hermit) on Nov 17, 2000 at 13:57 UTC | |
by Anonymous Monk on Nov 17, 2000 at 14:24 UTC | |
by t0mas (Priest) on Nov 17, 2000 at 14:33 UTC | |
by snax (Hermit) on Nov 17, 2000 at 16:50 UTC | |
by Fastolfe (Vicar) on Nov 17, 2000 at 20:14 UTC | |
|
Re: My first Perl module...
by t0mas (Priest) on Nov 17, 2000 at 13:55 UTC |