/[webpac2]/trunk/lib/WebPAC/Normalize.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/lib/WebPAC/Normalize.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 432 by dpavlin, Wed Feb 15 15:54:12 2006 UTC revision 433 by dpavlin, Mon Apr 17 16:01:12 2006 UTC
# Line 13  WebPAC::Normalize - data mungling for no Line 13  WebPAC::Normalize - data mungling for no
13    
14  =head1 VERSION  =head1 VERSION
15    
16  Version 0.08  Version 0.09
17    
18  =cut  =cut
19    
20  our $VERSION = '0.08';  our $VERSION = '0.09';
21    
22  =head1 SYNOPSIS  =head1 SYNOPSIS
23    
# Line 137  sub new { Line 137  sub new {
137          $self ? return $self : return undef;          $self ? return $self : return undef;
138  }  }
139    
140    =head2 all_tags
141    
142    Returns all tags in document in specified order
143    
144      my $sorted_tags = $self->all_tags();
145    
146    =cut
147    
148    sub all_tags {
149            my $self = shift;
150    
151            if (! $self->{_tags_by_order}) {
152    
153                    my $log = $self->_get_logger;
154                    # sanity check
155                    $log->logdie("can't find self->{inport_xml}->{indexer}") unless ($self->{import_xml}->{indexer});
156    
157                    my @tags = keys %{ $self->{'import_xml'}->{'indexer'}};
158                    $log->debug("unsorted tags: " . join(", ", @tags));
159    
160                    @tags = sort { $self->_sort_by_order } @tags;
161    
162                    $log->debug("sorted tags: " . join(",", @tags) );
163    
164                    $self->{_tags_by_order} = \@tags;
165            }
166    
167            return $self->{_tags_by_order};
168    }
169    
170    
171    
172  =head2 data_structure  =head2 data_structure
173    
# Line 172  sub data_structure { Line 203  sub data_structure {
203                  $log->debug("cache miss, creating");                  $log->debug("cache miss, creating");
204          }          }
205    
206          my @sorted_tags;          my $tags = $self->all_tags();
         if ($self->{tags_by_order}) {  
                 @sorted_tags = @{$self->{tags_by_order}};  
         } else {  
                 @sorted_tags = sort { $self->_sort_by_order } keys %{$self->{'import_xml'}->{'indexer'}};  
                 $self->{tags_by_order} = \@sorted_tags;  
         }  
207    
208          my $ds;          $log->debug("tags: ",sub { join(", ",@{ $tags }) });
209    
210          $log->debug("tags: ",sub { join(", ",@sorted_tags) });          my $ds;
211    
212          foreach my $field (@sorted_tags) {          foreach my $field (@{ $tags }) {
213    
214                  my $row;                  my $row;
215    

Legend:
Removed from v.432  
changed lines
  Added in v.433

  ViewVC Help
Powered by ViewVC 1.1.26