Hello group,

I am new to Perl but not to programming.  The company I work for
bought a product called
WebEvent View (http://www.webevent.com/products/view/).

The product comes with the source code and we have run into an error
with a certain perl
script that imports Active Directory LDIF dumps And imports into MYSQL.

The main part of the code is:

my $newline = $cmdopts{'msdos'} ? "\r\n" : "\n";
local($/) = $newline x 2;  # Blank line terminates records

while (<>) {
    my @flds = split $newline;
    # Don't add it if parse fails
    my $u = LDIF::User->new([EMAIL PROTECTED]) or next;
    
    my $node = $DRI->add({
        org      => $u->org,
        concept  => $u->concept,
        division => $u->division,
        region   => $u->region,
        id       => $u->id,
        }
    );
    my $uid = $u->uid or next;  # Parse of user record failed
    $u->node($node);            # Remember the user's home node
    $node->add_user($uid);      # ...and the users at each node
    $Users->{$uid} = $u;        # ...and all userids with their data
}
...


The new sub follows:
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#
# new() -- Take an unordered list of fields comprising a single user
#    entry (in the Darden 'ldif' export format) and break it into
#    its components. Each field is a colon-seperated name/value
#    pair.
#
# Returns: User data, as a hash ref.
#
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
sub new {
    my $class = shift;
    my $flds  = shift;

    use constant FLDS => qw/uid first last email tz
                org concept division region id access/;
    my %self = (
    tz            => '',     # timezone
    org           => 'DRI',
    manager_level => '',     # Sometimes this isn't in the data...
    );

    foreach (@$flds) {
    my ($k,$val) = split ':', $_, 2;
    
    # the below line we get an error on
    my $key = $usermap{$k} or next;
    # the above line we get an error on
    
    $val =~ s/^\s+//;        # Strip leading ws
    $self{$key} = $val;
    }
    ...

The error we get is:
Use of uninitialized value in hash element at
/usr/local/webevent/wecore/bin/importer.pl line 941, <> chunk 6715.

There is one LDIF record that we think throws the error since this
person never shows up in the application.  The LDIF record is:

dn: CN=Sharon XXXXXXXX,OU=users,OU=RSC,DC=darden,DC=com
changetype: add
company: RL1
division: 06
mail: [EMAIL PROTECTED]
givenName: Sharon
physicalDeliveryOfficeName: 0943
sAMAccountName: RMKSLD1
sn: XXXXXXXX
Darden-Job-Code: 6121
Darden-Region: 01
Darden-Security-Code: 89999
Darden-Business-Unit: RLUSA
Darden-Company-Number: 1000
Darden-Manager-Level: Y

Compared to all our other records, there is nothing wrong with this one.

Can anyone give any help fixing this problem?

Thanks,

James Drabb
-- 
----------------------------------------------------------
The box said: "Requires Windows 98/2000/XP/NT, or better."
So, I installed LINUX!
----------------------------------------------------------
James Drabb JR
Senior Programmer
Clermont, FL USA

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to