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

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' }

Replies are listed 'Best First'.
Re: Re: Re: Re: RFC: Data::Dumper::Lite
by Mr. Muskrat (Canon) on May 28, 2003 at 15:51 UTC
    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.