Index of /archives/CPAN/authors/id/T/TS/TSHOENFE
Name Last modified Size Description
Parent Directory -
CHECKSUMS 2021-11-22 10:23 1.4K
README.txt 2004-02-08 15:37 2.8K
DependencyMap-1.0.pm 2007-05-12 07:00 3.7K
Capsule-1.0.pm 2007-05-12 06:52 8.6K
READ ME
DESCRIPTION
This class is designed to provide object data encapsulation, a requirement
of object oriented programming, and a reliable object interface. Perl
has no access modifiers so encapsulation is not facilitated by the
language. The Capsule module remedies that deficiency. You need only
inherit from this class to encapsulate your child class data.
I make every attempt to be Perlish in the design of this class, so it is
designed to be easily used. As the SYNOPSIS shows, a functional data
class can be created entirely devoid of implementation.
The class provides a default constructor and automatic set and get
methods called, 'accessors'. The class enforces encapsulation in child
classes using the memory address key method (props to Damian Conway).
Consistent with good object-oriented design, the class provides a
default constructor and no arguments are accepted. Instance variables
are defined in a class level array in the child class and are initialized
to undef.
The class uses AUTOLOAD to provide automatic accessor methods for
instance variables. This is not as evil as it you may think. Only the
accessors will be AUTOLOADed. Non-accessors result in an error. You
can and should provide your own accessor implementations as needed, but
you should follow the naming convention. If you violate the naming
convention, the default accessors will exist anyway and you lose two
important benefits.
First, AUTOLOADed accessors enforce a naming convention and therefore
a consistent interface for all child classes. Set methods must begin
with 'set_'. Get methods must begin with 'get_'. If you chose to name
your accessors differently, this benefit is foregone.
The class level hash approach used to provide encapsulation
unfortunately also provides opacity. Introspective methods like
fetch_attributes(), to_string(), and to_string_all() are provided to
compensate for that.
The class provides a usage() method which dies with the SYNOPSIS,
ARGUMENTS, and OPTIONS from the class POD. Use this when the class is
misused.
COPYRIGHT
Copyright (c) 2004 Todd Shoenfelt. All rights reserved. This program
is free software; you can redistribute it and/or modify it under the
same terms as Perl itself.
PRE-REQUISITES
WeakRef.pm, Pod::Usage.pm, Data::Dumper.pm
HOW TO BUILD IT
There's nothing to build. It's Perl.
HOW TO INSTALL IT
Copy the file under lib/Class.
RECENT CHANGES
N/A. This is the first release.
FUTURE CHANGES
N/A.