Question
Hello, all. What's the best way to run a TWiki
AddOnPackage script (specifically the 'bin/publish' script from the
PublishAddOn) from a Plugin (specifically in the afterSaveHandler)? I'm making a plugin that publishes the topic's static HTML page after each save, so the static version of my TWiki is updated in real-time instead of using a cron-job with delays.
Thanks.
Environment
--
AdamTheo - 10 Apr 2004
Answer
Simply execute the command with backticks. Pseudo example:
my $err = "";
my $output = `/path/to/program -c 'any parameters' $web.$topic |
/path/to/second_program in pipe if needed 2>&1`;
if ($?) {
$err = "Could not execute program";
} else {
# do something with $output;
}
Pay attention to the current directory. Do not assume that it is set to the current twiki/bin.
--
PeterThoeny - 02 Jun 2004