Ignore:
Timestamp:
08/08/09 16:25:16 (15 years ago)
Author:
nanardon
Message:
  • allow continuation line
File:
1 edited

Legend:

Unmodified
Added
Removed
  • LATMOS-Accounts/lib/LATMOS/Accounts/Acls.pm

    r310 r314  
    5959    my $acl; 
    6060    my $line_nb = 0; 
     61    my $prevline = ""; 
    6162    if (open(my $handle, '<', $file)) { 
    6263        while(my $realline = <$handle>) { 
    6364            $line_nb++; 
    64             my $line = $realline; # keep track to report malformed file 
     65            chomp($realline); 
     66            if ($realline =~ /\\$/) { 
     67                # continuation line 
     68                $prevline .= $realline; 
     69                $prevline =~ s/\s*\\$//; 
     70                next; 
     71            } 
     72            my $line = $prevline . $realline; # keep track to report malformed file 
     73            $prevline = ""; 
    6574            $line =~ s/\s*#.*//; 
    66             if ($line =~ /^(\S+)\s*$/) { 
     75            if ($line =~ /^(\S.*)/) { 
    6776                if ($acl) { 
    6877                    push(@{$self->{_acls}}, $acl); 
     
    7382                    return; 
    7483                }; 
    75             } elsif ($line =~ /\s+(\S+)/) { 
     84            } elsif ($line =~ /^\s+(\S.*)/) { 
    7685                if ($acl) { 
    7786                    $acl->add_perm($line) or do { 
     
    121130sub new { 
    122131    my ($class, $objdotatt, $list) = @_; 
    123     my ($obj, $attr) = $objdotatt =~ /^([^.]+)\.(\S+)/; 
     132    my ($obj, $attr) = $objdotatt =~ /^([^.]+)\.(.*)/; 
    124133    my @attrs = ($attr =~ /^\{(.*)\}$/) 
    125         ? (split(',', $1)) 
     134        ? (split(/\s*,\s*/, $1)) 
    126135        : ($attr); 
    127136    @attrs or return; 
Note: See TracChangeset for help on using the changeset viewer.