You Here : Home > Linux

Class::Member::HASH 1.3

OS Support:


Publisher Old version


September 3 2011


Class::Member::HASH 1.3


Class:: Member:: Hash is a Perl module for module development package easier.SYNOPSIS MyModule; Class of Service :: Member:: HASH qw / member_A member_B-CLASS_MEMBERS /, or MyModule packages, use Class:: Member:: GLOB qw / member_A member_B-CLASS_MEMBERS /, or MyModule packages, use Class:: Member qw / member_A member_B-CLASS_MEMBERS /, or MyModule package, use Class:: Member:: Dynamic qw / member_A member_B-CLASS_MEMBERS /; class instances are especially blessed Perl hashes or Globs and member variables store or as "$ self-> () membername "or self "${*$) (membername)", respectively. This is very error prone when you start to develop derived classes based on such modules. The designer of the derived class must watch the member variables of the base class to avoid name conflicts. To avoid the "Class:: Member:: XXX" stores the member variables in its own namespace prefixing the package name in the variable name, eg package My:: News:: Module; Class d 'Use:: Member:: QW hash / member_A memberB /; will store "member_A" only "$ self-> (' My:: News:: Module:: member_A ')." To facilitate access to these members easier than it exports functions to access the calling namespace. To access "member_A simply call. $ self-> member_A; read access # $ self-> member_A ($ new_value) ; write access # $ self-> member_A = $ new_value; # write access (used as lvalue) "Class:: Members:: Hash" and "Class:: Member:: GLOB" are used if your objects are or HASH GLOB references. But sometimes you do not know if your cases are Globs or hash (Consider development of derived classes whose base class is subject to change).. In this case, use "Class:: Member" and methods are defined at compile time to handle each type of objects, small balls and hash tables. But the first access to a method redefines the type of real object. Thus, the first attack will last a little longer but all subsequent calls are executed at the same speed as "Class:: Member:: GLOB" or "Class:: Members:: Hash." Class:: Member:: Dynamic "is used if your items can be Globs and hashes in the same time. The actual type is determined at each access and appropriate measures are taken. In addition to the names of members, it is (now) an option that can be given: "-CLASS_MEMBERS. It allows the import "()" function to create an array called @ CLASS_MEMBERS in the space of the caller, containing the names of all the methods it defines. Thus, you can create a contructor that expects named parameters where each name corresponds to a class member: class user:: QW members / member_A member_B-CLASS_MEMBERS /; our CLASS_MEMBERS @; sub new (my $ parent = shift; my $ class = ref ($ parent) | | $ parent my $ i = bless my class {}=>$,% o = @ _ if (ref ($ parent)) (foreach # first inherit my M $ (@ CLASS_MEMBERS) (parent $ i-> m $ $ => $ m)) then # override with named parameters foreach my $ m (@ CLASS_MEMBERS) ($ i-> m = $ $ $ o (m) if (exists $ o ($ m))) return $ i;) Requirements: Perl ·

Related Downloads

  • Class::Member::GLOB 1.3
  • Class:: Member:: GLOB is a module to module development package easier.SYNOPSIS MyModule; use Class:: Members: : Hash qw / member_A member_B-CLASS_MEMBERS /, or MyModule packages, use Class:: Member:: GLOB qw / member_A member_B-CLASS_MEMBERS /, or...

    Software Tags

    Class::member::hash | Class::member::hash 1.3 | Class::member::hash Free Download | Class::member::hash Reviews | Download Class::member::hash

    Size :