All I had to remove the whitespace before the : characters and change the 'key:' field to 'dn:'. Instant perl objects!

This code is almost identical to the code in the synopsis for Net::LDAP::LDIF. I just added a call to Data::Dumper to print the object and its structure.

use strict; use warnings; use diagnostics; use Data::Dumper; use Net::LDAP::LDIF; my $ldif = Net::LDAP::LDIF->new( "file.ldif", "r", onerror => 'undef' +); while( not $ldif->eof() ) { my $entry = $ldif->read_entry(); if ( $ldif->error() ) { print "Error msg: ",$ldif->error(),"\n"; print "Error lines:\n",$ldif->error_lines(),"\n"; } else { print Dumper($ldif); } } $ldif->done();
Here is the modified input file:
dn: /C=US/A=BOGUS/P=ABC+DEF/O=CONN/OU=VALUE1/S=Region/G=Limbic/I=_/ type: UR flags: DIRM ADMINM ADIC ADIM Alias-2: wL_Region Alias-3: Limbic Region Alias-4: Limbic._.Region@nowhere.com Alias-5: Limbic._.Region Alias-6: Limbic.Region@nowhere.com Alias-7: ORG Alias-8: CMP Alias-10: O=ORG/OU=Some Big Division/CN=Limbic _. Region Alias-11: Region Alias-12: Region, Limbic _ Alias-14: Limbic _. Region at WT-CONN Alias-15: ex:/o=BLANK/ou=ORG/cn=Recipients/cn=Mailboxes/cn=LRegion Alias-16: WT:Limbic_Region Alias-17: SMTP:Limbic._.Region@nowhere.com Alias-18: /o=A.B.C.D./ou=Vermont Ave/cn=Recipients/cn=wt/cn=Limbic_Reg +ion Full Name: Region, Limbic _. Post Office: WT-CONN Description: 999-555-1212 Some Big Company Tel: 999-555-1212 Dept: Some Big Division Location: EMWS Address: 123 nowhere street City: everywhere State: MD Zip Code: 20874 Building: BLAH Building-Code: MD-ABC owner: CONN
It should work perfectly the first time! - toma

In reply to Re: Re: Re: My first package - need help getting started by toma
in thread My first package - need help getting started by Limbic~Region

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.