Name : perl-Class-Declare
| |
Version : 0.20
| Vendor : obs://build_opensuse_org/devel:languages:perl
|
Release : lp156.1.1
| Date : 2024-07-03 17:52:45
|
Group : Development/Libraries/Perl
| Source RPM : perl-Class-Declare-0.20-lp156.1.1.src.rpm
|
Size : 0.18 MB
| |
Packager : https://www_suse_com/
| |
Summary : Declare classes with public, private and protected
|
Description :
*Class::Declare* allows class authors to specify public, private and protected attributes and methods for their classes, giving them control over how their modules may be accessed. The standard object oriented programming concepts of _public_, _private_ and _protected_ have been implemented for both class and instance (or object) attributes and methods.
Attributes and methods belong to either the _class_ or an _instance_ depending on whether they may be invoked via class instances (class and instance methods/attributes), or via classes (class methods/attributes only).
*Class::Declare* uses the following definitions for _public_, _private_ and _protected_:
* *public*
Public attributes and methods may be accessed by anyone from anywhere. The term *public* is used by *Class::Declare* to refer to instance attributes and methods, while the equivalent for class attributes and methods are given the term *class* attributes and methods.
* *private*
Private attributes and methods may be accessed only by the class defining them and instances of that class. The term *private* is used to refer to instance methods and attributes, while the term *static* refers to class attributes and methods that exhibit the same properties.
* *protected*
Protected attributes and methods may only be accessed by the defining class and it\'s instances, and classes and objects derived from the defining class. Protected attributes and methods are used to define the interface for extending a given class (through normal inheritance/derivation). The term *protected* is used to refer to protected instance methods and attributes, while protected class methods and attributes are referred to as *restricted*.
*Note:* since version 0.02, protected class methods and attributes are refered to as _restricted_, rather than _shared_. This change was brought about by the introduction of Class::Declare::Attributes and then clash with the existing Perl threading attribute *:shared*. The term _restricted_ has been chosen to reflect that the use of these methods and attributes is restricted to the family of classes derived from the base class.
The separation of terms for class and instance methods and attributes has been adopted to simplify class declarations. See *declare()* below.
Class attributes are regarded as constant by *Class::Declare*: once declared they may not be modified. Instance attributes, on the other hand, are specific to each object, and may be modified at run-time.
Internally, *Class::Declare* uses hashes to represent the attributes of each of its objects, with the hashes remaining local to *Class::Declare*. To the user, the objects are represented as references to scalars which *Class::Declare* maps to object hashes in the object accessors. This prevents users from accessing object and class data without using the class\'s accessors.
The granting of access to attributes and methods is determined by examining the _target_ of the invocation (the first parameter passed to the method, usually represented by \'$self\'), as well as the _context_ of the invocation (where was the call made and who made it, determined by examining the caller() stack). This adds an unfortunate but necessary processing overhead for *Class::Declare* objects for each method and attribute access. While this overhead has been kept as low as possible, it may be desirable to turn it off in a production environment. *Class::Declare* permits disabling of the access control checks on a per-module basis, which may greatly improve the performance of an application. Refer to the _strict_ parameter of *declare()* below for more information.
*Class::Declare* inherits from Exporter, so modules derived from *Class::Declare* can use the standard symbol export mechanisms. See Exporter for more information.
|
RPM found in directory: /packages/linux-pbone/ftp5.gwdg.de/pub/opensuse/repositories/devel:/languages:/perl:/CPAN-C/15.6/noarch |