| 1 | package Acme::CPANModules::BrowsingTableInteractively; | ||
| 2 | |||
| 3 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | 1 | our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY | |
| 6 | 1 | our $DATE = '2023-06-15'; # DATE | |
| 7 | 1 | our $DIST = 'Acme-CPANModules-BrowsingTableInteractively'; # DIST | |
| 8 | 1 | our $VERSION = '0.008'; # VERSION | |
| 9 | |||
| 10 | 1 | our $LIST = { | |
| 11 | summary => 'List of modules/tools for browsing table data interactively', | ||
| 12 | description => <<'_', | ||
| 13 | |||
| 14 | This list reviews what tools are available on CPAN and in general to browse | ||
| 15 | table data interactively. | ||
| 16 | |||
| 17 | Let me say first that the best tools are not Perl-based since sadly Perl is not | ||
| 18 | a favorite choice for writing tools these days. That said, Perl is still a great | ||
| 19 | glue to help make those tools work together better for you. | ||
| 20 | |||
| 21 | |||
| 22 | 1) **Visidata**, <https://www.visidata.org> | ||
| 23 | |||
| 24 | This is currently my favorite. It's terminal-based, written in Python, and has | ||
| 25 | more features than any other tools currently written in Perl, by far. vd has | ||
| 26 | support for many formats, including CSV, TSV, Excel, JSON, and SQLite. It makes | ||
| 27 | it particularly easy to create summary for your table like histogram or | ||
| 28 | sum/average/max/min/etc, or add new columns, or edit some cells. It also has | ||
| 29 | visualization features like XY-plots. | ||
| 30 | |||
| 31 | It has the concept of "sheets" like sheets in a spreadsheet workbook so anytime | ||
| 32 | you filter rows/columns or create summary or do some other derivation from your | ||
| 33 | data, you create a new sheet which you can edit, save, and destroy later as | ||
| 34 | needed and go back to your original table. It even presents settings and | ||
| 35 | metadata as sheets so you can edit them as a normal sheet. | ||
| 36 | |||
| 37 | It has plugins, and I guess it should be simple enough to create a plugin so you | ||
| 38 | can filter rows or add columns using Perl expression instead of the default | ||
| 39 | Python, if needed. | ||
| 40 | |||
| 41 | My CLI framework <pm:Perinci::CmdLine> (<pm:Perinci::CmdLine::Lite>, v1.918+) | ||
| 42 | has support for Visidata. You can specify command-line option `--format=vd` to | ||
| 43 | browse the output of your CLI program in Visidata. | ||
| 44 | |||
| 45 | |||
| 46 | 2) **DataTables**, <https://datatables.net> | ||
| 47 | |||
| 48 | DataTables is a JavaScript (jQuery-based) library to add controls to your HTML | ||
| 49 | table so you can filter rows incrementally, sort rows, reorder columns, and so | ||
| 50 | on. It also has plugins to do more customized stuffs. I still prefer Visidata | ||
| 51 | most of the time because I am comfortable living in the terminal, but I | ||
| 52 | particularly love the incremental searching feature that comes built-in with | ||
| 53 | DataTables. | ||
| 54 | |||
| 55 | My CLI framework <pm:Perinci::CmdLine> (<pm:Perinci::CmdLine::Lite>, v1.918+) | ||
| 56 | also has support for DataTables. You can specify command-line option | ||
| 57 | `--format=html+datatables` to output your CLI program's result as HTML table | ||
| 58 | (using <pm:Text::Table::HTML::DataTables>) when possible and then browse the | ||
| 59 | output in browser. | ||
| 60 | |||
| 61 | |||
| 62 | 3) **Tickit::Widget::Table**, <pm:Tickit::Widget::Table> | ||
| 63 | |||
| 64 | This module lets you browse the table in a terminal. Using the <pm:Tickit> | ||
| 65 | library, the advantages it's supposed to have is mouse support. It's still very | ||
| 66 | basic: you either have to specify each column width manually or the width of all | ||
| 67 | columns will be the same. There's no horizontal scrolling support or a way to | ||
| 68 | see long text in a column. Not updated since 2016. | ||
| 69 | |||
| 70 | |||
| 71 | 4) **Term::TablePrint**, <pm:Term::TablePrint> | ||
| 72 | |||
| 73 | This module lets you browse the table in a terminal. Provides roughly the same | ||
| 74 | features like Tickit::Widget::Table with an extra one: you can press Enter on a | ||
| 75 | row to view it as a "card" where each column will be displayed vertically, so | ||
| 76 | you can better see a row that has many columns or columns with long text. | ||
| 77 | |||
| 78 | There is currently no support beyond the most basic stuffs, so no column hiding, | ||
| 79 | reordering, etc. | ||
| 80 | |||
| 81 | |||
| 82 | 5) **less** | ||
| 83 | |||
| 84 | Don't forget the good ol' Unix pager. You can render your table data as an ASCII | ||
| 85 | table (using modules like <pm:Text::Table::More>, <pm:Text::ANSITable>, or | ||
| 86 | <pm:Text::Table::Any> for more formats to choose from) then pipe the output to | ||
| 87 | it. At least with *less* you can scroll horizontally or perform incremental | ||
| 88 | searching (though not interactive filtering of rows). | ||
| 89 | |||
| 90 | _ | ||
| 91 | entries => [ | ||
| 92 | { | ||
| 93 | module => 'Tickit::Widget::Table', | ||
| 94 | }, | ||
| 95 | |||
| 96 | { | ||
| 97 | module => 'Term::TablePrint', | ||
| 98 | }, | ||
| 99 | |||
| 100 | { | ||
| 101 | module => 'Text::Table::HTML::DataTables', | ||
| 102 | }, | ||
| 103 | ], | ||
| 104 | }; | ||
| 105 | |||
| 106 | 1 | 1; | |
| 107 | # ABSTRACT: List of modules/tools for browsing table data interactively | ||
| 108 | |||
| 109 | __END__ | ||