7 our @ISA = qw(Exporter);
9 # Items to export into callers namespace by default. Note: do not export
10 # names by default without a very good reason. Use EXPORT_OK instead.
11 # Do not simply export all your public functions/methods/constants.
16 '$remote_error_handler',
17 '%month_to_number_map',
18 '%number_to_month_map',
28 '$module_config_directory',
29 '$module_config_file',
32 '$theme_root_directory',
43 '$module_root_directory',
49 # Find old symbols by Webmin import
50 my %oldsyms = %Webmin::API::;
52 # Preloaded methods go here.
53 $main::no_acl_check++;
54 $ENV{'WEBMIN_CONFIG'} ||= "/etc/webmin";
55 $ENV{'WEBMIN_VAR'} ||= "/var/webmin";
56 open(MINISERV, $ENV{'WEBMIN_CONFIG'}."/miniserv.conf") ||
57 die "Could not open Webmin config file ".
58 $ENV{'WEBMIN_CONFIG'}."/miniserv.conf : $!";
67 $webmin_root || die "Could not find Webmin root directory";
69 if ($0 =~ /\/([^\/]+)$/) {
70 $0 = $webmin_root."/".$1;
73 $0 = $webmin_root."/api.pl"; # Fake name
75 require './web-lib.pl';
79 foreach my $lib ("$webmin_root/web-lib.pl",
80 "$webmin_root/web-lib-funcs.pl") {
83 if (/^sub\s+([a-z0-9\_]+)/i) {
89 our @EXPORT_OK = ( @EXPORT );
96 Webmin::API - Perl module to make calling of Webmin functions from regular
97 command-line Perl scripts easier.
102 @pids = &find_byname("httpd");
103 foreign_require("cron", "cron-lib.pl");
104 @jobs = &cron::list_cron_jobs();
108 This module just provides a convenient way to call Webmin API functions
109 from a script that is not run as a Webmin CGI, without having to include a
110 bunch of boilerplate initialization code at the top. It's main job is to export
111 all API functions into the namespace of the caller, and to setup the Webmin
116 All core Webmin API functions, like find_byname, foreign_config and so on.
120 Jamie Cameron, jcameron@webmin.com