/[Sack]/trunk/lib/Sack/From.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/Sack/From.pm

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

revision 94 by dpavlin, Sat Oct 3 21:09:51 2009 UTC revision 95 by dpavlin, Sun Oct 4 12:17:52 2009 UTC
# Line 10  use WebPAC::Input::ISI; Line 10  use WebPAC::Input::ISI;
10    
11  $WebPAC::Input::ISI::subfields = undef; # disable parsing of subfields  $WebPAC::Input::ISI::subfields = undef; # disable parsing of subfields
12    
13  sub shard {  sub new {
14          my $self = shift;      my $class = shift;
15        my $self  = bless {@_}, $class;
16    
17            warn "from ",dump( @_ );
18    
19            $self->{input} = WebPAC::Input::ISI->new( @_ );
20            warn "got ", $self->{input}->size, " records for ", dump @_;
21    
22            $self->{pos} = 1;
23            $self->{shard} = 0;
24    
25          my $input = WebPAC::Input::ISI->new( @_ );          return $self;
26    }
27    
28    sub input { $_[0]->{input} }
29    
30          warn "got ", $input->size, " records for ", dump @_;  sub shard {
31            my ($self,$limit) = @_;
32    
33            my $start_pos = $self->{pos};
34            $self->{shard}++;
35          my $data;          my $data;
36    
37          foreach my $pos ( 1 .. $input->size ) {          foreach my $pos ( 1 .. $limit ) {
38                  push @$data, $input->fetch_rec( $pos );                  push @$data, $self->input->fetch_rec( $self->{pos}++ );
39          }          }
40    
41            warn "shard $self->{shard} range: $start_pos - $self->{pos} / $limit\n";
42    
43          return $data;          return $data;
44  }  }
45    

Legend:
Removed from v.94  
changed lines
  Added in v.95

  ViewVC Help
Powered by ViewVC 1.1.26