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

  1. Why would this module have an OO interface if only 1 exported subroutine would do? (i.e., similar to the existing interface to Data::Dumper)
    This is my first real attempt at module creation and I decided to add one more area of training by learning about OO. As it turns out, adding the object oriented interface reduced the amount of code while making it more difficult for someone to muck around with the innards.
  2. Why is this module called "Lite" if it actually provides additional functionality? Why not patch the existing Data::Dumper to have the additional functionality you want?
    As adrianh pointed out, it doesn't provide any additional functionality. My reply to broquaint should explain the "Lite" name.

Replies are listed 'Best First'.
Re: Re: Re: RFC: Data::Dumper::Lite
by Juerd (Abbot) on May 28, 2003 at 06:43 UTC

    This is my first real attempt at module creation and I decided to add one more area of training by learning about OO. As it turns out, adding the object oriented interface reduced the amount of code while making it more difficult for someone to muck around with the innards.

    Great, but why do the people that use your module have to type Data::Dumper::Lite->new->Dump(...) when a simple change would allow them to write Dump ... instead?

    In your module:

    use Exporter::Tidy _map => { Dump => sub { __PACKAGE__->new->Dump(@_) +} };

    User's code:

    use Data::Dumper::Lite qw(Dump); print Dump(...);

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

      That works beautifully! I can keep my data (and some of the methods) wrapped up nice and snug (and some what out of reach) inside of my object. The user can decide if they want to use the module functionally or in an OO manner.