Dave Rolsky > Fey-0.34 > Fey::Role::MakesAliasObjects

Download:
Fey-0.34.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs

Module Version: 0.34   Source  

NAME ^

Fey::Role::MakesAliasObjects - A role for objects with separate alias objects

SYNOPSIS ^

  package My::Thing;

  use Moose;

  with 'Fey::Role::MakesAliasObjects'
      => { alias_class => 'My::Alias',
           self_param  => 'thing',
           name_param  => 'alias_name',
         };

DESCRIPTION ^

This role adds a "make an alias object" method to a class. This is for things like tables and columns, which can have aliases.

PARAMETERS ^

alias_class

The name of the class whose new() is called by the alias() method (see below). Required.

self_param

The name of the parameter to pass $self to the alias_class' new() method as. Required.

name_param

The name of the parameter to alias() that passing a single string is assumed to be. Defaults to alias_name.

METHODS ^

$obj->alias()

  my $alias = $obj->alias(alias_name => 'an_alias', %other_params);

  my $alias = $obj->alias('an_alias');

Create a new alias for this object. If a single parameter is provided, it is assumed to be whatever the name_param parameter specifies (see above).

AUTHOR ^

Hans Dieter Pearcey <hdp.cpan.fey@weftsoar.net>

BUGS ^

See Fey for details on how to report bugs.

COPYRIGHT & LICENSE ^

Copyright 2006-2009 Dave Rolsky, All Rights Reserved.

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