# ---------------------------------------------------------------------- # LANGUAGE: Perl API # ====================================================================== # AUTHOR: Michael McLennan, Purdue University # Copyright (c) 2004-2012 HUBzero Foundation, LLC # # See the file "license.terms" for information on usage and # redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. # ====================================================================== language "Perl" { extension ".pl" command {perl @tool/@@FILENAME@@ @driver} main {# ---------------------------------------------------------------------- # MAIN PROGRAM - generated by the Rappture Builder # ---------------------------------------------------------------------- use Rappture; # open the XML file containing the run parameters $io = Rappture::RpLibrary->new($ARGV[0]); ######################################################### # Get input values from Rappture ######################################################### @@INPUTS@@ ######################################################### # Add your code here for the main body of your program ######################################################### # spit out progress messages as you go along... Rappture::Utils::progress(0, "Starting..."); Rappture::Utils::progress(5, "Loading data..."); Rappture::Utils::progress(50, "Half-way there"); Rappture::Utils::progress(100, "Done"); ######################################################### # Save output values back to Rappture ######################################################### @@OUTPUTS@@ $io->result(); exit 0; } input boolean { code "\n# get input value for $path" code "# returns value as string \"yes\" or \"no\"" code "\$str = \$io->get(\"$path.current\");" code "\$$id = (\$str) ? \"yes\" : \"no\";" } input image { code "\n# get input value for $path" code "# returns base64-encoded image data" code "\$$id = \$io->get(\"$path.current\");" } input number { set units [attr get units] if {$units ne ""} { code "\n# get input value for $path and convert to $units" code "\$str = \$io->get(\"$path.current\");" code "$$id = Rappture::RpUnits::convert(\$str, \"$units\", \"off\");" } else { code "\n# get input value for $path" code "\$$id = \$io->get(\"$path.current\");" } } input * { code "\n# get input value for $path" code "\$$id = \$io->get(\"$path.current\");" } output curve { code "\n# save output value for $path" code "# this shows just one (x,y) point -- modify as needed" code "\$io->put(\"$path.component.xy\", \"\$x \$y\\n\", 1);" } output histogram { code "\n# save output value for $path" code "# this shows just one point -- modify as needed" code "# (x,h,w) = x-coord, height of bar, and width of bar (optional)" code "\$io->put(\"$path.component.xhw\", \"\$x \$h \$w\\n\", 1);" } output image { code "\n# save output value for $path" code "# data in \$$id should be base64-encoded image data" code "\$io->put(\"$path.current\", \$$id, 0);" } output * { code "\n# save output value for $path" code "\$io->put(\"$path.current\", \$$id, 0);" } }