Changeset 46dfe9d6f368


Ignore:
Timestamp:
02/17/11 13:16:18 (3 years ago)
Author:
Mahlon E. Smith <mahlon@…>
Branch:
default
Tags:
0.3
Message:

Update documentation, now that multiline edits work. Minor other
cleanups. Bump version.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • shelldap

    r5 r6  
    22# vim: set nosta noet ts=4 sw=4: 
    33# 
    4 # Copyright (c) 2006, Mahlon E. Smith <mahlon@martini.nu> 
     4# Copyright (c) 2006-2011, Mahlon E. Smith <mahlon@martini.nu> 
    55# All rights reserved. 
    66# Redistribution and use in source and binary forms, with or without 
     
    99#     * Redistributions of source code must retain the above copyright 
    1010#       notice, this list of conditions and the following disclaimer. 
     11# 
    1112#     * Redistributions in binary form must reproduce the above copyright 
    1213#       notice, this list of conditions and the following disclaimer in the 
    1314#       documentation and/or other materials provided with the distribution. 
     15# 
    1416#     * Neither the name of Mahlon E. Smith nor the names of his 
    1517#       contributors may be used to endorse or promote products derived 
     
    346348=head1 BUGS / LIMITATIONS 
    347349 
    348 There is currently no attribute multiline support - attribute values 
    349 that span over one line will be ignored if modified.  (Thankfully, they 
    350 are generally rare.) 
    351  
    352 There is no support for editing binary data.  This is actually related 
    353 to the lack of multiline support - if you just base64 encode data and 
    354 paste it in, it will be ignored for the same reasons. 
     350There is no support for editing binary data.  If you need to edit base64 
     351stuff, just feed it to the regular ldapmodify/ldapadd/etc tools. 
    355352 
    356353=head1 AUTHOR 
     
    868865} 
    869866 
     867 
     868# Given an $arrayref, remove LDIF continuation wrapping, 
     869# effectively making each entry a single line. 
     870#  
    870871sub unwrap { 
    871872    my $array = shift; 
    872873 
    873     my $iter = 1; 
    874     while ($iter < $#$array) { 
    875         if (@$array[$iter] =~ m/^\W/) { 
    876             @$array[$iter - 1] =~ s/\n$//; 
    877             @$array[$iter] =~ s/^\W//; 
    878             splice(@$array, $iter - 1, 2, @$array[$iter - 1] . @$array[$iter]); 
    879         } else { 
    880             $iter++; 
    881         } 
    882     } 
    883 } 
     874    my $i = 1; 
     875    while ( $i < scalar(@$array) ) { 
     876        if ( $array->[$i] =~ /^\s/ ) { 
     877            $array->[ $i - 1 ] =~ s/\n$//; 
     878            $array->[ $i ] =~ s/^\s//; 
     879            splice( @$array, $i - 1, 2, $array->[$i - 1] . $array->[$i] ); 
     880        } 
     881        else { 
     882            $i++; 
     883        } 
     884    } 
     885} 
     886 
    884887 
    885888############################################################### 
     
    11591162        return; 
    11601163    } 
    1161         my $filter; 
    1162         unless ( $DNs[0] eq '*' ) { 
    1163             $filter = $self->make_filter( \@DNs ) or return; 
    1164         } 
    1165  
     1164 
     1165    my $filter; 
     1166    unless ( $DNs[0] eq '*' ) { 
     1167        $filter = $self->make_filter( \@DNs ) or return; 
     1168    } 
    11661169 
    11671170    my $s = $self->search({ scope => 'one', filter => $filter }); 
     
    12131216 
    12141217    # load it into an array for potential comparison 
    1215     my @orig_ldif; 
    12161218    open LDIF, "$self->{'ldif_fname'}" or return; 
    1217     @orig_ldif = <LDIF>; 
     1219    my @orig_ldif = <LDIF>; 
    12181220    close LDIF; 
    12191221 
     
    12401242 
    12411243    # load changes into a new array for comparison 
    1242     my @new_ldif; 
    12431244    open LDIF, "$self->{'ldif_fname'}" or return; 
    1244     @new_ldif = <LDIF>; 
     1245    my @new_ldif = <LDIF>; 
    12451246    close LDIF; 
    12461247 
     
    12511252        return if $line  =~ /^\#/; # ignore comments 
    12521253        my ( $attr, $val ) = ( $1, $2 ) if $line =~ /^(.+?): (.*)$/; 
     1254        return unless $attr; 
    12531255        return if index($attr, ':') != -1;  # ignore base64 
    12541256        return ( $attr, $val ); 
    12551257    }; 
    12561258 
    1257     unwrap(\@orig_ldif); 
    1258     unwrap(\@new_ldif); 
     1259    unwrap( \@orig_ldif ); 
     1260    unwrap( \@new_ldif ); 
    12591261 
    12601262    my $diff = Algorithm::Diff->new( \@orig_ldif, \@new_ldif ); 
     
    16631665 
    16641666$0 = 'shelldap'; 
    1665 my $VERSION = '0.2'; 
     1667my $VERSION = '0.3'; 
    16661668 
    16671669use Getopt::Long; 
Note: See TracChangeset for help on using the changeset viewer.