3 # THIS IS A FUCKING CHEESY HACK. DON'T RUN IT ON ANYTHING YOU CARE ABOUT
4 # (and don't have in svn at least. Oh, and it breaks horribly on with)
11 foreach my $file (@ARGV) {
13 { local $/; $data = <IN>; }
15 unless ($data =~ m/(.*?\n)(?:extends (.*?);)?\n+?(has.*)\n(1;\s*\n.*)/s) {
16 warn "Failed to match for ${file}\n";
19 my ($front, $super_list, $body, $rest) = ($1, $2, $3, $4);
20 my @supers = split(/\s*,\s*/, $super_list);
21 my $pkg = (split(/\//, $file))[-1];
23 $body =~ s/^sub (\S+) {$/method $1 => sub {/mg;
25 $body =~ s/^(\S+) '([^\+]\S+)' =>/$1 $2 =>/mg;
27 my $is_list = join('', map { "is $_, " } @supers);
29 print OUT "${front}class ${pkg} ${is_list}which {\n${body}\n};\n\n${rest}";