NAME

Top Close Open

Template:TT3::Element::Sigil::List - element representing the @ sigil

DESCRIPTION

Top Close Open

Element for the list context sigil '@' which forces list context on function/methods calls and unpacks list references.

This module implements a subclass of Template::TT3::Element::Sigil for representing the list context sigil @.

It is used to extract the value pairs of a list reference.

[% foo = [1, 2, 3]
   bar = [4, 5, 6]
   baz = [@foo, @bar]       # same as: baz = [1, 2, 3, 4, 5, 6]
%]

If its target expression is a function then it will be called in list context.

[% bar()  %]                # called in scalar context by default
[% @bar() %]                # called in explicit list context

It is also used in function signatures to indicate a list variable that should collect all additional positional arguments.

[% foo(@list) = "You called foo() with $list.join" %]
[% foo(10,20,30) %]    # You called foo() with 10 20 30

METHODS

Top Close Open

This module implements the following methods in addition to those inherited from the Template::TT3::Element::Sigil , Template::TT3::Element , Template::TT3::Base and Badger::Base base classes.

text()

Top Close Open

value()

Top Close Open

values()

Top Close Open

pairs()

Top Close Open

An alias to values() .

in_signature()

Top Close Open

AUTHOR

Top Close Open

Andy Wardley http://wardley.org

COPYRIGHT

Top Close Open

Copyright (C) 1996-2009 Andy Wardley. All Rights Reserved.

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


http://tt3.template-toolkit.org/docs/Template/TT3/Element/Sigil/List.pm last modified 2009-11-25 21:23:39