Using the API in Standalone Perl Scripts

The extensive Webmin API can also be called from your own Perl scripts that do not run under miniserv, as long as they run as root. The easiest way to do this is to install the Webmin::API Perl module, which takes care of a lot of the boilerplate code that would be otherwise required.

The steps to install and use this module are :

  1. Download the Webmin::API Perl module from : http://www.webmin.com/Webmin-API-1.0.tar.gz
  2. Extract and install it with the following commands, run as root :
    tar xvzf Webmin-API-1.0.tar.gz
    cd Webmin-API
    perl Makefile.PL
    make install
  3. Create a new Perl script, starting with :
    #!/usr/bin/perl
    use Webmin::API;

Your script can then call all the core Webmin functions, like find_byname, foreign_require and so on. There is no need to call init_config - it will be run for you when the module is imported

-- JamieCameron - 27 Mar 2009

Edit | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r1 | More topic actions
Topic revision: r1 - 27 Mar 2009 - 23:38:32 - JamieCameron
 
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback