while() { if(/\[CALLPERL .*left\]/ ... /\[CALLPERL end\]/) { $code .= $_ if(!/CALLPERL/); $name = $1 if(/.flash.*name=([^&][^ ]*)/); $name = $1 if(/.flash.*name="([^&]*)"/); } elsif(/\[CALLPERL .*right\]/ ... /\[CALLPERL end\]/) { $highlight .= $_ if(!/CALLPERL/); } elsif ($code ne "") { $code =~ s/"/"/g; open(fi, ">tmp.sc");print fi $code;close(fi); system("swfc tmp.sc"); ($embed = `swfdump -e $name`) =~ /WIDTH="([^"]*)"/; $width = $1; print ""; print $embed; print ""; $code=""; print; unlink "tmp.sc"; } elsif ($highlight ne "") { $highlight =~ s/^\n\s*//g; $highlight =~ s/\s*\n$//g; print "
\n";
	# todo: apply syntax highlighting.
	print $highlight."\n";
	print "
\n"; $highlight=""; print; } else { print; } }