fully remove BSD::Process

This commit is contained in:
Zane C. B-H 2019-01-07 20:13:22 -06:00
parent 3530121bc1
commit 835060d157
3 changed files with 24 additions and 29 deletions

View File

@ -1,5 +1,8 @@
Revision history for Proc-ProcessTable-Colorizer
0.3.0 2019-01-07/20:00
-No longer uses BSD::Processes.
0.2.2 2019-01-05/12:20
-Add the missing depend Term::Size.

View File

@ -10,9 +10,6 @@ my %PREREQ_PM = (
'Text::Table'=>'1.133',
'Term::Size'=>'0.207',
);
if ( $^O =~ /bsd/ ){
$PREREQ_PM{'BSD::Process'}='0.07';
}
WriteMakefile(
NAME => 'Proc::ProcessTable::Colorizer',

View File

@ -9,21 +9,17 @@ use Term::ANSIColor;
use Text::Table;
use Term::Size;
if ( $^O =~ /bsd/ ){
require BSD::Process;
}
=head1 NAME
Proc::ProcessTable::Colorizer - Like ps, but with colored columns and enhnaced functions for searching.
=head1 VERSION
Version 0.2.2
Version 0.3.0
=cut
our $VERSION = '0.2.2';
our $VERSION = '0.3.0';
=head1 SYNOPSIS
@ -37,9 +33,6 @@ This module uses L<Error::Helper> for error reporting.
As of right now this module is not really user friend and will likely be going through lots of changes as it grows.
Linux is also not as well supported given the limitations of Proc::ProcessTable and there is nothig similar to
L<BSD::Process> for Linux.
=head1 METHODS
=head2 new
@ -172,11 +165,6 @@ sub colorize{
#goes through it all and gathers the information
foreach my $proc ( @{$pt->table} ){
my $bproc;
if ($^O =~ /bsd/){
$bproc=BSD::Process::info( $proc->pid );
}
#process the requested fields
$fieldInt=0;
@ -224,7 +212,6 @@ sub colorize{
if (
($^O =~ /bsd/) &&
( hex($proc->flags) & 0x00200000 )
#($proc->{flags} =~ /2..$/)
){
$kernel_proc=1;
}
@ -255,15 +242,23 @@ sub colorize{
$values{state}=$proc->state;
if ($^O =~ /bsd/){
$values{controlling_tty_active}=$bproc->{isctty};
$values{is_session_leader}=$bproc->{issleader};
$values{is_being_forked}=$bproc->{stat_1};
$values{working_on_exiting}=$bproc->{wexit};
$values{has_controlling_terminal}=$bproc->{controlt};
$values{is_locked}=$bproc->{locked};
$values{traced_by_debugger}=$bproc->{traced};
$values{is_stopped}=$bproc->{stat_4};
$values{posix_advisory_lock}=$bproc->{advlock};
$values{is_session_leader}=0;
$values{is_being_forked}=0;
$values{working_on_exiting}=0;
$values{has_controlling_terminal}=0;
$values{is_locked}=0;
$values{traced_by_debugger}=0;
#$values{is_stopped}=0;
$values{posix_advisory_lock}=0;
if ( hex($proc->flags) & 0x00002 ){ $values{controlling_tty_active}=1; }
if ( hex($proc->flags) & 0x00000002 ){$values{is_session_leader}=1; }
#if ( hex($proc->flags) & ){$values{is_being_forked}=1; }
if ( hex($proc->flags) & 0x02000 ){$values{working_on_exiting}=1; }
if ( hex($proc->flags) & 0x00002 ){$values{has_controlling_terminal}=1; }
if ( hex($proc->flags) & 0x00000004 ){$values{is_locked}=1; }
if ( hex($proc->flags) & 0x00800 ){$values{traced_by_debugger}=1; }
if ( hex($proc->flags) & 0x00001 ){$values{posix_advisory_lock}=1; }
}
}else{
@ -291,7 +286,7 @@ sub colorize{
$values{size}=$values{size}/1024;
push( @procs, \%values );
}
#sort by CPU percent and then RAM
@ -313,7 +308,7 @@ sub colorize{
my $show=0;
#checks if it is the idle proc and if it should show it
if (
if (
defined ( $proc->{idle} ) &&
( ! $self->{showIdle} )
){