Class::MixinFactory::HasAFactory(3pm)

Class::MixinFactory::HasAFactory3pm

Delegates to a factory

Usage

  package My::BaseClass;
  @ISA = 'Class::MixinFactory::HasAFactory';
  sub new { ... }
  sub foo { return "Foo Bar" }
  package My::Logging;
  sub foo { warn "Calling foo"; (shift)->NEXT('foo', @_) }
  package My::UpperCase;
  sub foo { uc( (shift)->NEXT('foo', @_) ) }
  package main;
  use My::BaseClass;
  print My::BaseClass->class()->new()->foo();
  print My::BaseClass->class( 'Logging' )->new()->foo();
  print My::BaseClass->class( 'UpperCase' )->new()->foo();
  print My::BaseClass->class( 'Logging', 'UpperCase' )->new()->foo();

Overview

A class for use by classes which want a factory method.

Inherit from this class to obtain the class() factory method, described below.

Public methods

mixin_factory()
  BaseClass->mixin_factory() : $factory_object

Gets the associated mixin factory. Generated the first time it is needed.

class()
  BaseClass->class( @mixins ) : $package_name

Calls the class() method on the associated mixin factory.

Releases

8 releases since Debian 6.0 (Squeeze); the text changed 3 times.

  1. 6.0–9
  2. 10
  3. 11
  4. 12–13

From libclass-mixinfactory-perl 0.92-5 in Debian 13 (Trixie). Parsed by carta from the page's man source.