From: Robert 'phaylon' Sedlacek Date: Fri, 11 May 2012 17:24:03 +0000 (+0000) Subject: sort processes by args/pid X-Git-Tag: v0.001_001~77 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6f6746d0f30dd621915997b9625682e8582ff615;p=scpubgit%2FSystem-Introspector.git sort processes by args/pid --- diff --git a/lib/System/Introspector/Processes.pm b/lib/System/Introspector/Processes.pm index 9fb0726..4344488 100644 --- a/lib/System/Introspector/Processes.pm +++ b/lib/System/Introspector/Processes.pm @@ -58,7 +58,11 @@ sub gather { @row{ @names } = @values; push @rows, \%row; } - return { processes => \@rows }; + return { processes => [ sort { + ($a->{args} cmp $b->{args}) + || + ($a->{pid} <=> $b->{pid}) + } @rows ] }; }; }