Class-MakeMethods

 view release on metacpan or  search on metacpan

MakeMethods/Template/Generic.pm  view on Meta::CPAN

=head1 NAME

Class::MakeMethods::Template::Generic - Templates for common meta-method types

=head1 SYNOPSIS

  package MyObject;
  use Class::MakeMethods (
    'Template::Hash:new'       => [ 'new' ],
    'Template::Hash:scalar'    => [ 'foo' ]
    'Template::Static:scalar'  => [ 'bar' ]
  );
  
  package main;

  my $obj = MyObject->new( foo => "Foozle", bar => "Bozzle" );
  print $obj->foo();
  $obj->bar("Bamboozle"); 

=head1 DESCRIPTION

This package provides a variety of abstract interfaces for constructors
and accessor methods, which form a common foundation for meta-methods
provided by the Hash, Scalar, Flyweight, Static, PackageVar, and
ClassVar implementations.

Generally speaking, the Generic meta-methods define calling interfaces
and behaviors which are bound to differently scoped data by each
of those implementations.

(Note that those implementation classes are not subclasses of
Generic; instead they import various interfaces and code fragments
from the meta-method types defined here, by specifying '-import'
values which are processed by Class::MakeMethods's _metamethod_definition
mechanism.)

=cut

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

package Class::MakeMethods::Template::Generic;

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

$VERSION = 1.008;
use strict;
use Carp;

# use AutoLoader 'AUTOLOAD';

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

sub generic {
  {
    'params' => {
    },
    'modifier' => {
      '-import' => {  'Template::Universal:generic' => '*' },
    },
    'code_expr' => { 
      '-import' => {  'Template::Universal:generic' => '*'  },
      '_VALUE_' => undef,
      '_REF_VALUE_' => q{ _VALUE_ },
      '_GET_VALUE_' => q{ _VALUE_ },
      '_SET_VALUE_{}' => q{ ( _VALUE_ = * ) },
      '_PROTECTED_SET_VALUE_{}' => q{ (_ACCESS_PROTECTED_ and _SET_VALUE_{*}) },
      '_PRIVATE_SET_VALUE_{}' => q{ ( _ACCESS_PRIVATE_ and _SET_VALUE_{*} ) },
    },
  }
}

# 1;

# __END__

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

=head2 new Constructor

There are several types of hash-based object constructors to choose from.

Each of these methods creates and returns a reference to a new
blessed instance. They differ in how their (optional) arguments
are interpreted to set initial values, and in how they operate when
called as class or instance methods.

B<Interfaces>: The following interfaces are supported.

=over 4

=item -with_values,



( run in 1.534 second using v1.01-cache-2.11-cpan-364913b4093 )