]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/extras/import/generate-srfsh-wormer.pl
fixing up the import process -- using the perl dumper
[Evergreen.git] / Open-ILS / src / extras / import / generate-srfsh-wormer.pl
1 #!/usr/bin/perl -w
2 use strict;
3 use Getopt::Long;
4
5 my ($start, $stop, $count, $group, $out) = (1,1,1,50,'dynamic-wormizer-script.sfsh');
6 GetOptions (    "start=i" => \$start,
7                 "end=i"   => \$stop,
8                 "groupsize=i"   => \$group,
9                 "count=i"   => \$count,
10                 "output=s"   => \$out,
11 );
12
13 $stop = $start + $count unless ($stop);
14
15 open SFSH, ">$out" or die("Can't open $out!  $!");
16
17 my @list;
18 for my $i ( $start .. $stop ) {
19         if ( $i % $group ) {
20                 push @list, $i;
21                 next;
22         }
23         print SFSH "request open-ils.storage open-ils.worm.wormize.no_map.batch ".join(',', @list)."\n" if (@list);
24         @list = ($i);
25 }
26 print SFSH "request open-ils.storage open-ils.worm.wormize.no_map.no_map.batch ".join(',', @list)."\n" if (@list);