Annotation of loncom/localize/localize/synch.pl, revision 1.2
1.1 www 1: sub readlexicon {
2: my $fn=shift;
3: open(IN,$fn);
4: my %lexicon=();
5: my $contents=join('',<IN>);
6: close(IN);
7: $contents=~s/package Apache\:[^\;]+//;
8: $contents=~s/use base[^\;]+//;
9: eval($contents.'; %lexicon=%Lexicon;');
10: delete $lexicon{'_AUTO'};
11: delete $lexicon{'char_encoding'};
12: delete $lexicon{'language_code'};
13: return %lexicon;
14: }
15:
1.2 ! www 16: my %master=();
! 17: foreach (<*.pm>) {
! 18: print "Reading: ".$_."\n";
! 19: %master=(%master,&readlexicon($_));
! 20: }
! 21: foreach (<*.pm>) {
! 22: print "Synching: ".$_."\n";
! 23: my %lang=&readlexicon($_);
! 24: copy ($fn,$fn.'.original');
! 25: open(IN,$fn.'.original');
! 26: open(OUT,'>'.$fn);
! 27: my $found=0;
! 28: foreach (<IN>) {
! 29: if ($_=~/\#\s*SYNCMARKER/) { $found=1; last; }
! 30: print OUT $_;
! 31: }
! 32: if ($found) {
! 33: print OUT "\n\#SYNC ".localtime."\n";
! 34:
! 35: print OUT "\n\#SYNCMARKER\n";
! 36: foreach (<IN>) {
! 37: print OUT $_;
! 38: }
! 39: }
! 40: close (IN);
! 41: close (OUT);
! 42: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>