Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Examples of top command written in Pure PERL

by davidfavor (Initiate)
on Jan 24, 2022 at 16:00 UTC ( [id://11140803]=perlquestion: print w/replies, xml ) Need Help??

davidfavor has asked for the wisdom of the Perl Monks concerning the following question:

If someone has an example of a Pure PERL top-ish type command, pass it along. Many of the LXD tools I've written would be far easier to use, if rewritten as top-ish commands, so this is the project I have in mind. Thanks!
  • Comment on Examples of top command written in Pure PERL

Replies are listed 'Best First'.
Re: Examples of top command written in Pure PERL
by Corion (Patriarch) on Jan 24, 2022 at 16:06 UTC

    If by "top-ish" command, you mean the output of a heading and then a set of elements below, I wrote a module for that which I haven't published yet. There are also other terminal toolkits like Tickit.

    Before I paste the wall-of-text that is my module, can you explain a bit more what you want?

    Most of my module reduces to:

    has 'term_scroll_up' => ( is => 'lazy', default => sub { $_[0]->terminfo->Tputs('UP') }, ); has 'term_clear_eol' => ( is => 'lazy', default => sub { $_[0]->terminfo->Tputs('ce') }, );

    and the idea is to output the list, and then scroll the cursor back up to where we started printing that list.

      Thanks!
Re: Examples of top command written in Pure PERL
by tybalt89 (Monsignor) on Jan 24, 2022 at 18:07 UTC
      Thanks! I'll check these out.
Re: Examples of top command written in Pure PERL
by haukex (Archbishop) on Jan 25, 2022 at 08:27 UTC
      Thanks! I searched CPAN a good bit + missed both these.
Re: Examples of top command written in pure Perl
by Discipulus (Canon) on Jan 25, 2022 at 08:32 UTC
    Hello davidfavor and welcome to the monastery and to the wonderful world of Perl,

    ..But never write "PERL"..

    L*

    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://11140803]
Approved by LanX
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2024-04-18 07:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found