+ foreach my $attr ( @{ $response->{protocolOp}->{searchResEntry}->{attributes} } ) {
+ if ( $attr->{type} =~ m/date/i ) {
+ foreach my $i ( 0 .. $#{ $attr->{vals} } ) {
+ $attr->{vals}->[$i] = "$1-$2-$3" if $attr->{vals}->[$i] =~ m/^([12]\d\d\d)([01]\d+)([0123]\d+)$/;
+ }
+ } elsif ( $attr->{type} eq 'hrEduPersonUniqueNumber' ) {
+ foreach my $val ( @{ $attr->{vals} } ) {
+ next if $val !~ m{.+:.+};
+ my ( $n, $v ) = split(/\s*:\s*/, $val );
+ push @attrs, { type => $attr->{type} . '_' . $n, vals => [ $v ] };
+ }
+ } elsif ( $attr->{type} eq 'hrEduPersonGroupMember' ) {
+ foreach my $i ( 0 .. $#{ $attr->{vals} } ) {
+ $attr->{vals}->[$i] =~ s/^u2010/p2010/gs && warn "FIXME group";
+ }
+ } elsif ( $attr->{type} eq 'mail' ) {
+ my @emails;
+ foreach my $i ( 0 .. $#{ $attr->{vals} } ) {
+ my $e = $attr->{vals}->[$i];
+ if ( $e =~ m/\s+/ ) {
+ push @emails, split(/\s+/, $e);
+ } else {
+ push @emails, $e;
+ }
+ }
+ $attr->{vals} = [ shift @emails ];
+ foreach my $i ( 0 .. $#emails ) {
+ push @attrs, { type => $attr->{type} . '_' . ( $i + 1 ) , vals => [ $emails[$i] ] };
+ }