Home

The devel/p5-Class-Factory port

p5-Class-Factory-1.06p0 – automates the Factory design pattern (cvsweb github mirror)

Description

Class::Factory - Base class for dynamic factory classes

  package My::Factory;

  use strict;
  use base qw( Class::Factory );

  # Add our default types

  My::Factory->add_factory_type( perl  => 'My::Factory::Perl' );
  My::Factory->add_factory_type( blech => 'My::Factory::Blech' );

  1;

  # Create new objects using the default types

  my $perl_item = My::Factory->new( 'perl', foo => 'bar' );  
  my $blech_item = My::Factory->new( 'blech', foo => 'baz' );  
WWW: https://metacpan.org/release/Class-Factory

Maintainer

The OpenBSD ports mailing-list

Categories

devel perl5

Files

Search