Server IP : 103.119.228.120 / Your IP : 3.133.124.161 Web Server : Apache System : Linux v8.techscape8.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64 User : nobody ( 99) PHP Version : 5.6.40 Disable Function : shell_exec,symlink,system,exec,proc_get_status,proc_nice,proc_terminate,define_syslog_variables,syslog,openlog,closelog,escapeshellcmd,passthru,ocinum cols,ini_alter,leak,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dl,dll,myshellexec,proc_open,socket_bind,proc_close,escapeshellarg,parse_ini_filepopen,fpassthru,exec,passthru,escapeshellarg,escapeshellcmd,proc_close,proc_open,ini_alter,popen,show_source,proc_nice,proc_terminate,proc_get_status,proc_close,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,dl,symlink,shell_exec,system,dl,passthru,escapeshellarg,escapeshellcmd,myshellexec,c99_buff_prepare,c99_sess_put,fpassthru,getdisfunc,fx29exec,fx29exec2,is_windows,disp_freespace,fx29sh_getupdate,fx29_buff_prepare,fx29_sess_put,fx29shexit,fx29fsearch,fx29ftpbrutecheck,fx29sh_tools,fx29sh_about,milw0rm,imagez,sh_name,myshellexec,checkproxyhost,dosyayicek,c99_buff_prepare,c99_sess_put,c99getsource,c99sh_getupdate,c99fsearch,c99shexit,view_perms,posix_getpwuid,posix_getgrgid,posix_kill,parse_perms,parsesort,view_perms_color,set_encoder_input,ls_setcheckboxall,ls_reverse_all,rsg_read,rsg_glob,selfURL,dispsecinfo,unix2DosTime,addFile,system,get_users,view_size,DirFiles,DirFilesWide,DirPrintHTMLHeaders,GetFilesTotal,GetTitles,GetTimeTotal,GetMatchesCount,GetFileMatchesCount,GetResultFiles,fs_copy_dir,fs_copy_obj,fs_move_dir,fs_move_obj,fs_rmdir,SearchText,getmicrotime MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/local/ssl/local/ssl/local/ssl/share/perl5/ExtUtils/Constant/ |
Upload File : |
package ExtUtils::Constant::Utils; use strict; use vars qw($VERSION @EXPORT_OK @ISA); use Carp; @ISA = 'Exporter'; @EXPORT_OK = qw(C_stringify perl_stringify); $VERSION = '0.03'; use constant is_perl55 => ($] < 5.005_50); use constant is_perl56 => ($] < 5.007 && $] > 5.005_50); use constant is_sane_perl => $] > 5.007; =head1 NAME ExtUtils::Constant::Utils - helper functions for ExtUtils::Constant =head1 SYNOPSIS use ExtUtils::Constant::Utils qw (C_stringify); $C_code = C_stringify $stuff; =head1 DESCRIPTION ExtUtils::Constant::Utils packages up utility subroutines used by ExtUtils::Constant, ExtUtils::Constant::Base and derived classes. All its functions are explicitly exportable. =head1 USAGE =over 4 =item C_stringify NAME A function which returns a 7 bit ASCII correctly \ escaped version of the string passed suitable for C's "" or ''. It will die if passed Unicode characters. =cut # Hopefully make a happy C identifier. sub C_stringify { local $_ = shift; return unless defined $_; # grr 5.6.1 confess "Wide character in '$_' intended as a C identifier" if tr/\0-\377// != length; # grr 5.6.1 moreso because its regexps will break on data that happens to # be utf8, which includes my 8 bit test cases. $_ = pack 'C*', unpack 'U*', $_ . pack 'U*' if is_perl56; s/\\/\\\\/g; s/([\"\'])/\\$1/g; # Grr. fix perl mode. s/\n/\\n/g; # Ensure newlines don't end up in octal s/\r/\\r/g; s/\t/\\t/g; s/\f/\\f/g; s/\a/\\a/g; unless (is_perl55) { # This will elicit a warning on 5.005_03 about [: :] being reserved unless # I cheat my $cheat = '([[:^print:]])'; if (ord('A') == 193) { # EBCDIC has no ^\0-\177 workalike. s/$cheat/sprintf "\\%03o", ord $1/ge; } else { s/([^\0-\177])/sprintf "\\%03o", ord $1/ge; } s/$cheat/sprintf "\\%03o", ord $1/ge; } else { require POSIX; s/([^A-Za-z0-9_])/POSIX::isprint($1) ? $1 : sprintf "\\%03o", ord $1/ge; } $_; } =item perl_stringify NAME A function which returns a 7 bit ASCII correctly \ escaped version of the string passed suitable for a perl "" string. =cut # Hopefully make a happy perl identifier. sub perl_stringify { local $_ = shift; return unless defined $_; s/\\/\\\\/g; s/([\"\'])/\\$1/g; # Grr. fix perl mode. s/\n/\\n/g; # Ensure newlines don't end up in octal s/\r/\\r/g; s/\t/\\t/g; s/\f/\\f/g; s/\a/\\a/g; unless (is_perl55) { # This will elicit a warning on 5.005_03 about [: :] being reserved unless # I cheat my $cheat = '([[:^print:]])'; if (is_sane_perl) { if (ord('A') == 193) { # EBCDIC has no ^\0-\177 workalike. s/$cheat/sprintf "\\x{%X}", ord $1/ge; } else { s/([^\0-\177])/sprintf "\\x{%X}", ord $1/ge; } } else { # Grr 5.6.1. And I don't think I can use utf8; to force the regexp # because 5.005_03 will fail. # This is grim, but I also can't split on // my $copy; foreach my $index (0 .. length ($_) - 1) { my $char = substr ($_, $index, 1); $copy .= ($char le "\177") ? $char : sprintf "\\x{%X}", ord $char; } $_ = $copy; } s/$cheat/sprintf "\\%03o", ord $1/ge; } else { # Turns out "\x{}" notation only arrived with 5.6 s/([^\0-\177])/sprintf "\\x%02X", ord $1/ge; require POSIX; s/([^A-Za-z0-9_])/POSIX::isprint($1) ? $1 : sprintf "\\%03o", ord $1/ge; } $_; } 1; __END__ =back =head1 AUTHOR Nicholas Clark <nick@ccl4.org> based on the code in C<h2xs> by Larry Wall and others