diff --git a/WebminCore.pm b/WebminCore.pm index 66cf6b378..a43b82515 100644 --- a/WebminCore.pm +++ b/WebminCore.pm @@ -24,7 +24,7 @@ require Exporter; # Add global variables in web-lib.pl push(@EXPORT, qw(&unique)); -push(@EXPORT, qw($config_directory $var_directory $remote_error_handler %month_to_number_map %number_to_month_map $webmin_feedback_address $default_lang $default_charset $module_index_name $module_index_link %in $in @in $progress_callback_prefix $progress_callback_url $wait_for_debug $wait_for_input @matches $theme_no_table $webmin_logfile $pragma_no_cache)); +push(@EXPORT, qw($config_directory $var_directory $remote_error_handler %month_to_number_map %number_to_month_map $webmin_feedback_address $default_lang $default_charset $module_index_name $module_index_link %in $in @in $progress_callback_prefix $progress_callback_url $wait_for_debug $wait_for_input @matches $theme_no_table $webmin_logfile $pragma_no_cache get_sub_ref_name)); # Functions defined in themes push(@EXPORT, qw(&theme_post_save_domain &theme_post_save_domains &theme_post_save_server &theme_select_server &theme_select_domain &theme_post_save_folder &theme_post_change_modules &theme_address_button &theme_virtualmin_ui_rating_selector &theme_virtualmin_ui_show_cron_time &theme_virtualmin_ui_parse_cron_time &theme_virtualmin_ui_html_editor_bodytags &theme_virtualmin_ui_show_html_editor &theme_post_change_theme &theme_pre_change_theme)); diff --git a/web-lib-funcs.pl b/web-lib-funcs.pl index 0696c1ffd..7dfcfc0a1 100755 --- a/web-lib-funcs.pl +++ b/web-lib-funcs.pl @@ -11692,6 +11692,28 @@ if (defined(&theme_get_webprefix)) { return $gconfig{'webprefix'} || ''; } +=head2 get_sub_ref_name + +Returns a name of the subroutine name of a code reference + +=cut +sub get_sub_ref_name +{ +my ($sub_ref) = @_; +eval "use B qw(svref_2object);"; +if (!$@) { + if (ref($sub_ref)) { + my $cv = svref_2object ( $sub_ref ); + if ($cv->can(GV)) { + my $gv = $cv->GV; + if ($gv->can(NAME)) { + return $gv->NAME; + } + } + } + } +} + $done_web_lib_funcs = 1; 1;