Class::Simple

Class::Simple is a simple Object-Oriented Base Class.
Download

Class::Simple Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Michael Sullivan
  • Publisher web site:
  • http://search.cpan.org/~sullivan/Class-Simple-0.18/lib/Class/Simple.pm

Class::Simple Tags


Class::Simple Description

Class::Simple is a simple Object-Oriented Base Class. Class::Simple is a simple Object-Oriented Base Class.SYNOPSIS package Foo: use base qw(Class::Simple); BEGIN { Foo->privatize(qw(attrib1 attrib2)); # ...or not. } my $obj = Foo->new(); $obj->attrib(1); # The same as... $obj->set_attrib(1); # ...this. my $var = $obj->get_attrib(); # The same as... $var = $obj->attrib; # ...this. $obj->raise_attrib(); # The same as... $obj->set_attrib(1); # ...this. $obj->clear_attrib(); # The same as... $obj->set_attrib(undef); # ...this $obj->attrib(undef); # ...and this. $obj->readonly_attrib(4); sub foo { my $self = shift; my $value = shift; $self->_foo($value); do_other_things(@_); ... } my $str = $obj->DUMP; my $new_obj = Foo->new(); $new_obj->SLURP($str); sub BUILD { my $self = shift; # Various initializations }There are plenty of others that are much more thorough and whatnot but sometimes I want something simple so I can get just going (no doubt because I am a simple guy) so I use this.What do I mean by simple? First off, I don't want to have to list out all my methods beforehand. I just want to use them (Yeah, yeah, it doesn't catch typos--that's what testing and Class::Std are for :-). Next, I want to be able to call my methods by $obj->foo(1) or $obj->set_foo(1), by $obj->foo() or $obj->get_foo(). Don't tell ME I have to use get_ and set_ (I would just override that restriction in Class::Std anyway). Simple!I did want some neat features, though, so these are inside-out objects (meaning the object isn't simply a hash so you can't just go in and muck with attributes outside of methods), privatization of methods is supported, as is serialization out and back in again.Requirements:· PerlWhat's New in This Release:· Took out the conflict resolution feature. There was a problem caused by multiple inheritance.· Removed uninitialized().


Class::Simple Related Software