App::WRT::MethodSpit - quickie method generation
# In Foo.pm: package Foo; use base 'App::WRT::MethodSpit'; %default = ( baz => 'bar, biz => 'buz' ); # Set up accessor methods: __PACKAGE__->methodspit( keys %default ); sub new { my $class = shift; my %params = @_; my %copy_of_default = %default; my $self = \%copy_of_default; bless $self, $class; $self->configure(%params); return $self; } # In calling code: $obj = Foo->new( baz => 'waffle' ); say $obj->baz; # waffle say $obj->biz; # buz
Cheap method generation, in place of using Class::Accessor or Object::Tiny.
Kind of stupid.
To install App::WRT, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::WRT
CPAN shell
perl -MCPAN -e shell install App::WRT
For more information on module installation, please visit the detailed CPAN module installation guide.