mirror of
https://github.com/webmin/webmin.git
synced 2026-03-20 08:40:24 +00:00
Add API to return subroutine name of a code reference bafc3db725
This commit is contained in:
@@ -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));
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user