#!/gec/local/bin-5/perl # This script allows you to use javadoc to document package-level # classes. See the javadoc FAQ Q 15 at: # http://java.sun.com/products/jdk/javadoc/faq.html#private # # NB this expects to be run from the directory where the javadoc # is to be generated. NO FLAGS ARE ACCEPTED. If you want to # affect the behaviour of this program, you can set the environment # variable JAVADOC_FLAGS. # get current directory. $dir=`pwd`; # trim spurious newline. $dir=~s/\s*$//s; # set up javadoc flags. if (defined($ENV{'JAVADOC_FLAGS'})) { $flags=$ENV{'JAVADOC_FLAGS'}; } else { $flags="-d $dir"; } foreach $file (@ARGV) { ($basename=$file)=~s/.*\///; $tmpname="/tmp/$basename"; # workaround for read-only source. `cp $file $tmpname`; # next update that temp file to make all of # its classes public. NB javadoc is likely to choke on # finding more than one public class in a file... # inner classes and anonymous classes cannot be documented # like this. <<`END_SCRIPT`; cd /tmp perl -i.bak -pe 's/^class/public class/' $basename javadoc $flags $basename rm $basename.bak rm $basename END_SCRIPT } <<`END_SCRIPT`; perl -i.bak -pe 's/(