Class::ClosureClass::Closure is an encapsulated, declarative class style. | |
Download |
Class::Closure Ranking & Summary
Advertisement
- License:
- Perl Artistic License
- Price:
- FREE
- Publisher Name:
- Luke Palmer
- Publisher web site:
- http://search.cpan.org/~lpalmer/Symbol-Opaque-0.03/lib/Symbol/Opaque.pm
Class::Closure Tags
Class::Closure Description
Class::Closure is an encapsulated, declarative class style. Class::Closure is an encapsulated, declarative class style.SYNOPSIS package Dog; use Class::Closure; sub CLASS { extends Foo::Bar; # Inherit from another class extends $some_object; # Inherit from a single object (classless) my $hungry; # private has my $face; # read-only public my $leash; # public accessor 'food', # magical variable-like function get => sub { 'None' }, set => sub { $hungry = 0; }; method bark => sub { print "Woof!" }; # method (note the semicolon) method BUILD => sub { print "A new dog is born" }; # constructor destroy { print "Short is the life of a dog" }; # destructor method FALLBACK => sub { print "Handling $AUTOLOAD" }; } my $fido = Dog->new; # "A new dog is born" $fido->face; # Get a read-only attribute $fido->leash = 'red'; # public attributes look like variables $fido->food = 20; # This calls the food set accessor Requirements: · Perl
Class::Closure Related Software