require "Getopt/Declare" def encode(t) return Getopt::Declare.new(t,['-BUILD']).code end =begin Just type in something, like: =for Getopt::Declare -a Append mode =cut =end $/ = '=cut' if t = $stdin.readline t.sub!( /^=for\s+Getopt::Declare\s*\n(.*?)\n=cut/esm ) { '(self,source) = []'+encode("#$1") } end print t