Re: Applying a LDIF which is as string and not as file

Graham Barr <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.ldap
Message-ID <[email protected]>
On Apr 28, 2009, at 3:46 AM, Cyril Cheneson wrote:
> I have a LDAP structure (ldif format) as perl string.
>
> my $ldap_struct =<<"END";
>
> HERE MY LDIF
>
> END
>
> And I would like to apply the structure to my LDAP server.
>
> Net::LDAP::Ldif accepts file name or file handle only.
>
> Anyone has an idea how I can apply the LDIF string to LDAP?

You can use IO::Scalar or

   open(my $fh, "<", \$ldap_struct);

I forget which version of perl added the passing of a scalar ref to  
open.

Graham.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.