This is how I explored before source diving in Sorting Template Toolkit Array of Hashrefs [%#
## tpage sort.compound.tt
## tpage --debug=2047 sort.compound.tt
## tpage --debug=all sort.compound.tt
##
## tpage --debug=off sort.compound.tt
## tpage --debug=vars sort.compound.tt
## tpage --debug=filters sort.compound.tt
## tpage --debug=dirs sort.compound.tt
## tpage --debug=provider sort.compound.tt
## tpage --debug=plugins sort.compound.tt
#~ unknown debug flag ## tpage --debug=flags sort.compound.tt
## tpage --debug=stash sort.compound.tt
## tpage --debug=undef sort.compound.tt
## tpage --debug=context sort.compound.tt
## tpage --debug=caller sort.compound.tt
## tpage --debug=parser sort.compound.tt
## tpage --debug=all sort.compound.tt
## tpage --debug=on sort.compound.tt
## tpage --debug=service sort.compound.tt
##
## http://perlmonks.org/?node_id=982470# Re^3: Sorting Template Toolki
+t Array of Hashrefs
##
##
##
## COMMENTS END
-%]
[%
SET results = [
{ 'a' => [ { 'b' => 6 } ] },
{ 'a' => [ { 'b' => 3 } ] },
{ 'a' => [ { 'b' => 4 } ] },
{ 'a' => [ { 'b' => 9 } ] },
];
%]
[% USE Dumper Indent = 0;
GET Dumper.dump( results );
%]
##
[% FOREACH item IN results.sort %]
[% USE Dumper Indent = 0; GET Dumper.dump( item ); -%]
[% END %]
##
[% FOREACH item IN results.nsort('a.0.b') %]
[% USE Dumper Indent = 0; GET Dumper.dump( item ); -%]
[% END %]
####################
####################
[%
SET results = [
{ 'a' => [ { 'b' => 6 } ], 'a.0.b' => 6 },
{ 'a' => [ { 'b' => 3 } ], 'a.0.b' => 3 },
{ 'a' => [ { 'b' => 4 } ], 'a.0.b' => 4 },
{ 'a' => [ { 'b' => 9 } ], 'a.0.b' => 9 },
];
USE Dumper Indent = 0;
FOREACH item IN results.nsort('a.0.b');
GET Dumper.dump( item );
GET "\n";
END;
%]
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|