3 foreach $file ( split(/\n/, `find . -depth -print | grep cgi\$`) ) {
4 open(F,$file) or die "can't open $file for reading: $!";
6 #print "$file ". scalar(@file). "\n";
8 system("chmod u+w $file");
9 open(W,">$file") or die "can't open $file for writing: $!";
10 select W; $| = 1; select STDOUT;
11 $all = join('',@file);
14 while ( length($all) ) {
16 if ( $mode eq 'html' ) {
18 if ( $all =~ /^(.+?)(<%=?.*)$/s && $1 !~ /<%/s ) {
22 } elsif ( $all =~ /^<%=(.*)$/s ) {
28 } elsif ( $all =~ /^<%(.*)$/s ) {
33 } elsif ( $all !~ /<%/s ) {
37 warn length($all); die;
41 } elsif ( $mode eq 'perlv' ) {
43 if ( $all =~ /^(.*?%>)(.*)$/s ) {
49 die 'unterminated <%= ???';
51 } elsif ( $mode eq 'perlc' ) {
53 if ( $all =~ /^([^\n]*?)%>(.*)$/s ) {
59 if ( $all =~ /^([^\n]*)\n(.*)$/s ) {