Server IP : 103.119.228.120 / Your IP : 18.218.76.193 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/local/share/perl5/TAP/Formatter/ |
Upload File : |
package TAP::Formatter::Color; use strict; use warnings; use constant IS_WIN32 => ( $^O =~ /^(MS)?Win32$/ ); use base 'TAP::Object'; my $NO_COLOR; BEGIN { $NO_COLOR = 0; if (IS_WIN32) { eval 'use Win32::Console'; if ($@) { $NO_COLOR = $@; } else { my $console = Win32::Console->new( STD_OUTPUT_HANDLE() ); # eval here because we might not know about these variables my $fg = eval '$FG_LIGHTGRAY'; my $bg = eval '$BG_BLACK'; *set_color = sub { my ( $self, $output, $color ) = @_; my $var; if ( $color eq 'reset' ) { $fg = eval '$FG_LIGHTGRAY'; $bg = eval '$BG_BLACK'; } elsif ( $color =~ /^on_(.+)$/ ) { $bg = eval '$BG_' . uc($1); } else { $fg = eval '$FG_' . uc($color); } # In case of colors that aren't defined $self->set_color('reset') unless defined $bg && defined $fg; $console->Attr( $bg | $fg ); }; } } else { eval 'use Term::ANSIColor'; if ($@) { $NO_COLOR = $@; } else { *set_color = sub { my ( $self, $output, $color ) = @_; $output->( color($color) ); }; } } if ($NO_COLOR) { *set_color = sub { }; } } =head1 NAME TAP::Formatter::Color - Run Perl test scripts with color =head1 VERSION Version 3.36 =cut our $VERSION = '3.36'; =head1 DESCRIPTION Note that this harness is I<experimental>. You may not like the colors I've chosen and I haven't yet provided an easy way to override them. This test harness is the same as L<TAP::Harness>, but test results are output in color. Passing tests are printed in green. Failing tests are in red. Skipped tests are blue on a white background and TODO tests are printed in white. If L<Term::ANSIColor> cannot be found (or L<Win32::Console> if running under Windows) tests will be run without color. =head1 SYNOPSIS use TAP::Formatter::Color; my $harness = TAP::Formatter::Color->new( \%args ); $harness->runtests(@tests); =head1 METHODS =head2 Class Methods =head3 C<new> The constructor returns a new C<TAP::Formatter::Color> object. If L<Term::ANSIColor> is not installed, returns undef. =cut # new() implementation supplied by TAP::Object sub _initialize { my $self = shift; if ($NO_COLOR) { # shorten that message a bit ( my $error = $NO_COLOR ) =~ s/ in \@INC .*//s; warn "Note: Cannot run tests in color: $error\n"; return; # abort object construction } return $self; } ############################################################################## =head3 C<can_color> Test::Formatter::Color->can_color() Returns a boolean indicating whether or not this module can actually generate colored output. This will be false if it could not load the modules needed for the current platform. =cut sub can_color { return !$NO_COLOR; } =head3 C<set_color> Set the output color. =cut 1;