File Coverage

blib/lib/Proc/ProcessTable/Colorizer.pm
Criterion Covered Total %
statement 23 545 4.2
branch 0 240 0.0
condition 0 216 0.0
subroutine 8 37 21.6
pod 26 29 89.6
total 57 1067 5.3


line stmt bran cond sub pod time code
1             package Proc::ProcessTable::Colorizer;
2              
3 1     1   54688 use 5.006;
  1         3  
4 1     1   4 use strict;
  1         2  
  1         18  
5 1     1   4 use warnings;
  1         1  
  1         42  
6 1     1   5 use base 'Error::Helper';
  1         2  
  1         424  
7 1     1   1039 use Proc::ProcessTable;
  1         4072  
  1         38  
8 1     1   539 use Term::ANSIColor;
  1         6745  
  1         66  
9 1     1   559 use Text::Table;
  1         8501  
  1         33  
10 1     1   372 use Term::Size;
  1         478  
  1         4748  
11              
12             =head1 NAME
13              
14             Proc::ProcessTable::Colorizer - Like ps, but with colored columns and enhnaced functions for searching.
15              
16             =head1 VERSION
17              
18             Version 0.3.1
19              
20             =cut
21              
22             our $VERSION = '0.3.1';
23              
24              
25             =head1 SYNOPSIS
26              
27             use Proc::ProcessTable::Colorizer;
28              
29             my $cps = Proc::ProcessTable::Colorizer->new;
30             print $cps->colorize;
31              
32             This module uses L for error reporting.
33              
34             As of right now this module is not really user friend and will likely be going through lots of changes as it grows.
35              
36             =head1 METHODS
37              
38             =head2 new
39              
40             Creates a new object. This method will never error.
41              
42             my $cps=Proc::ProcessTable::Colorizer->new;
43              
44             =cut
45              
46             sub new {
47 0     0 1   my $self={
48             perror=>undef,
49             error=>undef,
50             errorString=>'',
51             errorExtra=>{
52             1=>'badTimeString',
53             2=>'badPctcpuString',
54             },
55             colors=>[
56             'BRIGHT_YELLOW',
57             'BRIGHT_CYAN',
58             'BRIGHT_MAGENTA',
59             'BRIGHT_BLUE'
60             ],
61             timeColors=>[
62             'GREEN',
63             'BRIGHT_GREEN',
64             'RED',
65             'BRIGHT_RED'
66             ],
67             processColor=>'WHITE',
68             fields=>[
69             'pid',
70             'uid',
71             'pctcpu',
72             'pctmem',
73             'size',
74             'rss',
75             'info',
76             'nice',
77             'start',
78             'time',
79             'proc',
80             ],
81             header=>1,
82             search=>undef,
83             resolveUser=>1,
84             nextColor=>0,
85             showIdle=>0,
86             proc_search=>undef,
87             user_search=>[],
88             wait_search=>[],
89             self_ignore=>2,
90             zombie_search=>0,
91             swapped_out_search=>0,
92             time_search=>[],
93             pctcpu_search=>[],
94             };
95 0           bless $self;
96              
97             # Proc::ProcessTable does not return a nice value for Linux
98 0 0         if ($^O =~ /linux/){
99             $self->{fields}=[
100 0           'pid',
101             'uid',
102             'pctcpu',
103             'pctmem',
104             'size',
105             'rss',
106             'info',
107             'start',
108             'time',
109             'proc',
110             ];
111             }
112              
113 0 0         if ($^O =~ /bsd/){
114 0           $self->{physmem}=`/sbin/sysctl -a hw.physmem`;
115 0           chomp($self->{physmem});
116 0           $self->{physmem}=~s/^.*\: //;
117             }
118              
119 0           return $self;
120             }
121              
122             =head2 colorize
123              
124             This colorizes it and returns a setup Text::Table object with everything already setup.
125              
126             use Proc::ProcessTable::Colorizer;
127             my $cps = Proc::ProcessTable::Colorizer->new;
128             print $cps->colorize;
129              
130             =cut
131              
132             sub colorize{
133 0     0 1   my $self=$_[0];
134 0           $self->errorblank;
135              
136             #the feilds to use
137 0           my $fields=$self->fieldsGet;
138              
139             #array of colored items
140 0           my @colored;
141              
142             #
143 0           my $fieldInt=0;
144 0           my $header;
145 0 0         if ( $self->{header} ){
146 0           my @header;
147 0           while ( defined( $fields->[$fieldInt] ) ){
148 0           my $field=color('underline white');
149              
150 0 0         if ( $fields->[$fieldInt] eq 'pid' ){
    0          
    0          
    0          
    0          
    0          
    0          
151 0           $field=$field.'PID';
152             }elsif( $fields->[$fieldInt] eq 'uid' ){
153 0           $field=$field.'User';
154             }elsif( $fields->[$fieldInt] eq 'pctcpu' ){
155 0           $field=$field.'CPU%';
156             }elsif( $fields->[$fieldInt] eq 'pctmem' ){
157 0           $field=$field.'Mem%';
158             }elsif( $fields->[$fieldInt] eq 'size' ){
159 0           $field=$field.'VM Size';
160             }elsif( $fields->[$fieldInt] eq 'rss' ){
161 0           $field=$field.'RSS';
162             }elsif( $fields->[$fieldInt] eq 'proc' ){
163 0           $field=$field.'Command';
164             }else{
165 0           $field=$field.ucfirst($fields->[$fieldInt]);
166             }
167              
168 0           push( @header, $field.color('reset') );
169              
170 0           $fieldInt++;
171             }
172              
173 0           push( @colored, \@header );
174             }
175              
176             #get the process table
177 0           my $pt=Proc::ProcessTable->new;
178              
179             #an array of procs
180 0           my @procs;
181              
182             #goes through it all and gathers the information
183 0           foreach my $proc ( @{$pt->table} ){
  0            
184              
185             #process the requested fields
186 0           $fieldInt=0;
187 0           my %values;
188 0           while ( defined( $fields->[$fieldInt] ) ){
189 0           my $field=$fields->[$fieldInt];
190              
191 0 0 0       if (
    0 0        
    0          
    0          
192             ($^O =~ /bsd/) &&
193             ( $field =~ /pctmem/ )
194             ){
195 0           my $rss=$proc->{rssize};
196 0 0         if ( defined( $rss ) ){
197 0           $rss=$rss*1024*4;
198 0           $values{pctmem}=($rss / $self->{physmem})*100;
199             }else{
200 0           $values{pctmem}=0;
201             }
202             }elsif(
203             ($^O =~ /bsd/) &&
204             ( $field =~ /rss/ )
205             ){
206 0           $values{rss}=$proc->{rssize};
207 0 0         if (!defined $values{rss} ){
208 0           $values{rss}=0;
209             }else{
210             #not sure why this needs done :/
211 0           $values{rss}=$values{rss}*4;
212             }
213             }elsif(
214             $field eq 'proc'
215             ){
216 0           my $fname=$proc->fname;
217 0           my $cmndline=$proc->cmndline;
218              
219             #save it for possible future use
220 0           $values{fname}=$fname;
221 0           $values{cmndline}=$cmndline;
222              
223             #set the proc value
224 0 0         if ( $cmndline =~ /^$/ ){
225 0           my $kernel_proc=1; #just assuming yet, unless it is otherwise
226              
227             #may possible be a zombie, run checks for on FreeBSD
228 0 0 0       if (
229             ($^O =~ /bsd/) &&
230             ( hex($proc->flags) & 0x00200000 )
231             ){
232 0           $kernel_proc=1;
233             }
234              
235             #need to find something similar as above for Linux
236              
237             #
238 0 0         if ( $kernel_proc ){
239 0           $values{'proc'}='['.$fname.']';
240 0 0         if ( $fname eq 'idle' ){
241 0           $values{'idle'}=1;
242             }
243             }else{
244             #most likely a zombie
245 0           $values{'proc'}=$fname;
246             }
247             }else{
248 0 0         if ( $cmndline =~ /^su *$/ ){
249 0           $values{'proc'}=$cmndline.'('.$fname.')';
250             }else{
251 0           $values{'proc'}=$cmndline;
252             }
253             }
254             }elsif(
255             $field eq 'info'
256             ){
257 0           $values{wchan}=$proc->wchan;
258 0           $values{state}=$proc->state;
259              
260 0 0         if ($^O =~ /bsd/){
261 0           $values{is_session_leader}=0;
262 0           $values{is_being_forked}=0;
263 0           $values{working_on_exiting}=0;
264 0           $values{has_controlling_terminal}=0;
265 0           $values{is_locked}=0;
266 0           $values{traced_by_debugger}=0;
267             #$values{is_stopped}=0;
268 0           $values{posix_advisory_lock}=0;
269              
270 0 0         if ( hex($proc->flags) & 0x00002 ){ $values{controlling_tty_active}=1; }
  0            
271 0 0         if ( hex($proc->flags) & 0x00000002 ){$values{is_session_leader}=1; }
  0            
272             #if ( hex($proc->flags) & ){$values{is_being_forked}=1; }
273 0 0         if ( hex($proc->flags) & 0x02000 ){$values{working_on_exiting}=1; }
  0            
274 0 0         if ( hex($proc->flags) & 0x00002 ){$values{has_controlling_terminal}=1; }
  0            
275 0 0         if ( hex($proc->flags) & 0x00000004 ){$values{is_locked}=1; }
  0            
276 0 0         if ( hex($proc->flags) & 0x00800 ){$values{traced_by_debugger}=1; }
  0            
277 0 0         if ( hex($proc->flags) & 0x00001 ){$values{posix_advisory_lock}=1; }
  0            
278             }
279              
280             }else{
281 0           $values{$field}=$proc->$field;
282             }
283              
284              
285 0           $fieldInt++;
286             }
287              
288 0 0         if ( ! defined( $values{pctmem} ) ){
289 0           $values{pctmem} = 0;
290             }
291 0 0         if ( ! defined( $values{pctcpu} ) ){
292 0           $values{pctcpu} = 0;
293             }
294              
295 0 0         if ( ! defined( $values{size} ) ){
296 0           $values{size} = 0;
297             }
298              
299 0           $values{pctmem}=sprintf('%.2f', $values{pctmem});
300 0           $values{pctcpu}=sprintf('%.2f', $values{pctcpu});
301              
302 0           $values{size}=$values{size}/1024;
303              
304 0           push( @procs, \%values );
305              
306             }
307              
308             #sort by CPU percent and then RAM
309             @procs=sort {
310 0           $a->{pctcpu} <=> $b->{pctcpu} or
311             $a->{pctmem} <=> $b->{pctmem} or
312             $a->{rss} <=> $b->{rss} or
313             $a->{size} <=> $b->{size} or
314             $a->{time} <=> $b->{time}
315 0 0 0       } @procs;
      0        
      0        
316 0           @procs=reverse(@procs);
317              
318             #put together the colored colums, minus the proc column which will be done later
319 0           my @proc_column;
320 0           foreach my $proc (@procs){
321 0           my @line;
322 0           $self->nextColorReset;
323              
324 0           my $show=0;
325              
326             #checks if it is the idle proc and if it should show it
327 0 0 0       if (
328             defined ( $proc->{idle} ) &&
329             ( ! $self->{showIdle} )
330             ){
331 0           $show = 0;
332             }else{
333 0           my $required_hits=0; #number of hits required to print it
334 0           my $hits=0; #default to zero so we print it unless we increment this for a search item
335              
336             #checks if we need to do a proc search
337 0           my $proc_search=$self->{proc_search};
338 0 0         if ( defined( $proc_search ) ){
339 0           $required_hits++;
340             #cehck if the cmndline or fname matches
341 0 0         if ( $proc->{proc} =~ /$proc_search/ ){
342 0           $hits++;
343             }
344             }
345              
346             #check to see if it needs to search for users
347 0           my $user_search_array=$self->userSearchGet;
348 0 0         if ( defined( $user_search_array->[0] ) ){
349 0           my $user=getpwuid($proc->{uid});
350 0           $required_hits++;
351 0           my $user_search_int=0;
352 0           my $matched=0;
353             #search while we have a user defined and it has not already been matched
354 0   0       while(
355             defined( $user_search_array->[ $user_search_int ] ) &&
356             ( $matched == 0 )
357             ){
358 0           my $to_match=$user_search_array->[ $user_search_int ];
359 0           my $to_invert=0;
360 0 0         if ( $to_match=~ /^\!/ ){
361 0           $to_invert=1;
362 0           $to_match=~s/^\!//;
363             }
364              
365             #check if it matches
366 0 0         if ( $to_invert ){
367 0 0         if ( $to_match ne $user ){
368 0           $hits++;
369 0           $matched=1;
370             }
371             }else{
372 0 0         if ( $to_match eq $user ){
373 0           $hits++;
374 0           $matched=1;
375             }
376             }
377              
378 0           $user_search_int++;
379             }
380             }
381              
382             #check to see if it needs to search for wait channels
383 0           my $wait_search_array=$self->waitSearchGet;
384 0 0         if ( defined( $wait_search_array->[0] ) ){
385 0           $required_hits++;
386 0           my $wait_search_int=0;
387 0           my $matched=0;
388             #search while we have a wait channel defined and it has not already been matched
389 0   0       while(
390             defined( $wait_search_array->[ $wait_search_int ] ) &&
391             ( $matched == 0 )
392             ){
393 0           my $to_match=$wait_search_array->[ $wait_search_int ];
394 0           my $to_invert=0;
395 0 0         if ( $to_match=~ /^\!/ ){
396 0           $to_invert=1;
397 0           $to_match=~s/^\!//;
398             }
399              
400             #check if it matches
401 0 0         if ( $to_invert ){
402 0 0         if ( $to_match ne $proc->{wchan} ){
403 0           $hits++;
404 0           $matched=1;
405             }
406             }else{
407 0 0         if ( $to_match eq $proc->{wchan} ){
408 0           $hits++;
409 0           $matched=1;
410             }
411             }
412              
413 0           $wait_search_int++;
414             }
415              
416             }
417              
418             #check to see if it needs to search for CPU time usage
419 0           my $time_search_array=$self->timeSearchGet;
420 0 0         if ( defined( $time_search_array->[0] ) ){
421 0           $required_hits++;
422 0           my $time_search_int=0;
423 0           my $matched=0;
424             #search while we have a CPU time defined and it has not already been matched
425 0   0       while(
426             defined( $time_search_array->[ $time_search_int ] ) &&
427             ( $matched == 0 )
428             ){
429 0           my $checked=0;
430 0           my $to_match=$time_search_array->[ $time_search_int ];
431 0           my $time=$proc->{time};
432             #checks for less than or equal
433 0 0 0       if (
434             ( $to_match =~ /^\<\=/ ) &&
435             ( $checked == 0 )
436             ){
437 0           $checked++;
438 0           $to_match =~ s/^\<\=//;
439 0 0         if ( $time <= $to_match ){
440 0           $hits++;
441 0           $matched++;
442             }
443             }
444              
445             #checks for less than
446 0 0 0       if (
447             ( $to_match =~ /^\
448             ( $checked == 0 )
449             ){
450 0           $checked++;
451 0           $to_match =~ s/^\
452 0 0         if ( $time < $to_match ){
453 0           $hits++;
454 0           $matched++;
455             }
456             }
457              
458             #checks for greater than or equal
459 0 0 0       if (
460             ( $to_match =~ /^\>=/ ) &&
461             ( $checked == 0 )
462             ){
463 0           $checked++;
464 0           $to_match =~ s/^\>\=//;
465 0 0         if ( $time >= $to_match ){
466 0           $hits++;
467 0           $matched++;
468             }
469             }
470              
471             #checks for greater than
472 0 0 0       if (
473             ( $to_match =~ /^\>/ ) &&
474             ( $checked == 0 )
475             ){
476 0           $checked++;
477 0           $to_match =~ s/^\>//;
478 0 0         if ( $time > $to_match ){
479 0           $hits++;
480 0           $matched++;
481             }
482             }
483 0           $time_search_int++;
484             }
485             }
486              
487             #check to see if it needs to search for CPU percent
488 0           my $pctcpu_search_array=$self->pctcpuSearchGet;
489 0 0         if ( defined( $pctcpu_search_array->[0] ) ){
490 0           $required_hits++;
491 0           my $pctcpu_search_int=0;
492 0           my $matched=0;
493             #search while we have a CPU usage defined and it has not already been matched
494 0   0       while(
495             defined( $pctcpu_search_array->[ $pctcpu_search_int ] ) &&
496             ( $matched == 0 )
497             ){
498 0           my $checked=0;
499 0           my $to_match=$pctcpu_search_array->[ $pctcpu_search_int ];
500 0           my $time=$proc->{pctcpu};
501             #checks for less than or equal
502 0 0 0       if (
503             ( $to_match =~ /^\<\=/ ) &&
504             ( $checked == 0 )
505             ){
506 0           $checked++;
507 0           $to_match =~ s/^\<\=//;
508 0 0         if ( $time <= $to_match ){
509 0           $hits++;
510 0           $matched++;
511             }
512             }
513              
514             #checks for less than
515 0 0 0       if (
516             ( $to_match =~ /^\
517             ( $checked == 0 )
518             ){
519 0           $checked++;
520 0           $to_match =~ s/^\
521 0 0         if ( $time < $to_match ){
522 0           $hits++;
523 0           $matched++;
524             }
525             }
526              
527             #checks for greater than or equal
528 0 0 0       if (
529             ( $to_match =~ /^\>=/ ) &&
530             ( $checked == 0 )
531             ){
532 0           $checked++;
533 0           $to_match =~ s/^\>\=//;
534 0 0         if ( $time >= $to_match ){
535 0           $hits++;
536 0           $matched++;
537             }
538             }
539              
540             #checks for greater than
541 0 0 0       if (
542             ( $to_match =~ /^\>/ ) &&
543             ( $checked == 0 )
544             ){
545 0           $checked++;
546 0           $to_match =~ s/^\>//;
547 0 0         if ( $time > $to_match ){
548 0           $hits++;
549 0           $matched++;
550             }
551             }
552              
553 0           $pctcpu_search_int++;
554             }
555             }
556              
557             #check to see if it needs to search for memory percent
558 0           my $pctmem_search_array=$self->pctmemSearchGet;
559 0 0         if ( defined( $pctmem_search_array->[0] ) ){
560 0           $required_hits++;
561 0           my $pctmem_search_int=0;
562 0           my $matched=0;
563             #search while we have a memory usage defined and it has not already been matched
564 0   0       while(
565             defined( $pctmem_search_array->[ $pctmem_search_int ] ) &&
566             ( $matched == 0 )
567             ){
568 0           my $checked=0;
569 0           my $to_match=$pctmem_search_array->[ $pctmem_search_int ];
570 0           my $pctmem=$proc->{pctmem};
571             #checks for less than or equal
572 0 0 0       if (
573             ( $to_match =~ /^\<\=/ ) &&
574             ( $checked == 0 )
575             ){
576 0           $checked++;
577 0           $to_match =~ s/^\<\=//;
578 0 0         if ( $pctmem <= $to_match ){
579 0           $hits++;
580 0           $matched++;
581             }
582             }
583              
584             #checks for less than
585 0 0 0       if (
586             ( $to_match =~ /^\
587             ( $checked == 0 )
588             ){
589 0           $checked++;
590 0           $to_match =~ s/^\
591 0 0         if ( $pctmem < $to_match ){
592 0           $hits++;
593 0           $matched++;
594             }
595             }
596              
597             #checks for greater than or equal
598 0 0 0       if (
599             ( $to_match =~ /^\>=/ ) &&
600             ( $checked == 0 )
601             ){
602 0           $checked++;
603 0           $to_match =~ s/^\>\=//;
604 0 0         if ( $pctmem >= $to_match ){
605 0           $hits++;
606 0           $matched++;
607             }
608             }
609              
610             #checks for greater than
611 0 0 0       if (
612             ( $to_match =~ /^\>/ ) &&
613             ( $checked == 0 )
614             ){
615 0           $checked++;
616 0           $to_match =~ s/^\>//;
617 0 0         if ( $pctmem > $to_match ){
618 0           $hits++;
619 0           $matched++;
620             }
621             }
622            
623 0           $pctmem_search_int++;
624             }
625             }
626            
627             #show zombie procs
628 0 0         if ( $self->{zombie_search} ){
629 0           $required_hits++;
630 0 0         if ( $proc->{state} eq 'zombie' ){
631 0           $hits++;
632             }
633             }
634              
635             #show swapped out procs
636 0 0         if ( $self->{swapped_out_search} ){
637 0           $required_hits++;
638 0 0 0       if (
639             ( $proc->{state} ne 'zombie' ) &&
640             ( $proc->{rss} == '0' )
641             ){
642 0           $hits++;
643             }
644             }
645              
646             #checks to see if it should ignore its self
647 0           my $self_ignore=$self->{self_ignore};
648 0 0 0       if (
    0 0        
      0        
649             #if it is set to 1
650             ( $self_ignore == 1 ) &&
651             ( $proc->{pid} == $$ )
652             ){
653 0           $required_hits++;
654             }elsif(
655             #if it is set to 2... we only care if we are doing a search...
656             #meaning required hits are greater than zero
657             ( $required_hits > 0 ) &&
658             ( $self_ignore == 2 ) &&
659             ( $proc->{pid} == $$ )
660             ){
661             #increment this so it will always be off by one for this proc, meaning it is ignored
662 0           $required_hits++;
663             }
664              
665 0 0         if ( $required_hits == $hits ){
666 0           $show=1;
667             }
668             }
669              
670 0 0         if (
671             ( $show )
672             ){
673              
674 0           foreach my $field ( @{$fields} ){
  0            
675 0           my $item='';
676 0 0         if ( defined( $proc->{$field} ) ){
677 0           $item=$proc->{$field};
678             }
679             #we will add proc later once we know the size of the table
680 0 0         if ($field ne 'proc'){
681 0 0         if ( $field eq 'start' ){
682 0           $item=$self->startString($item);
683             }
684              
685 0 0 0       if (
686             ( $field eq 'uid' ) &&
687             $self->{resolveUser}
688             ){
689 0           $item=getpwuid($item);
690             }
691              
692             #colorizes it
693 0 0         if ( $field eq 'time' ){
    0          
    0          
694 0 0         if ( $^O =~ 'linux' ){
695 0           $item=$item/1000000;
696             }
697 0           $item=$self->timeString($item);
698             }elsif( $field eq 'proc' ){
699 0           $item=color($self->processColorGet).$item;
700             }elsif( $field eq 'info'){
701 0           my $left=$proc->{state};
702 0 0         if (
    0          
    0          
    0          
703             $left eq 'sleep'
704             ){
705 0           $left='S';
706             }elsif(
707             $left eq 'zombie'
708             ){
709 0           $left='Z';
710             }elsif(
711             $left eq 'wait'
712             ){
713 0           $left='W';
714             }elsif(
715             $left eq 'run'
716             ){
717 0           $left='R';
718             }
719              
720             #checks if it is swapped out
721 0 0 0       if (
722             ( $proc->{state} ne 'zombie' ) &&
723             ( $proc->{rss} == '0' )
724             ){
725 0           $left=$left.'O';
726             }
727              
728             #waiting to exit
729 0 0 0       if (
730             ( defined( $proc->{working_on_exiting} ) ) &&
731             $proc->{working_on_exiting}
732             ){
733 0           $left=$left.'E';
734             }
735              
736             #session leader
737 0 0 0       if (
738             ( defined( $proc->{is_session_leader} ) ) &&
739             $proc->{is_session_leader}
740             ){
741 0           $left=$left.'s';
742             }
743              
744             #checks to see if any sort of locks are present
745 0 0 0       if (
      0        
      0        
746             ( defined( $proc->{is_locked} ) || defined( $proc->{posix_advisory_lock} ) )&&
747             ( $proc->{is_locked} || $proc->{posix_advisory_lock} )
748             ){
749 0           $left=$left.'L';
750             }
751              
752             #checks to see if has a controlling terminal
753 0 0 0       if (
754             ( defined( $proc->{has_controlling_terminal} ) ) &&
755             $proc->{has_controlling_terminal}
756             ){
757 0           $left=$left.'+';
758             }
759              
760             #if it is being forked
761 0 0 0       if (
762             ( defined( $proc->{is_being_forked} ) ) &&
763             $proc->{is_being_forked}
764             ){
765 0           $left=$left.'F';
766             }
767              
768             #checks if it knows it is being traced
769 0 0 0       if (
770             ( defined( $proc->{traced_by_debugger} ) ) &&
771             $proc->{traced_by_debugger}
772             ){
773 0           $left=$left.'X';
774             }
775              
776 0 0         if ( $^O =~ 'linux' ){
777 0           $item=color($self->nextColor).$left.' '.color($self->nextColor);
778             }else{
779 0           $item=color($self->nextColor).$left.' '.color($self->nextColor).$proc->{wchan};
780             }
781              
782             }else{
783 0           $item=color($self->nextColor).$item;
784             }
785              
786 0           push( @line, $item.color('reset') );
787             }else{
788 0           push( @proc_column, $item );
789             }
790             }
791              
792 0           push( @colored, \@line );
793             }
794             }
795              
796             #get table width info
797 0           my $tb = Text::Table->new;
798 0           $tb->load( @colored );
799 0           my $width=$tb->width;
800 0           my ($columns, $rows) = Term::Size::chars *STDOUT{IO};
801 0           $tb->clear;
802              
803             #add 120 as Text::Table appears to be off by that much
804 0           $columns=$columns+128;
805              
806 0 0         if ( $^O =~ 'linux' ){
807 0           $columns=$columns-12;
808             }
809              
810             #this is
811 0           my $procwidth=$columns-$width;
812              
813             #process each colored item and shove the proc info in
814 0           my $colored_int=1;
815 0           my $proc_column_int=0;
816 0           while ( defined( $colored[$colored_int] ) ){
817 0           my $item=$proc_column[$proc_column_int];
818             #remove all the newlines
819 0           $item=~s/\n//g;
820              
821 0           $item=substr( $item, 0, $procwidth);
822              
823 0           push( @{$colored[$colored_int]}, $item );
  0            
824              
825 0           $proc_column_int++;
826 0           $colored_int++;
827             }
828              
829 0           return $tb->load( @colored );
830             }
831              
832             =head2 fields
833              
834             Gets a hash of possible fields from Proc::ProcessTable as an hash.
835              
836             This is really meant as a internal function.
837              
838             =cut
839              
840             sub fields{
841 0     0 1   my $self=$_[0];
842 0           $self->errorblank;
843              
844 0           my $p=Proc::ProcessTable->new;
845 0           my @fields=$p->fields;
846              
847 0           my $int=0;
848 0           my %toReturn;
849 0           while( defined($fields[$int]) ){
850 0           $toReturn{$fields[$int]}=1;
851              
852 0           $int++;
853             }
854              
855 0           return %toReturn;
856             }
857              
858             =head2 fieldsGet
859              
860             Gets the currently set fields.
861              
862             Returns a array ref of current fields to be printed.
863              
864             my $fields=$cps->fieldsGet;
865              
866             =cut
867              
868             sub fieldsGet{
869 0     0 1   my $self=$_[0];
870 0           $self->errorblank;
871              
872 0           return $self->{fields};
873             }
874              
875             =head2 nextColor
876              
877             Returns the next color.
878              
879             my $nextColor=$cps->nextColor;
880              
881             =cut
882              
883             sub nextColor{
884 0     0 1   my $self=$_[0];
885 0           $self->errorblank;
886              
887 0           my $color;
888              
889 0 0         if( defined( $self->{colors}[ $self->{nextColor} ] ) ){
890 0           $color=$self->{colors}[ $self->{nextColor} ];
891 0           $self->{nextColor}++;
892             }else{
893 0           $self->{nextColor}=0;
894 0           $color=$self->{colors}[ $self->{nextColor} ];
895 0           $self->{nextColor}++;
896             }
897              
898 0           return $color;
899             }
900              
901             =head2 nextColor
902              
903             Resets the next color to the first one.
904              
905             my $nextColor=$cps->nextColor;
906              
907             =cut
908              
909             sub nextColorReset{
910 0     0 0   my $self=$_[0];
911 0           $self->errorblank;
912              
913 0           $self->{nextColor}=0;
914              
915 0           return 1;
916             }
917              
918             =head2 fieldsSet
919              
920             Gets the currently set fields.
921              
922             Returns a list of current fields to be printed.
923              
924             my @fields=$cps->fieldsGet;
925              
926             =cut
927              
928             sub fieldsSet{
929 0     0 1   my $self=$_[0];
930 0           $self->errorblank;
931              
932              
933             }
934              
935             =head2 pctcpuSearchGet
936              
937             Returns the current value for the PCT CPU search.
938              
939             The return is a array ref.
940              
941             my $pctcpu_search=$cps->pctcpuSearchGet;
942              
943             =cut
944              
945             sub pctcpuSearchGet{
946 0     0 1   my $self=$_[0];
947 0           $self->errorblank;
948              
949 0           return $self->{pctcpu_search};
950             }
951              
952             =head2 pctcpuSearchSetString
953              
954             Search for procs based on the CPU usage.
955              
956             The following equalities are understood.
957              
958             <=
959             <
960             >
961             >=
962              
963             The string may contain multiple values seperated by a comma. Checking will stop after the first hit.
964              
965             If the string is undef, all procs will be shown.
966              
967             #search for procs with less than 60% of CPU usage
968             $cps->pctcpuSearchSetString('<60');
969             #shows procs with greater than 60% of CPU usage
970             $cps->pctcpuSearchSetString('>60');
971              
972             =cut
973              
974             sub pctcpuSearchSetString{
975 0     0 1   my $self=$_[0];
976 0           my $pctcpu_search_string=$_[1];
977 0           $self->errorblank;
978              
979 0           my @pctcpu_search_array;
980 0 0         if ( ! defined( $pctcpu_search_string ) ){
981 0           $self->{pctcpu_search}=\@pctcpu_search_array;
982             }else{
983 0           @pctcpu_search_array=split(/\,/, $pctcpu_search_string);
984              
985 0           foreach my $item ( @pctcpu_search_array ){
986 0 0 0       if (
      0        
      0        
      0        
      0        
      0        
      0        
      0        
      0        
      0        
      0        
987             ( $item !~ /^\>[0123456789]*$/ ) &&
988             ( $item !~ /^\>[0123456789]*\.[0123456789]*$/ ) &&
989             ( $item !~ /^\>\.[0123456789]*$/ ) &&
990             ( $item !~ /^\>\=[0123456789]*$/ ) &&
991             ( $item !~ /^\>\=[0123456789]*\.[0123456789]*$/ ) &&
992             ( $item !~ /^\>\=\.[0123456789]*$/ ) &&
993             ( $item !~ /^\<[0123456789]*$/ ) &&
994             ( $item !~ /^\<[0123456789]*\.[0123456789]*$/ ) &&
995             ( $item !~ /^\<\.[0123456789]*$/ ) &&
996             ( $item !~ /^\<\=[0123456789]*$/ ) &&
997             ( $item !~ /^\<\=[0123456789]*\.[0123456789]*$/ ) &&
998             ( $item !~ /^\<\=\.[0123456789]*$/ )
999             ){
1000 0           $self->{error}=2;
1001 0           $self->{errorString}='"'.$item.'"" is not a valid value for use in a PCT CPU search';
1002 0           $self->warn;
1003 0           return undef;
1004             }
1005              
1006             }
1007              
1008 0           $self->{pctcpu_search}=\@pctcpu_search_array;
1009             }
1010              
1011 0           return 1;
1012             }
1013              
1014             =head2 pctmemSearchGet
1015              
1016             Returns the current value for the PCT MEM search.
1017              
1018             The return is a array ref.
1019              
1020             my $pctmem_search=$cps->pctmemSearchGet;
1021              
1022             =cut
1023              
1024             sub pctmemSearchGet{
1025 0     0 1   my $self=$_[0];
1026 0           $self->errorblank;
1027              
1028 0           return $self->{pctmem_search};
1029             }
1030              
1031             =head2 pctmemSearchSetString
1032              
1033             Search for procs based on the memory usage.
1034              
1035             The following equalities are understood.
1036              
1037             <=
1038             <
1039             >
1040             >=
1041              
1042             The string may contain multiple values seperated by a comma. Checking will stop after the first hit.
1043              
1044             If the string is undef, all procs will be shown.
1045              
1046             #search for procs with less than 60% of the memory
1047             $cps->pctmemSearchSetString('<60');
1048             #shows procs with greater than 60% of the memory
1049             $cps->pctmemSearchSetString('>60');
1050              
1051             =cut
1052              
1053             sub pctmemSearchSetString{
1054 0     0 1   my $self=$_[0];
1055 0           my $pctmem_search_string=$_[1];
1056 0           $self->errorblank;
1057              
1058 0           my @pctmem_search_array;
1059 0 0         if ( ! defined( $pctmem_search_string ) ){
1060 0           $self->{pctmem_search}=\@pctmem_search_array;
1061             }else{
1062 0           @pctmem_search_array=split(/\,/, $pctmem_search_string);
1063              
1064 0           foreach my $item ( @pctmem_search_array ){
1065 0 0 0       if (
      0        
      0        
      0        
      0        
      0        
      0        
      0        
      0        
      0        
      0        
1066             ( $item !~ /^\>[0123456789]*$/ ) &&
1067             ( $item !~ /^\>[0123456789]*\.[0123456789]*$/ ) &&
1068             ( $item !~ /^\>\.[0123456789]*$/ ) &&
1069             ( $item !~ /^\>\=[0123456789]*$/ ) &&
1070             ( $item !~ /^\>\=[0123456789]*\.[0123456789]*$/ ) &&
1071             ( $item !~ /^\>\=\.[0123456789]*$/ ) &&
1072             ( $item !~ /^\<[0123456789]*$/ ) &&
1073             ( $item !~ /^\<[0123456789]*\.[0123456789]*$/ ) &&
1074             ( $item !~ /^\<\.[0123456789]*$/ ) &&
1075             ( $item !~ /^\<=[0123456789]*$/ ) &&
1076             ( $item !~ /^\<\=[0123456789]*\.[0123456789]*$/ ) &&
1077             ( $item !~ /^\<\=\.[0123456789]*$/ )
1078             ){
1079 0           $self->{error}=3;
1080 0           $self->{errorString}='"'.$item.'"" is not a valid value for use in a PCT MEM search';
1081 0           $self->warn;
1082 0           return undef;
1083             }
1084              
1085             }
1086              
1087 0           $self->{pctmem_search}=\@pctmem_search_array;
1088             }
1089              
1090 0           return 1;
1091             }
1092              
1093             =head2 processColorGet
1094              
1095             my $timeColors=$cps->processColorGet;
1096              
1097             =cut
1098              
1099             sub processColorGet{
1100 0     0 1   my $self=$_[0];
1101 0           $self->errorblank;
1102              
1103 0           return $self->{processColor};
1104             }
1105              
1106             =head2 procSearchGet
1107              
1108             This returns the search string value that will be used
1109             for matching the proc column.
1110              
1111             The return is undefined if one is not set.
1112              
1113             my $search_regex=$cps->procSearchGet;
1114             if ( defined( $search_regex ) ){
1115             print "search regex: ".$search_regex."\n";
1116             }else{
1117             print "No search regex.\n";
1118             }
1119              
1120             =cut
1121              
1122             sub procSearchGet{
1123 0     0 1   my $self=$_[0];
1124 0           $self->errorblank;
1125              
1126 0           return $self->{proc_search};
1127             }
1128              
1129             =head2 procSearchSet
1130              
1131             This sets the proc column search regex to use.
1132              
1133             If set to undef(the default), then it will show all procs.
1134              
1135             #shows everything
1136             $cps->procSearchSet( undef );
1137              
1138             #search for only those matching musicpd
1139             $cps->procSeearchSet( 'musicpd' );
1140              
1141             #search for those that match /[Zz]whatever/
1142             $cps->procSearchSet( '[Zz]whatever' );
1143              
1144             =cut
1145              
1146             sub procSearchSet{
1147 0     0 1   my $self=$_[0];
1148 0           my $proc_search=$_[1];
1149 0           $self->errorblank;
1150              
1151 0           $self->{proc_search}=$proc_search;
1152              
1153 0           return 1;
1154             }
1155              
1156             =head2 selfIgnoreGet
1157              
1158             =cut
1159              
1160             sub selfIgnoreGet{
1161 0     0 1   my $self=$_[0];
1162 0           $self->errorblank;
1163              
1164 0           return $self->{self_ignore};
1165             }
1166              
1167             =head2 selfIgnoreSet
1168              
1169             Wether or not to show the PID of this processes in the list.
1170              
1171             =head3 undef
1172              
1173             Resets it to the default, 2.
1174              
1175             =head3 0
1176              
1177             Always show self PID in the list.
1178              
1179             =head3 1
1180              
1181             Never show self PID in the list.
1182              
1183             =head3 2
1184              
1185             Don't show self PID if it is a search.
1186              
1187             This is the default.
1188              
1189             =cut
1190              
1191             sub selfIgnoreSet{
1192 0     0 1   my $self=$_[0];
1193 0           my $self_ignore=$_[1];
1194 0           $self->errorblank;
1195              
1196 0 0         if ( ! defined( $self_ignore ) ){
1197 0           $self_ignore='2';
1198             }
1199              
1200 0           $self->{self_ignore}=$self_ignore;
1201              
1202 0           return 1;
1203             }
1204              
1205             =head2 startString
1206              
1207             Generates a short time string based on the supplied unix time.
1208              
1209             =cut
1210              
1211             sub startString{
1212 0     0 1   my $self=$_[0];
1213 0           my $startTime=$_[1];
1214 0           $self->errorblank;
1215              
1216 0           my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($startTime);
1217 0           my ($csec,$cmin,$chour,$cmday,$cmon,$cyear,$cwday,$cyday,$cisdst) = localtime(time);
1218              
1219             #add the required stuff to make this sane
1220 0           $year += 1900;
1221 0           $cyear += 1900;
1222 0           $mon += 1;
1223 0           $cmon += 1;
1224              
1225             #find the most common one and return it
1226 0 0         if ( $year ne $cyear ){
1227 0           return $year.sprintf('%02d', $mon).sprintf('%02d', $mday).'-'.sprintf('%02d', $hour).':'.sprintf('%02d', $min);
1228             }
1229 0 0         if ( $mon ne $cmon ){
1230 0           return sprintf('%02d', $mon).sprintf('%02d', $mday).'-'.sprintf('%02d', $hour).':'.sprintf('%02d', $min);
1231             }
1232 0 0         if ( $mday ne $cmday ){
1233 0           return sprintf('%02d', $mday).'-'.sprintf('%02d', $hour).':'.sprintf('%02d', $min);
1234             }
1235              
1236             #just return this for anything less
1237 0           return sprintf('%02d', $hour).':'.sprintf('%02d', $min);
1238             }
1239              
1240             =head2 swappedOutSearchGet
1241              
1242             Returns the current value for the swapped out search.
1243              
1244             The return is a Perl boolean.
1245              
1246             my $swappedOut_search=$cps->swappedOutSearchGet;
1247             if ( $swappedOut_search ){
1248             print "only swapped out procs will be shown";
1249             }
1250              
1251             =cut
1252              
1253             sub swappedOutSearchGet{
1254 0     0 1   my $self=$_[0];
1255 0           $self->errorblank;
1256              
1257 0           return $self->{swapped_out_search};
1258             }
1259              
1260             =head2 swappedOutSearchSet
1261              
1262             Sets the swapped out search value.
1263              
1264             The value taken is a Perl boolean.
1265              
1266             $cps->swappedOutSearchSet( 1 );
1267              
1268             =cut
1269              
1270             sub swappedOutSearchSet{
1271 0     0 1   my $self=$_[0];
1272 0           my $swapped_out_search=$_[1];
1273 0           $self->errorblank;
1274              
1275 0           $self->{swapped_out_search}=$swapped_out_search;
1276              
1277 0           return 1;
1278             }
1279              
1280             =head2 timeColorsGet
1281              
1282             my $timeColors=$cps->timeColorsGet;
1283              
1284             =cut
1285              
1286             sub timeColorsGet{
1287 0     0 1   my $self=$_[0];
1288 0           $self->errorblank;
1289              
1290 0           return $self->{timeColors};
1291             }
1292              
1293             =head2 timeSearchGet
1294              
1295             Returns the current value for the time search.
1296              
1297             The return is a array ref.
1298              
1299             my $time_search=$cps->waitSearchGet;
1300              
1301             =cut
1302              
1303             sub timeSearchGet{
1304 0     0 1   my $self=$_[0];
1305 0           $self->errorblank;
1306              
1307 0           return $self->{time_search};
1308             }
1309              
1310             =head2 timeSearchSetString
1311              
1312             Search for procs based on the CPU time value.
1313              
1314             The following equalities are understood.
1315              
1316             <=
1317             <
1318             >
1319             >=
1320              
1321             The string may contain multiple values seperated by a comma. Checking will stop after the first hit.
1322              
1323             If the string is undef, all wait channels will be shown.
1324              
1325             #search for procs with less than 60 seconds of CPU time
1326             $cps->waitSearchSetString('<69');
1327             #shows procs with less than 60 seconds and greater 120 seconds
1328             $cps->waitSearchSetString('<60,>120');
1329              
1330             =cut
1331              
1332             sub timeSearchSetString{
1333 0     0 1   my $self=$_[0];
1334 0           my $time_search_string=$_[1];
1335 0           $self->errorblank;
1336              
1337 0           my @time_search_array;
1338 0 0         if ( ! defined( $time_search_string ) ){
1339 0           $self->{time_search}=\@time_search_array;
1340             }else{
1341 0           @time_search_array=split(/\,/, $time_search_string);
1342              
1343 0           foreach my $item ( @time_search_array ){
1344 0 0 0       if (
      0        
      0        
      0        
      0        
      0        
      0        
      0        
      0        
      0        
      0        
1345             ( $item !~ /^\>[0123456789]*$/ ) &&
1346             ( $item !~ /^\>[0123456789]*\.[0123456789]*$/ ) &&
1347             ( $item !~ /^\>\.[0123456789]*$/ ) &&
1348             ( $item !~ /^\>=[0123456789]*$/ ) &&
1349             ( $item !~ /^\>\=[0123456789]*\.[0123456789]*$/ ) &&
1350             ( $item !~ /^\>\=\.[0123456789]*$/ ) &&
1351             ( $item !~ /^\<[0123456789]*$/ ) &&
1352             ( $item !~ /^\<[0123456789]*\.[0123456789]*$/ ) &&
1353             ( $item !~ /^\<\.[0123456789]*$/ ) &&
1354             ( $item !~ /^\<=[0123456789]*$/ ) &&
1355             ( $item !~ /^\<\=[0123456789]*\.[0123456789]*$/ ) &&
1356             ( $item !~ /^\<\=\.[0123456789]*$/ )
1357             ){
1358 0           $self->{error}=1;
1359 0           $self->{errorString}='"'.$item.'"" is not a valid value for use in a time search';
1360 0           $self->warn;
1361 0           return undef;
1362             }
1363              
1364             }
1365              
1366 0           $self->{time_search}=\@time_search_array;
1367             }
1368              
1369 0           return 1;
1370             }
1371              
1372             =head2 timeString
1373              
1374             Turns the raw run string into something usable.
1375              
1376             This returns a colorized item.
1377              
1378             my $time=$cps->timeString( $seconds );
1379              
1380             =cut
1381              
1382             sub timeString{
1383 0     0 1   my $self=$_[0];
1384 0           my $time=$_[1];
1385 0           $self->errorblank;
1386              
1387 0           my $colors=$self->timeColorsGet;
1388              
1389 0           my $hours=0;
1390 0 0         if ( $time >= 3600 ){
1391 0           $hours = $time / 3600;
1392             }
1393 0           my $loSeconds = $time % 3600;
1394 0           my $minutes=0;
1395 0 0         if ( $time >= 60 ){
1396 0           $minutes = $loSeconds / 60;
1397             }
1398 0           my $seconds = $loSeconds % 60;
1399              
1400             #nicely format it
1401 0           $hours=~s/\..*//;
1402 0           $minutes=~s/\..*//;
1403 0           $seconds=sprintf('%.f',$seconds);
1404              
1405             #this will be returned
1406 0           my $toReturn='';
1407              
1408             #process the hours bit
1409 0 0         if ( $hours == 0 ){
    0          
1410             #don't do anything if time is 0
1411             }elsif(
1412             $hours >= 10
1413             ){
1414 0           $toReturn=color($colors->[3]).$hours.':';
1415             }else{
1416 0           $toReturn=color($colors->[2]).$hours.':';
1417             }
1418              
1419             #process the minutes bit
1420 0 0 0       if (
1421             ( $hours > 0 ) ||
1422             ( $minutes > 0 )
1423             ){
1424 0           $toReturn=$toReturn.color( $colors->[1] ). $minutes.':';
1425             }
1426              
1427 0           $toReturn=$toReturn.color( $colors->[0] ).$seconds;
1428              
1429 0           return $toReturn;
1430             }
1431              
1432             =head1 userSearchGet
1433              
1434             This gets the user to be searched for and if it should be inverted or not.
1435              
1436             This returns an array reference of users to search for.
1437              
1438             An selection can be inverted via !.
1439              
1440             my $user_search=$cps->userSearchGet;
1441              
1442             =cut
1443              
1444             sub userSearchGet{
1445 0     0 0   my $self=$_[0];
1446 0           $self->errorblank;
1447              
1448 0           return $self->{user_search};
1449             }
1450              
1451             =head1 userSearchSetString
1452              
1453             This takes a string to set the user search for.
1454              
1455             An selection can be inverted via !.
1456              
1457             The string may contain multiple users seperated by a comma.
1458              
1459             If the string is undef, all users will be shown.
1460              
1461             #search for user foo and bar
1462             $cps->userSearchSetString('foo,bar');
1463             #show users not matching foo
1464             $cps->userSearchSetString('!foo');
1465             #show all users, clearing any previous settings
1466             $cps->userSearchSetString;
1467              
1468             =cut
1469              
1470             sub userSearchSetString{
1471 0     0 0   my $self=$_[0];
1472 0           my $user_search_string=$_[1];
1473 0           $self->errorblank;
1474              
1475 0           my @user_search_array;
1476 0 0         if ( ! defined( $user_search_string ) ){
1477 0           $self->{user_search}=\@user_search_array;
1478             }else{
1479 0           @user_search_array=split(/\,/, $user_search_string);
1480 0           $self->{user_search}=\@user_search_array;
1481             }
1482              
1483 0           return 1;
1484             }
1485              
1486             =head2 waitSearchGet
1487              
1488             Returns the current value for the wait search.
1489              
1490             The return is a array ref.
1491              
1492             my $wait_search=$cps->waitSearchGet;
1493              
1494             =cut
1495              
1496             sub waitSearchGet{
1497 0     0 1   my $self=$_[0];
1498 0           $self->errorblank;
1499              
1500 0           return $self->{wait_search};
1501             }
1502              
1503             =head2 waitSearchSetString
1504              
1505             This takes a string to set the wait channel search for.
1506              
1507             An selection can be inverted via !.
1508              
1509             The string may contain multiple users seperated by a comma.
1510              
1511             If the string is undef, all wait channels will be shown.
1512              
1513             #search for wait channel wait and sleep
1514             $cps->waitSearchSetString('wait,sleep');
1515             #shows wait channels not matching sbwait
1516             $cps->waitSearchSetString('!sbwait');
1517             #show all users, clearing any previous settings
1518             $cps->waitSearchSetString;
1519              
1520             =cut
1521              
1522             sub waitSearchSetString{
1523 0     0 1   my $self=$_[0];
1524 0           my $wait_search_string=$_[1];
1525 0           $self->errorblank;
1526              
1527 0           my @wait_search_array;
1528 0 0         if ( ! defined( $wait_search_string ) ){
1529 0           $self->{wait_search}=\@wait_search_array;
1530             }else{
1531 0           @wait_search_array=split(/\,/, $wait_search_string);
1532 0           $self->{wait_search}=\@wait_search_array;
1533             }
1534              
1535 0           return 1;
1536             }
1537              
1538             =head2 zombieSearchGet
1539              
1540             Returns the current value for the zombie search.
1541              
1542             The return is a Perl boolean.
1543              
1544             my $zombie_search=$cps->zombieSearchGet;
1545             if ( $zombie_search ){
1546             print "only zombie procs will be shown";
1547             }
1548              
1549             =cut
1550              
1551             sub zombieSearchGet{
1552 0     0 1   my $self=$_[0];
1553 0           $self->errorblank;
1554              
1555 0           return $self->{zombie_search};
1556             }
1557              
1558             =head2 zombieSearchSet
1559              
1560             Sets the zombie search value.
1561              
1562             The value taken is a Perl boolean.
1563              
1564             $cps->zombieSearchSet( 1 );
1565              
1566             =cut
1567              
1568             sub zombieSearchSet{
1569 0     0 1   my $self=$_[0];
1570 0           my $zombie_search=$_[1];
1571 0           $self->errorblank;
1572              
1573 0           $self->{zombie_search}=$zombie_search;
1574              
1575 0           return 1;
1576             }
1577              
1578             =head1 COLORS
1579              
1580             These corresponds to L colors.
1581              
1582             =head2 Time
1583              
1584             The color column is not a single color, but multiple depending on the amount of time.
1585              
1586             The default is as below.
1587              
1588             'GREEN', seconds
1589             'BRIGHT_GREEN', minutes
1590             'RED', hours
1591             'BRIGHT_RED', 10+ hours
1592              
1593             =head2 Columns
1594              
1595             The non-proc/time columns are colored in a rotating color sequence.
1596              
1597             The default is as below.
1598              
1599             BRIGHT_YELLOW
1600             BRIGHT_CYAN
1601             BRIGHT_MAGENTA
1602             BRIGHT_BLUE
1603              
1604             =head1 ERROR CODES/FLAGS
1605              
1606             =head2 1 / badTimeString
1607              
1608             The time search string contains errors.
1609              
1610             =head2 2 / badPctcpuString
1611              
1612             The PCT CPU search string contains errors.
1613              
1614             =head2 3 / badPctmemString
1615              
1616             The PCT MEM search string contains errors.
1617              
1618             =head1 AUTHOR
1619              
1620             Zane C. Bowers-Hadley, C<< >>
1621              
1622             =head1 BUGS
1623              
1624             Please report any bugs or feature requests to C, or through
1625             the web interface at L. I will be notified, and then you'll
1626             automatically be notified of progress on your bug as I make changes.
1627              
1628              
1629              
1630              
1631             =head1 SUPPORT
1632              
1633             You can find documentation for this module with the perldoc command.
1634              
1635             perldoc Proc::ProcessTable::Colorizer
1636              
1637              
1638             You can also look for information at:
1639              
1640             =over 4
1641              
1642             =item * RT: CPAN's request tracker (report bugs here)
1643              
1644             L
1645              
1646             =item * AnnoCPAN: Annotated CPAN documentation
1647              
1648             L
1649              
1650             =item * CPAN Ratings
1651              
1652             L
1653              
1654             =item * Search CPAN
1655              
1656             L
1657              
1658             =back
1659              
1660              
1661             =head1 ACKNOWLEDGEMENTS
1662              
1663              
1664             =head1 LICENSE AND COPYRIGHT
1665              
1666             Copyright 2017 Zane C. Bowers-Hadley.
1667              
1668             This program is distributed under the (Simplified) BSD License:
1669             L
1670              
1671             Redistribution and use in source and binary forms, with or without
1672             modification, are permitted provided that the following conditions
1673             are met:
1674              
1675             * Redistributions of source code must retain the above copyright
1676             notice, this list of conditions and the following disclaimer.
1677              
1678             * Redistributions in binary form must reproduce the above copyright
1679             notice, this list of conditions and the following disclaimer in the
1680             documentation and/or other materials provided with the distribution.
1681              
1682             THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1683             "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1684             LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1685             A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1686             OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1687             SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
1688             LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1689             DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1690             THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1691             (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1692             OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1693              
1694              
1695             =cut
1696              
1697             1; # End of Proc::ProcessTable::Colorizer