pericmd 048: Showing table data in browser as sortable/searchable HTML table

The latest release of Perinci::CmdLine (1.68) supports viewing program’s output in an external program. And also a new output format is introduced: html+datatables. This will show your program’s output in a browser and table data is shown as HTML table using jQuery and DataTables plugin to allow you to filter rows or sort columns. Here’s a video demonstration:

Your browser does not support the video tag, or WordPress filters the VIDEO element.

If the video doesn’t show, here’s the direct file link.



  1. Ron Savage · December 30, 2016

    A MetaCPAN search has Perinci::CmdLine V 1.50. Any idea why?
    And for displaying in multiple formats, did you consider Text::Table::Manifold?

    Liked by 1 person

    • perlancar · December 30, 2016

      Yeah, there’s a little problem in the naming of the module: Perinci::CmdLine was split to two (now three) different implementations. When I say Perinci::CmdLine, most of the time I’m actually referring to Perinci::CmdLine::Lite, the “default” implementation, but that’s a bit longer to type. This is explained in the Perinci::CmdLine POD. Someday I’d like to merge the implementations again.

      Hm, I was not aware of Text::Table::Manifold before I wrote Text::Table::Any. But I was trying to reuse the Text::Table::Tiny (0.03) API, which is just a single function call. And Text::Table::Manifold’s deps are a bit too heavy for my needs (Moo, Types::Standard, Unicode::GCString). I explicitly exclude Unicode table output in Perinci::CmdLine and leave it for Perinci::CmdLine::Classic (the heavier implementation).

      Liked by 1 person

  2. Ron Savage · December 30, 2016

    Hmm. Somehow I’m now viewing V 1.68 in MetaCPAN.

    Liked by 1 person

    • perlancar · December 30, 2016

      Yup, that’s the version for Perinci::CmdLine::Lite, which I should’ve said in the first place to avoid confusion. Sorry.

      Liked by 1 person

  3. Ron Savage · December 30, 2016

    Also, did you know there is another version of datatables – – which does not require JQuery? It’s the one I use e.g. here Scroll down to Flower Catalog.

    Liked by 1 person

    • perlancar · December 30, 2016

      No, I didn’t. To be honest I didn’t do an exhaustive search for datatables stuff and just picked the first result from Google 🙂 I might take a look it. Thanks for the link.

      Liked by 1 person

  4. perlancar · January 4, 2017

    This is handy for when reading benchmark result table from bencher, for example:

    % bencher -m Accessors::Get --format html+datatables

    Liked by 1 person

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s