9 our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
12 @EXPORT = qw(%oceans %commods &parse_masters);
18 our %oceans; # eg $oceans{'Midnight'}{'Ruby'}{'Eta Island'}= $sources
19 our %commods; # eg $commods{'Fine black cloth'}= $sources;
21 # 's' = Special Circumstances; 'l' = local ; B = with Bleach
23 my %colours; # eg $colours{'c'}{'black'}= $sources
24 my @rawcm; # eg $rawcm[0]='fine rum'; $rawcm[1]='fine %c cloth'
26 sub parse_master_master1 ($$) {
28 my $mm= new IO::File $mmfn, 'r' or die "$mmfn $!";
36 @ctx= (sub { $colours{$colourkind}{lc $_} .= $src; });
37 } elsif (m/^commods$/) {
38 @ctx= (sub { push @rawcm, lc $_; });
39 } elsif (m/^ocean (\w+)$/) {
42 $ocean or die; # ref to $ocean needed to work
46 $oceans{$ocean}{$arch}{$_} .= $src;
50 my $indent= length $&;
51 die "wrong indent $indent" unless defined $ctx[$indent-1];
52 &{ $ctx[$indent-1] }();
57 $mm->error and die $!;
60 #print Dumper(\%oceans);
61 #print Dumper(\@rawcm);
68 if ($s !~ m/\%(\w+)/) { $commods{ucfirst $s} .= $ss; return; }
69 die "unknown $&" unless defined $colours{$1};
70 foreach my $c (keys %{ $colours{$1} }) {
71 &$ca($`.$c.$', $ss .'%'. $colours{$1}{$c});
74 foreach (@rawcm) { &$ca($_,$src); }
77 sub parse_masters () {
78 parse_master_master1('master-master.txt','s');