Jakob Voß > SeeAlso-Server > SeeAlso::Identifier::Factory

Download:
SeeAlso-Server-0.71.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.71   Source  

NAME ^

SeeAlso::Identifier::Factory - Identify and create identifiers

VERSION ^

version 0.71

SYNOPSIS ^

  $identifier = $factory->create( $could_be_an_identifier_string );

DESCRIPTION ^

A SeeAlso::Identifier::Factory object is given a string (via its method create) and returns a well-defined SeeAlso::Identifier object. A factory is useful to parse a string that may be an identifier of several identifier kinds.

The factory knows a list of identifier types (subclasses of SeeAlso::Identifier); the first type that successfully parses the provided string value is used to create the identifier object. If no type works, an empty identifier of the first type is returned.

METHODS ^

new ( %params )

Create a new Identifier Factory. You can either pass an array reference with identifier class name or a hash of methods that will be used to create a new identifier class:

  $factory = new SeeAlso::Identifier::Factory
      type => [qw( class1 class2 ... )]

  $factory = new SeeAlso::Identifier::Factory
      parse => sub { ... },
      canonical => sub { lc($_[0]) },
      hash => sub { md5_hex($_[0]) },
      type => '...';

create ( $value )

Create a new SeeAlso::Identifier object as described above.

FUNCTIONS ^

makeclass

Dynamically creates a subclass of SeeAlso::Identifier with given name and methods.

AUTHOR ^

Jakob Voss

COPYRIGHT AND LICENSE ^

This software is copyright (c) 2013 by Jakob Voss.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

syntax highlighting: