: eval 'exec perl -w -S `echo $0 | sed "s/.*\///" ` ${1+"$@"}' if 0; @a=@ARGV; @flags=grep(/^-/,@a); @other=(); @other=grep(!/^-/,@a); if ( grep( /^-h(elp)?$/,@flags) || scalar(@other) != 1) { $scriptName = $0; $scriptName =~ s%^.*/%%; print <<"END"; Usage: $scriptName [-h -help] Class Print out a prototype of a new java class that implements Cloneable and Object.clone(). END exit;} $rN="\n"; $rN="\n" if ( ! -d "/var" ); $Class=$a[0]; print <<"END"; public class $Class implements Cloneable { /* Deep copy clone method. */ \@Override public $Class clone() { try { // Super classes should clone their private members. // Highest level Object.clone() is a bit for bit shallow copy. $Class result = ($Class) super.clone(); // Clone each member of this class, but not of superclasses. // result._member = result._member.clone(); // Fake throw always requires catch by compiler if (false) throw new CloneNotSupportedException(); return result; } catch (CloneNotSupportedException ex) { IllegalStateException e = new IllegalStateException(ex.getMessage()); e.initCause(ex); throw e; } } } END