Changeset 10253 for trunk/gsdl


Ignore:
Timestamp:
2005-07-19T16:18:25+12:00 (19 years ago)
Author:
kjdon
Message:

added 'use strict' to all classifiers, and made modifications (mostly adding 'my') to make them compile

Location:
trunk/gsdl/perllib/classify
Files:
15 edited

Legend:

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

    r10218 r10253  
    3131use sorttools;
    3232
     33use strict;
     34no strict 'refs'; # allow filehandles to be variables and viceversa
     35
    3336sub BEGIN {
    34     @ISA = ('BasClas');
     37    @AZCompactList::ISA = ('BasClas');
    3538}
    3639
     
    130133    my $self = (defined $hashArgOptLists)? new BasClas($pluginlist,$inputargs,$hashArgOptLists): new BasClas($pluginlist,$inputargs);
    131134
     135    if ($self->{'info_only'}) {
     136    # don't worry about any options etc
     137    return bless $self, $class;
     138    }
     139   
    132140    if (!$self->{"metadata"}) {
    133141    my $outhandle = $self->{'outhandle'};
     
    173181}
    174182
    175 $tmp = 0;
     183my $tmp = 0;
    176184
    177185sub classify
     
    460468    # should be recursively classified.
    461469    #--
    462     foreach $dm_pair (@$multiple_cl_ref)
     470    foreach my $dm_pair (@$multiple_cl_ref)
    463471    {
    464472    my ($doc_OID,$mdoffset,$metavalue,$cs_metavalue) = @$dm_pair;
     
    651659    # don't need to do any splitting if there are less than 'minnesting' classifications
    652660    if ((scalar @$classlistref) <= $self->{'minnesting'}) {
    653     foreach $subOID (@$classlistref) {
     661    foreach my $subOID (@$classlistref) {
    654662            if ($subOID =~ /^CLASSIFY\.(.*)$/
    655663        && defined $self->{'classifiers'}->{$1})
     
    670678   
    671679    # first split up the list into separate A-Z and 0-9 classifications
    672     foreach $classification (@$classlistref) {
     680    foreach my $classification (@$classlistref) {
    673681    my $title = $self->{'reclassifylist'}->{$classification};
    674682    $title =~ s/&(.){2,4};//g; # remove any HTML special chars
     
    696704
    697705    my @tmparr = ();
    698     foreach $subsection (sort keys (%$classhash)) {
     706    foreach my $subsection (sort keys (%$classhash)) {
    699707    push (@tmparr, $subsection);
    700708    }
     
    706714    push (@tmparr, '0-9');
    707715    }
    708     foreach $subclass (@tmparr)
     716    foreach my $subclass (@tmparr)
    709717    {
    710718    my $tempclassify
     
    714722
    715723
    716     foreach $subsubOID (@{$classhash->{$subclass}})
     724    foreach my $subsubOID (@{$classhash->{$subclass}})
    717725    {
    718726            if ($subsubOID =~ /^CLASSIFY\.(.*)$/
     
    758766    my $max = $self->{'maxcompact'};
    759767
    760     foreach $subsection (sort keys %$classhashref) {
     768    foreach my $subsection (sort keys %$classhashref) {
    761769    if ($subsection eq '0-9') {
    762770        @{$compactedhash->{$subsection}} = @{$classhashref->{$subsection}};
  • trunk/gsdl/perllib/classify/AZCompactSectionList.pm

    r10218 r10253  
    1010
    1111use AZCompactList;
     12use strict;
     13no strict 'refs'; # allow filehandles to be variables and viceversa
    1214
    1315sub BEGIN {
    14     @ISA = ('AZCompactList');
    15 }
    16 
     16    @AZCompactSectionList::ISA = ('AZCompactList');
     17}
     18
     19my $arguments = [
     20         ];
    1721my $options =
    1822{   'name'     => "AZCompactSectionList",
     
    183187    # should be recursively classified.
    184188    #--
    185     foreach $dm_pair (@$multiple_cl_ref)
     189    foreach my $dm_pair (@$multiple_cl_ref)
    186190    {
    187191    my ($doc_OID,$mdoffset,$metavalue) = @$dm_pair;
     
    193197    foreach $node_name (keys %{$self->{'classifiers'}})
    194198    {
    195         $resafe_node_name = $node_name;
     199        my $resafe_node_name = $node_name;
    196200        $resafe_node_name =~ s/(\(|\)|\[|\]|\{|\}|\^|\$|\.|\+|\*|\?|\|)/\\$1/g;
    197201        if ($metavalue =~ m/^$resafe_node_name$/i)
  • trunk/gsdl/perllib/classify/AZList.pm

    r10218 r10253  
    3232use iso639;
    3333
     34use strict;
     35no strict 'refs'; # allow filehandles to be variables and viceversa
     36
    3437sub BEGIN {
    35     @ISA = ('BasClas');
     38    @AZList::ISA = ('BasClas');
    3639}
    3740
     
    7679    my $self = (defined $hashArgOptLists)? new BasClas($classifierslist,$inputargs,$hashArgOptLists): new BasClas($classifierslist,$inputargs);
    7780
     81    if ($self->{'info_only'}) {
     82    # don't worry about any options etc
     83    return bless $self, $class;
     84    }
     85
    7886    if (!$self->{"metadata"}) {
    7987    print STDERR "AZList Error: required option -metadata not supplied \n";
     
    131139
    132140    # find the first available metadata
    133     foreach $m (@{$self->{'meta_list'}}) {
     141    foreach my $m (@{$self->{'meta_list'}}) {
    134142    $metavalue = $doc_obj->get_metadata_element($doc_obj->get_top_section(), $m);
    135143    $metaname = $m;
  • trunk/gsdl/perllib/classify/AZSectionList.pm

    r10218 r10253  
    4141use sorttools;
    4242
     43use strict;
     44no strict 'refs'; # allow filehandles to be variables and viceversa
     45
    4346sub BEGIN {
    44     @ISA = ('AZList');
     47    @AZSectionList::ISA = ('AZList');
    4548}
    4649
     50my $arguments = [
     51         ];
    4752my $options = { 'name'     => "AZSectionList",
    4853        'desc'     => "{AZSectionList.desc}",
     
    9297
    9398    # find the first available metadata
    94     foreach $m (@{$self->{'meta_list'}}) {
     99    foreach my $m (@{$self->{'meta_list'}}) {
    95100    $metavalue = $doc_obj->get_metadata_element($section, $m);
    96101    $metaname = $m;
  • trunk/gsdl/perllib/classify/AllList.pm

    r10218 r10253  
     1package AllList;
     2
    13use BasClas;
    2 package AllList;
     4
     5use strict;
     6no strict 'refs'; # allow filehandles to be variables and viceversa
    37
    48sub BEGIN {
     
    2327
    2428    my $self = (defined $hashArgOptLists)? new BasClas($classifierslist,$inputargs,$hashArgOptLists): new BasClas($classifierslist,$inputargs);
     29   
     30    if ($self->{'info_only'}) {
     31    # don't worry about any options etc
     32    return bless $self, $class;
     33    }
    2534
    2635    # Manually set $self parameters.
     
    5564            'classifyOID' =>"oai");
    5665    $classifyinfo{'thistype'} = 'Invisible';
    57     @list = @{$self->{'list'}};
     66    my @list = @{$self->{'list'}};
    5867
    5968    my $seqNo = 0;
    60     foreach $OID (@list) {
     69    foreach my $OID (@list) {
    6170    my $hashref={};
    6271    $hashref->{'OID'}=$OID;
  • trunk/gsdl/perllib/classify/BasClas.pm

    r10229 r10253  
    6464use strict;
    6565no strict 'subs'; # allow barewords (eg STDERR) as function arguments
     66no strict 'refs'; # allow filehandles to be variables and viceversa
    6667
    6768my $arguments =
     
    310311    my $self = shift (@_);
    311312    my $metadata = shift (@_);
     313
     314    return "" unless defined $metadata && $metadata =~ /\S/;
    312315   
    313316    my @metalist = split(/,/, $metadata);
  • trunk/gsdl/perllib/classify/Browse.pm

    r10218 r10253  
    2626# 12/05/02 Added usage datastructure - John Thompson
    2727
    28 use BasClas;
    2928package Browse;
    3029
     30use BasClas;
    3131use sorttools;
    3232
     33use strict;
     34no strict 'refs'; # allow filehandles to be variables and viceversa
     35
    3336sub BEGIN {
    34     @ISA = ('BasClas');
     37    @Browse::ISA = ('BasClas');
    3538}
    3639
     40my $arguments = [
     41         ];
    3742my $options = { 'name'     => "Browse",
    3843        'desc'     => "{Browse.desc}",
     
    5055
    5156    my $self = (defined $hashArgOptLists)? new BasClas($classifierslist,$inputargs,$hashArgOptLists): new BasClas($classifierslist,$inputargs);
     57
     58    if ($self->{'info_only'}) {
     59    # don't worry about any options etc
     60    return bless $self, $class;
     61    }
    5262
    5363    # Manually set $self parameters.
  • trunk/gsdl/perllib/classify/Collage.pm

    r10223 r10253  
    2929use sorttools;
    3030
     31use strict;
     32no strict 'refs'; # allow filehandles to be variables and viceversa
     33
    3134sub BEGIN {
    32     @ISA = ('BasClas');
     35    @Collage::ISA = ('BasClas');
    3336}
    3437
     
    114117
    115118    my $self = (defined $hashArgOptLists)? new BasClas($classifierslist,$inputargs,$hashArgOptLists): new BasClas($classifierslist,$inputargs);
     119   
     120    if ($self->{'info_only'}) {
     121    # don't worry about any options etc
     122    return bless $self, $class;
     123    }
    116124
    117125    # Manually set $self parameters.
     
    179187    my $within_page_c=1;
    180188
    181     foreach $oid (@list) {
     189    foreach my $oid (@list) {
    182190    if ($within_page_c>$items_per_page) {
    183191        my $title = "Items $global_c+";
     
    207215    my %classifyinfo = ('childtype'=>$childtype,
    208216            'Title'=>$title,
    209                         'parameters'=> $parameters,
    210217            'contains'=>[]);
    211218
     
    226233    my $caption = $self->{'caption'};
    227234   
    228     if (!defined($maxDownloads)) {
    229         $maxDownloads="";
    230     }
     235    #if (!defined($maxDownloads)) {
     236    #    $maxDownloads="";
     237    #}
    231238
    232239    my $parameters;
  • trunk/gsdl/perllib/classify/DateList.pm

    r10218 r10253  
    4343use sorttools;
    4444
     45use strict;
     46no strict 'refs'; # allow filehandles to be variables and viceversa
     47
    4548sub BEGIN {
    46     @ISA = ('BasClas');
     49    @DateList::ISA = ('BasClas');
    4750}
    4851
     
    8891    my $self = (defined $hashArgOptLists)? new BasClas($classifierslist,$inputargs,$hashArgOptLists): new BasClas($classifierslist,$inputargs);
    8992
     93    if ($self->{'info_only'}) {
     94    # don't worry about any options etc
     95    return bless $self, $class;
     96    }
     97
    9098    # Manually set $self parameters.
    9199    $self->{'list'} = {};
     
    172180    # classifications, unless nogroup is specified
    173181    if ((scalar @$classlistref) <= 39 && !$self->{'nogroup'}) {
    174     foreach $subOID (@$classlistref) {
     182    foreach my $subOID (@$classlistref) {
    175183        push (@{$classifyinfo->{'contains'}}, {'OID'=>$subOID});
    176184    }
     
    184192    if (!$self->{'nogroup'}) { # hlist of year+month pairs
    185193        # single level of classifications
    186         foreach $classification (@$classlistref) {
     194        foreach my $classification (@$classlistref) {
    187195        my $date = $self->{'list'}->{$classification};
    188196        $date =~ s/^(\d\d\d\d)(\d\d).*$/$1&nbsp;_textmonth$2_/;
     
    196204       
    197205    } else { # don't group - individual years and months
    198         foreach $classification (@$classlistref) {
     206        foreach my $classification (@$classlistref) {
    199207        my $date = $self->{'list'}->{$classification};
    200208        $date =~ s/^(\d\d\d\d)(\d\d).*$/$1&nbsp;_textmonth$2_/;
     
    223231            push (@{$yearclassify->{'contains'}}, $monthclassify);
    224232       
    225             foreach $subsubOID
     233            foreach my $subsubOID
    226234            (@{$classhash->{$subclass}->{$subsubclass}}) {
    227235                push (@{$monthclassify->{'contains'}},
     
    236244    # not by month
    237245    # first split up the list into separate year classifications
    238     foreach $classification (@$classlistref) {
     246    foreach my $classification (@$classlistref) {
    239247        my $date = $self->{'list'}->{$classification};
    240248        $date =~ s/^(\d\d\d\d).*$/$1/;
     
    248256    $classhash = $self->compactlist ($classhash);
    249257    }
    250     foreach $subclass (sort keys %$classhash) {
     258    foreach my $subclass (sort keys %$classhash) {
    251259    my $tempclassify = $self->get_entry($subclass, "DateList");
    252     foreach $subsubOID (@{$classhash->{$subclass}}) {
     260    foreach my $subsubOID (@{$classhash->{$subclass}}) {
    253261        push (@{$tempclassify->{'contains'}}, {'OID'=>$subsubOID});
    254262    }
  • trunk/gsdl/perllib/classify/HFileHierarchy.pm

    r10223 r10253  
    3333use cfgread;
    3434use sorttools;
     35
     36use strict;
     37no strict 'refs'; # allow filehandles to be variables and viceversa
    3538
    3639sub BEGIN {
     
    9295
    9396    my $self = (defined $hashArgOptLists)? new BasClas($classifierslist,$inputargs,$hashArgOptLists): new BasClas($classifierslist,$inputargs);
     97
     98    if ($self->{'info_only'}) {
     99    # don't worry about any options etc
     100    return bless $self, $class;
     101    }
    94102
    95103    my $metadata = $self->{'metadata'};
     
    177185    # hash is a list of two items. The first item is the OID and the second item
    178186    # is the title
    179     foreach $descriptor (keys (%$list)) {
     187    foreach my $descriptor (keys (%$list)) {
    180188        $self->{'descriptorlist'}->{$descriptor} = $list->{$descriptor}->[0];
    181189        unless (defined $self->{'locatorlist'}->{$list->{$descriptor}->[0]}) {
     
    218226
    219227    # sorted the keys - otherwise funny things happen - kjdon 03/01/03
    220     foreach $OID (sort keys (%$list)) {
     228    foreach my $OID (sort keys (%$list)) {
    221229    my $tempinfo = $self->get_OID_entry ($OID, $classifyinfo, $list->{$OID}->{'title'}, "VList");
    222230   
    223231    if (defined $self->{'sort'}) {
    224232        if ($self->{'reverse_sort'}) {
    225         foreach $subOID (sort {$b->[1] cmp $a->[1];} @{$list->{$OID}->{'contents'}}) {
     233        foreach my $subOID (sort {$b->[1] cmp $a->[1];} @{$list->{$OID}->{'contents'}}) {
    226234            push (@{$tempinfo->{'contains'}}, {'OID'=>$subOID->[0]});
    227235        }
    228236        }
    229237        else {
    230         foreach $subOID (sort {$a->[1] cmp $b->[1];} @{$list->{$OID}->{'contents'}}) {
     238        foreach my $subOID (sort {$a->[1] cmp $b->[1];} @{$list->{$OID}->{'contents'}}) {
    231239            push (@{$tempinfo->{'contains'}}, {'OID'=>$subOID->[0]});
    232240        }
     
    234242    }
    235243    else {
    236         foreach $subOID (@{$list->{$OID}->{'contents'}}) {
     244        foreach my $subOID (@{$list->{$OID}->{'contents'}}) {
    237245        push (@{$tempinfo->{'contains'}}, {'OID'=>$subOID->[0]});
    238246        }
  • trunk/gsdl/perllib/classify/HTML.pm

    r10218 r10253  
    3131use BasClas;
    3232
     33use strict;
     34no strict 'refs'; # allow filehandles to be variables and viceversa
     35
    3336sub BEGIN {
    34     @ISA = ('BasClas');
     37    @HTML::ISA = ('BasClas');
    3538}
    3639
     
    6265
    6366    my $self = (defined $hashArgOptLists)? new BasClas($classifierslist,$inputargs,$hashArgOptLists): new BasClas($classifierslist,$inputargs);
     67
     68    if ($self->{'info_only'}) {
     69    # don't worry about any options etc
     70    return bless $self, $class;
     71    }
    6472
    6573    if (!$self->{'url'}) {
  • trunk/gsdl/perllib/classify/Hierarchy.pm

    r10218 r10253  
    3737use sorttools;
    3838
     39use strict;
     40no strict 'refs'; # allow filehandles to be variables and viceversa
     41
    3942sub BEGIN {
    40     @ISA = ('HFileHierarchy');
     43    @Hierarchy::ISA = ('HFileHierarchy');
    4144}
    4245
     
    8689    my $current_pos;
    8790   
     91   
    8892    foreach my $metavalue (@$metavalues) {
    8993    $path_hash = $self->{'path_hash'};
     
    9296        pop(@chunks); # remove the last element from the end
    9397    }
    94    
    9598    foreach my $folderName (@chunks)
    9699    {
     
    131134    my $metavalues = [];
    132135    # find all the metadata values
    133     foreach $m (@{$self->{'meta_list'}}) {
     136    foreach my $m (@{$self->{'meta_list'}}) {
    134137    my $mvalues = $doc_obj->get_metadata($doc_obj->get_top_section(), $m);
    135138    next unless (@{$mvalues});
    136139    if ($self->{'firstvalueonly'}) {
    137140        # we only want the first metadata value
    138         push (@$metavalues, $mvalues[0]);
     141        push (@$metavalues, $mvalues->[0]);
    139142        last;
    140143    }
     
    200203    my ($num_spaces) = @_;
    201204   
    202     for ($i = 0; $i < $num_spaces; $i++){
     205    for (my $i = 0; $i < $num_spaces; $i++){
    203206    print STDERR " ";
    204207    }
     
    240243    if (@doc_list) {
    241244        $has_content = 1;
    242         foreach $d(@doc_list) {
     245        foreach my $d (@doc_list) {
    243246        push (@{$entry->{'contains'}}, {'OID'=>$d});
    244247        }   
  • trunk/gsdl/perllib/classify/List.pm

    r10223 r10253  
    3030package List;
    3131
     32use strict;
     33no strict 'refs'; # allow filehandles to be variables and viceversa
     34
    3235use sorttools;
    3336
    3437sub BEGIN {
    35     @ISA = ('BasClas');
     38    @List::ISA = ('BasClas');
    3639}
    3740
     
    144147        my $values_listref=
    145148            $doc_obj->get_metadata($topsection, $m);
    146         $array_size = scalar(@{$values_listref});
     149        my $array_size = scalar(@{$values_listref});
    147150        if ($array_size==0 || $array_size < $mdoffset+1) {
    148151            $mdoffset = $mdoffset - $array_size;
     
    222225    $classifyinfo{'supportsmemberof'} = $memberof;
    223226
    224     foreach $OID (@list) {
     227    foreach my $OID (@list) {
    225228    my $hashref={};
    226229    # special oid format, if using offsets (from AZCompactList)
  • trunk/gsdl/perllib/classify/Phind.pm

    r10218 r10253  
    3939use unicode;
    4040
     41use strict;
     42no strict 'refs'; # allow filehandles to be variables and viceversa
     43
    4144my @removedirs = ();
    4245
     
    5659
    5760sub BEGIN {
    58     @ISA = ('BasClas');
     61    @Phind::ISA = ('BasClas');
    5962}
    6063
     
    7174        closedir DIR;
    7275   
    73         foreach $file (@files) {
     76        foreach my $file (@files) {
    7477        next if $file =~ /^\.\.?$/;
    7578        my ($suffix) = $file =~ /\.([^\.]+)$/;
     
    159162    my $self = (defined $hashArgOptLists)? new BasClas($classifierslist,$inputargs,$hashArgOptLists): new BasClas($classifierslist,$inputargs);
    160163
     164    if ($self->{'info_only'}) {
     165    # don't worry about any options etc
     166    return bless $self, $class;
     167    }
     168
    161169    # Ensure the Phind generate scripts are in place
    162170    my $file1 = &util::filename_cat($ENV{'GSDLHOME'}, "bin", $ENV{'GSDLOS'}, "suffix");
     
    255263    # record this file
    256264    $self->{'total'} ++;
    257     print "file $self->{'total'}: $file\n" if ($self->{'$verbosity'});
     265    # what is $file ???
     266    # print "file $self->{'total'}: $file\n" if ($self->{'$verbosity'});
    258267
    259268    # Store document details
     
    10581067
    10591068    my %suffixtophind;
    1060     my @phindfrequency;
     1069    my @totalfrequency;
    10611070    my (@fields, $suffixid);
    10621071    my $nextphind = 1;
     
    11101119        if ($linenumber % 1000 == 0) {
    11111120        print $out "line $linenumber:\t$phindid\t$suffixid\t($text)\n";
    1112         }
    1113         print $out "$num: $key\t($text)\n" if ($verbosity > 3);
     1121        }
     1122        # what are $num and $key??
     1123        #print $out "$num: $key\t($text)\n" if ($verbosity > 3);
    11141124    }
    11151125
     
    11361146    $documents = shift @fields;
    11371147    $documents =~ s/d//g;
    1138     @documents = split(/;/, $documents);
     1148    my @documents = split(/;/, $documents);
    11391149    @documents = sort by_doc_frequency @documents;
    11401150
     
    14131423    # 2.
    14141424    # Translate phrases.3 to MGPP input files
    1415     my ($key, $text, $word, $isThesaurus);
     1425    my ($key, $text, $word, $isThesaurus, $line);
    14161426    my @fields;
    14171427    my $linenumber = 0;
  • trunk/gsdl/perllib/classify/SectionList.pm

    r10218 r10253  
    3535use sorttools;
    3636
     37use strict;
     38no strict 'refs'; # allow filehandles to be variables and viceversa
     39
    3740sub BEGIN {
    38     @ISA = ('List');
     41    @SectionList::ISA = ('List');
    3942}
    4043
     44my $arguments = [];
    4145my $options = { 'name'     => "SectionList",
    4246        'desc'     => "{SectionList.desc}",
     
    7175    my $thissection = undef;
    7276
    73     my $option;
    74     foreach $option (@options)
     77    foreach my $option (@options)
    7578    {
    7679    if ($option =~ m/^section=(\d+)$/i)
     
    118121    if (defined $self->{'meta_list'}) {
    119122    # find the first available metadata
    120     foreach $m (@{$self->{'meta_list'}}) {
     123    foreach my $m (@{$self->{'meta_list'}}) {
    121124        $metavalue = $doc_obj->get_metadata_element($section, $m);
    122125        $metaname = $m;
Note: See TracChangeset for help on using the changeset viewer.