Tags:
create new tag
, view all tags

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

TWiki version: TWikiAlphaRelease
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: Gentoo Linux
Web server: Apache 2.0.49
Perl version: 5.8.2
Client OS:  
Web Browser:  

-- 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

Topic revision: r2 - 2004-06-02 - PeterThoeny
 
Twitter Delicious Facebook Digg Google Bookmarks E-mail LinkedIn Reddit StumbleUpon    
  • Download TWiki
TWiki logo Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2012 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.