Ignore:
Timestamp:
2005-07-06T15:27:45+12:00 (19 years ago)
Author:
kjdon
Message:

Jeffrey's new parsing modifications, committed approx 6 July, 15.16

File:
1 edited

Legend:

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

    r9322 r10218  
    6767
    6868sub new {
    69     my $class = shift (@_);
    70     my $self = new BasClas($class, @_);
    71    
    72     my $option_list = $self->{'option_list'};
    73     push( @{$option_list}, $options );
    74    
    75     if ($self->{'info_only'}) {
    76     # created from classinfo.pl - don't need to parse the arguments
    77     return bless $self, $class;
    78     }
    79     my ($metadata, $title, $removeprefix, $removesuffix);
    80    
    81     if (!parsargv::parse(\@_,
    82              q^metadata/.*/^, \$metadata,
    83              q^buttonname/.*/^, \$title,
    84              q^removeprefix/.*/^, \$removeprefix,
    85              q^removesuffix/.*/^, \$removesuffix,
    86              "allow_extra_options")) {
    87    
    88     print STDERR "\nIncorrect options passed to $class, check your collect.cfg file\n";
    89     $self->print_txt_usage("");  # Use default resource bundle
    90     die "\n";
    91     }
    92 
    93     if (!$metadata) {
     69    my ($class) = shift (@_);
     70    my ($classifierslist,$inputargs,$hashArgOptLists) = @_;
     71    push(@$classifierslist, $class);
     72
     73    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     74    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
     75
     76    my $self = (defined $hashArgOptLists)? new BasClas($classifierslist,$inputargs,$hashArgOptLists): new BasClas($classifierslist,$inputargs);
     77
     78    if (!$self->{"metadata"}) {
    9479    print STDERR "AZList Error: required option -metadata not supplied \n";
    9580    $self->print_txt_usage("");  # Use default resource bundle
     
    9782    die "AZList Error: required option -metadata not supplied\n";
    9883    }
    99    
    100     my @meta_list = split(/,/, $metadata);
    101     #my $meta1 = $meta_list[0];
    102 
    103     #$title = $meta1 unless ($title);
    104     $title = $self->generate_title_from_metadata($metadata) unless ($title);
     84       
     85    # Manually set $self parameters.
    10586    $self->{'list'} = {};
     87
     88    # Transfer value from Auto Parsing to the variavle name that used in previous GreenStone.
     89    my @meta_list = split(/,/, $self->{"metadata"});
    10690    $self->{'meta_list'} = \@meta_list;
    107     $self->{'title'} = $title;
    108    
    109     if (defined($removeprefix) && $removeprefix) {
    110     $removeprefix =~ s/^\^//; # don't need a leading ^
    111     $self->{'removeprefix'} = $removeprefix;
    112     }
    113     if (defined($removesuffix) && $removesuffix) {
    114     $removesuffix =~ s/\$$//; # don't need a trailing $
    115     $self->{'removesuffix'} = $removesuffix;
    116     }
     91
     92    $self->{'buttonname'} = $self->generate_title_from_metadata($self->{'metadata'}) unless ($self->{'buttonname'});
     93
     94    # Further setup
     95    if (defined($self->{"removeprefix"}) && $self->{"removeprefix"}) {
     96    $self->{"removeprefix"} =~ s/^\^//; # don't need a leading ^
     97    }
     98    if (defined($self->{"removesuffix"}) && $self->{"removesuffix"}) {
     99    $self->{"removesuffix"} =~ s/\$$//; # don't need a trailing $
     100    }
     101
     102    # Clean out the unused keys
     103    delete $self->{"metadata"}; # Delete this key
     104
     105    if($self->{"removeprefix"} eq "") {delete $self->{"removeprefix"};}
     106    if($self->{"removesuffix"} eq "") {delete $self->{"removesuffix"};}
    117107
    118108    return bless $self, $class;
     
    233223    my $childtype = "HList";
    234224    if (scalar (@$classlistref) <= 39) {$childtype = "VList";}
    235     my $classifyinfo = $self->get_entry ($self->{'title'}, $childtype, "Invisible");
     225    my $classifyinfo = $self->get_entry ($self->{'buttonname'}, $childtype, "Invisible");
    236226
    237227    # don't need to do any splitting if there are less than 39 (max + min -1) classifications
Note: See TracChangeset for help on using the changeset viewer.