Dave Rolsky > Fey-0.40 > Fey::Role::HasAliasName

Download:
Fey-0.40.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  3
Open  2
View/Report Bugs
Module Version: 0.40   Source  

NAME ^

Fey::Role::HasAliasName - A role for objects that bring an alias with them

VERSION ^

version 0.40

SYNOPSIS ^

  package My::Thing;

  use Moose;
  with 'Fey::Role::HasAliasName'
      => { generated_alias_prefix => 'THING' };

DESCRIPTION ^

This role adds an alias_name attribute to objects, as well as some methods for making use of that alias.

PARAMETERS ^

generated_alias_prefix

The prefix that generated aliases will have, e.g. LITERAL, FUNCTION, etc. Required.

sql_needs_parens

If true, sql_with_alias() will wrap the output of sql() when generating its own output. Default is false.

METHODS ^

$obj->alias_name()

Returns the current alias name, if any.

$obj->set_alias_name()

  $obj->set_alias_name('my object');

Sets the current alias name.

$obj->alias()

  $obj->alias('my object')->do_something_else(...);

Sets the current alias name, then returns the object.

$obj->sql_with_alias()

$obj->sql_or_alias()

Returns the appropriate SQL snippet. sql_with_alias will generate an alias if one has not been set (using generated_alias_prefix, above).

BUGS ^

See Fey for details on how to report bugs.

AUTHOR ^

Dave Rolsky <autarch@urth.org>

COPYRIGHT AND LICENSE ^

This software is Copyright (c) 2011 by Dave Rolsky.

This is free software, licensed under:

  The Artistic License 2.0 (GPL Compatible)
syntax highlighting: