Main > Programming > Libraries >

Class::Declare 0.08

Class::Declare 0.08

Sponsored Links

Class::Declare 0.08 Ranking & Summary

RankingClick at the star to rank
Ranking Level
User Review: 0 (0 times)
File size: 0.075 MB
Platform: Any Platform
License: Perl Artistic License
Price:
Downloads: 856
Date added: 2007-06-20
Publisher: Ian Brayshaw

Class::Declare 0.08 description

Class::Declare is a Perl module created to declare classes with public, private and protected attributes and methods.

SYNOPSIS

package My::Class;

use strict;
use warnings;
use base qw( Class::Declare );

__PACKAGE__->declare(

public => { public_attr => 42 } ,
private => { private_attr => Foo } ,
protected => { protected_attr => Bar } ,
class => { class_attr => [ 3.141 ] }
static => { static_attr => { a => 1 } } ,
restricted => { restricted_attr => string } ,
abstract => abstract_attr ,
friends => main::trustedsub ,
new => [ public_attr , private_attr ] ,
init => sub { # object initialisation
...
1;
} ,
strict => 0

);

sub publicmethod {
my $self = __PACKAGE__->public( shift );
...
}

sub privatemethod {
my $self = __PACKAGE__->private( shift );
...
}

sub protectedmethod {
my $self = __PACKAGE__->protected( shift );
...
}

sub classmethod {
my $self = __PACKAGE__->class( shift );
...
}

sub staticmethod {
my $self = __PACKAGE__->static( shift );
...
}

sub restrictedmethod {
my $self = __PACKAGE__->restricted( shift );
...
}

sub abstractmethod { __PACKAGE__->abstract }

1;

...

my $obj = My::Class->new( public_attr => fish );

MOTIVATION

One of Perls greatest strengths is its flexible object model. You can turn anything (so long as its a reference, or you can get a reference to it) into an object. This allows coders to choose the most appropriate implementation for each specific need, and still maintain a consistent object oriented approach.
A common paradigm for implementing objects in Perl is to use a blessed hash reference, where the keys of the hash represent attributes of the class. This approach is simple, relatively quick, and trivial to extend, but its not very secure. Since we return a reference to the hash directly to the user they can alter hash values without using the classs accessor methods. This allows for coding "short-cuts" which at best reduce the maintainability of the code, and at worst may introduce bugs and inconsistencies not anticipated by the original module author.

On some systems, this may not be too much of a problem. If the developer base is small, then we can trust the users of our modules to Do The Right Thing. However, as a modules user base increases, or the complexity of the systems our modules are embedded in grows, it may become desirable to control what users can and cant access in our module to guarantee our codes behaviour. A traditional method of indicating that an objects data and methods are for internal use only is to prefix attribute and method names with underscores. However, this still relies on the end user Doing The Right Thing.

Class::Declare provides mechanisms for module developers to explicitly state where and how their class attributes and methods may be accessed, as well as hiding the underlying data store of the objects to prevent unwanted tampering with the data of the objects and classes. This provides a robust framework for developing Perl modules consistent with more strongly-typed object oriented languages, such as Java and C++, where classes provide public, private, and protected interfaces to object and class data and methods.

Class::Declare 0.08 Screenshot

Advertisements

Class::Declare 0.08 Keywords

Bookmark Class::Declare 0.08

Hyperlink code:
Link for forum:

Class::Declare 0.08 Copyright

WareSeeker periodically updates pricing and software information of Class::Declare 0.08 full version from the publisher, so some information may be slightly out-of-date. You should confirm all information before relying on it. Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future development of Class::Declare 0.08 Edition. Download links are directly from our publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed

Allok Video Splitter 2.2.0 Review:

Name (Required)
Email(Required)
Captcha
Featured Software

Want to place your software product here?
Please contact us for consideration.

Contact WareSeeker.com
Related Software
Class::Meta::Declare is a Perl module deprecated in favor of Class::Meta::Express. Free Download
Class::Declare::Attributes is a Perl module with Class::Declare method types using Perl attributes. Free Download
Class::DataStore is a Perl module for generic OO data storage/retrieval. Free Download
Class::Driver is a Perl module to generate driver ("composite") class hierarchies on-the-fly. Free Download
Class::Std is a Perl module to support for creating standard "inside-out" classes. Free Download
Class::Maker Perl module contains classes, reflection, schema, serialization, attribute- and multiple inheritance. Free Download
Class::Agreement is a Perl module that add contracts to your Perl classes easily. Free Download
Class::Meta::Express is a Perl module for concise, expressive creation of Class::Meta classes. Free Download