in reply to RFC: Data::Dumper::Lite

I am unhappy with the way that Data::Dumper dumps a subroutine as sub { "DUMMY" } so I added in some extra functionality using B::Deparse

Data::Dumper has been able to do this for some time. Check out $Data::Dumper::Deparse in the Data::Dumper POD.

Question: Why? (i.e. Why should I use Data::Dumper::Lite instead of Data::Dumper or Storable :-)

Replies are listed 'Best First'.
Re: Re: RFC: Data::Dumper::Lite
by Mr. Muskrat (Canon) on May 27, 2003 at 18:30 UTC

    Data::Dumper has been able to do this for some time. Check out $Data::Dumper::Deparse in the Data::Dumper POD.
    A search of CPAN shows two versions, 2.101 (which I have) and 2.12 (bundled with Perl 5.8.0). As far as I can tell, $Data::Dumper::Deparse isn't supported until version 2.12.

    Why should I use Data::Dumper::Lite instead of Data::Dumper or Storable?
    That is a very good question and my knee jerk response is "Why not?" :-)

    I am trying to write a (mostly*) pure perl version of Data::Dumper that has a smaller code base (read: easier to maintain) and easier to use since there are no options what so ever. D::D::L started out as a way for me to learn more but it has grown in functionality while the code base has shrunk.

    * Mostly. I have to use B::Deparse to get at the code references. Perhaps I could make use of autouse or autoload to reduce the overhead of using B::Deparse when it is not used.

      I have to use B::Deparse to get at the code references. Perhaps I could make use of autouse or autoload to reduce the overhead of using B::Deparse when it is not used.

      perldoc -f require

      Juerd # { site => 'juerd.nl', plp_site => 'plp.juerd.nl', do_not_use => 'spamtrap' }

        Talk about overlooking the obvious! :-)
Re: Re: RFC: Data::Dumper::Lite
by John M. Dlugosz (Monsignor) on May 27, 2003 at 22:17 UTC
    His listed reason was for his own learning.

    So, if this will be a teaching tool for others to learn how to access various data structures and properties and innerds, the documentation and presentation is more important than the code!

    To that end, I think it should be a running example of a set of tutorials or cookbook recipies on how to do those things.

    —John

      I took:

      I would like to upload this to CPAN once all of the kinks are worked out and the documentation has been added.

      to mean that it was intended for use in the "real world" - so I still think it was a fair question :-)

        adrianh, it was indeed a fair question. It was not until later that I posted this saying that I still wasn't sure if it ever would go up on CPAN.

      John M. Dlugosz, that sounds like a great idea. I could use it as the basis for an upcoming Perl Mongers meeting!