From: Mark W. <mew...@un...> - 2000-06-05 18:21:16
|
The Perl [] syntax means an array refeference. Thus you can also write it: $attrs = ['cn','mail','uid'] and you can pass it to the search() method without needing a \ in front of the variable. I'm not sure how this is trickier than before? If you already have a list of attributes as a hash, you can use keys or values to get the attributes back as an array. Mark On Mon, 5 Jun 2000, Eric S. Johansson wrote: > > ----- Original Message ----- > From: "Jim Harle" <ha...@us...> > To: "Eric S. Johansson" <es...@ha...> > Cc: <per...@ma...> > Sent: Monday, June 05, 2000 2:03 PM > Subject: Re: passing dynamic attribute lists > > > > There are a variety of ways of doing this. My preference is > > @base_attributes = ( > > objectclass => 'minimalRadiusPerson', > > ServiceType => '2', > > FramedProtocol => 'PPP', > > FramedMTU => '1500', > > AscendIdleLimit => '900' > > ); > > $ldap_res = $mast_srv->add ($dn, > > attrs => \@base_attributes > > ); > > > > That is, using an array for the attribute list, then using a reference to > > that array for "attrs". Don't forget the \ before the reference. > > I'm confused. I thought that attrs => [] was a reference to a hash not a > list. Converting attributes to a fixed array makes things a little more > tricky... > > > > > |