Class::MakeMethods::Template::Class - Associate information with a package


Class-MakeMethods documentation Contained in the Class-MakeMethods distribution.

Index


Code Index:

NAME

Top

Class::MakeMethods::Template::Class - Associate information with a package

SYNOPSIS

Top

  package MyObject;
  use Class::MakeMethods::Template::Class (
    scalar          => [ 'foo' ]
  );

  package main;

  MyObject->foo('bar')
  print MyObject->foo();

DESCRIPTION

Top

These meta-methods provide access to class-specific values. They are similar to Static, except that each subclass has separate values.

Class:scalar

Creates methods to handle a scalar variable in the declaring package.

See the documentation on Generic:scalar for interfaces and behaviors.

Class:array

Creates methods to handle a array variable in the declaring package.

See the documentation on Generic:array for interfaces and behaviors.

Class:hash

Creates methods to handle a hash variable in the declaring package.

See the documentation on Generic:hash for interfaces and behaviors.


Class-MakeMethods documentation Contained in the Class-MakeMethods distribution.
package Class::MakeMethods::Template::Class;

use Class::MakeMethods::Template::Generic '-isasubclass';

$VERSION = 1.008;
use strict;
require 5.0;
use Carp;

sub generic {
  {
    '-import' => { 
      'Template::Generic:generic' => '*' 
    },
    'modifier' => {
    },
    'code_expr' => {
      '_VALUE_' => '_ATTR_{data}->{_SELF_CLASS_}',
    },
  }
}

########################################################################

########################################################################

sub array {
  {
    '-import' => { 
      'Template::Generic:array' => '*',
    },
    'modifier' => {
      '-all' => q{ _REF_VALUE_ or @{_ATTR_{data}->{_SELF_CLASS_}} = (); * },
    },
    'code_expr' => {
      '_VALUE_' => '\@{_ATTR_{data}->{_SELF_CLASS_}}',
    },
  } 
}

########################################################################

sub hash {
  {
    '-import' => { 
      'Template::Generic:hash' => '*',
    },
    'modifier' => {
      '-all' => q{ _REF_VALUE_ or %{_ATTR_{data}->{_SELF_CLASS_}} = (); * },
    },
    'code_expr' => {
      '_VALUE_' => '\%{_ATTR_{data}->{_SELF_CLASS_}}',
    },
  } 
}

1;