The emperor's new clothes

I noticed that I have been working on Data::Dump::Tree for 18 months which makes me a Perl6 developer with almost 2 years of "experience", \o/. What I know is that I am going to need a few more years to get around all it has to offer. But after two years it is still fun to learn new things about Perl6.

I also noticed that 90% of my time went into DDT, the rest went into two puny modules not worth mentioning, except that 3 modules sound better than one. Development takes times, development with documentation and test, and trying to get quality and functionality takes ages, no wonder Perl6 took this long; Actually it is pretty impressive what was achieved 2 decades.

DDT has matured enough so it is time for a new interface, the old interface is deprecated but still there, for a while at least. Few weeks ago I introduce ddt to replace dump as an interface, one of the interfaces. It was both to make it closer to dd the rakudo built-in dumper, and also to stop using the work dump which I don't like much. with all the work put in it is still a dump, no way.

The new interface look like this:

sub/method **ddt** $data_to_dump, $data_to_dump, *:adverb*, :named_argument, ...

This interface accepts the following adverbs:

  • :print prints the rendered data, the default behavior without adverb

  • :note 'note's the rendered data

  • :get returns the rendered data

  • :get_lines returns the rendering in its native format

  • :getlinesintegrated returns a list of rendered lines

  • :curses opens a NCurses interface, NCurses module must be installed

  • :remote sends data to a listener

Most of the time you'd just ddt your data structure and option and be on you merry way.

:curse is new, when called with that adverb, DDT will open a curses window, render the structure and let you move around, folding and unfolding data as necessary. It's not fast but it is the best way to look at complex data so far (apart from the DHTML rendering). the only limitation, except speed, is that it can not render unicode yet, that is a limitation of the NCurses module not DDT.

:remote, is also new, this one I needed when developing :curses and it is quite practical so I gave it an interface. It sends the rendering to "listener" which prints it on its terminal. If you are using Tmux or Screen, you can split your window and have data rendered in another terminal.

I think DDT is now feature complete, I want it to be because I badly want to start working on Asciio 2.0 and preferably in Perl6.

There are still a few things left:

  • Profile it to speed it up a bit. I did try once but no success, maybe some good hearted guru will give a hand or at least pointers. Now DDT is a tad heavy, does a lot of things it can't be expected to be a speed demon.

  • Add more built-in types, specially "exotic" ones like taps and supplies.

  • Test with Releases rather than bleeding edge,

  • I think there will be a :remote_fold when I get the time to write it. The idea is that you can send a data rendering, to another process, that you can fold, scroll, search, ... when I have a little time.

  • find a co-maintainer, since we are just a few hundreds all busy with loads of things, it is going to a hunt. If you have some skill with html/javascrip, the DHTML module could use so polishing touch.



1 Comment

This stuff is insanely cool. I'm waiting for the Asciio in Perl 6.

Leave a comment

About Nadim Khemir

user-pic I blog about Perl.