Changeset 9130


Ignore:
Timestamp:
2005-02-22T13:40:56+13:00 (19 years ago)
Author:
mdewsnip
Message:

Allowed the use of "|" characters as well as "\" for separating levels, to work with the GLI. Also finished off the "-suppresslastlevel" option, which someone whose name begins with Katherine had forgotten to do.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/perllib/classify/AutoHierarchy.pm

    r8852 r9130  
    6464    'desc' => "{AutoHierarchy.separator}",
    6565    'type' => "regexp",
    66     'deft' => "[\\\\\\\/]",
     66    'deft' => "[\\\\\\\/|\\\\\\\|]",
    6767    'reqd' => "no" },
    6868      { 'name' => "suppresslastlevel",
     
    9595    my $firstvalueonly = 0;
    9696    my $allvalues = 0;
     97    my $suppresslastlevel = 0;
    9798
    9899    if (!parsargv::parse(\@_,
     
    103104             q^firstvalueonly^, \$firstvalueonly,
    104105             q^allvalues^, \$allvalues,
    105 
     106             q^suppresslastlevel^, \$suppresslastlevel,
    106107             "allow_extra_options")) {
    107108   
     
    121122   
    122123    if (!$separator) {
    123     $separator = "[\\\/]";
     124    $separator = "[\\\/|\\\|]";
    124125    }
    125126    $self->{'separator'} = $separator;
     
    138139    $self->{'allvalues'} = $allvalues;
    139140
    140     $self->{'uniquelastbit'} = 1;
     141    if ($suppresslastlevel != 0) {
     142    $suppresslastlevel = 1;
     143    }
     144    $self->{'suppresslastlevel'} = $suppresslastlevel;
     145
    141146    # sortname is handled a bit differently - kjdon
    142147    # undef means to sort, but use the metadata value from -metadata
     
    216221    $path_hash = $self->{'path_hash'};
    217222    my @chunks = split (/$self->{'separator'}/, $metavalue);
    218     if ($self->{'uniquelastbit'}) {
     223    if ($self->{'suppresslastlevel'}) {
    219224        pop(@chunks); # remove the last element from the end
    220225    }
Note: See TracChangeset for help on using the changeset viewer.