[EMAIL PROTECTED] wrote:
I try to process data from a hash ref in a filter, but it seems to be
"stringified" until it reaches the filter, at least that is how I
interpret the output you can see below.

Basically, instead of the line
        HASH(0x84be56c)
I would like to create something like
service_name:   src1    dst1    serv1
in the filter.

You should probably use a plugin instead of a filter.  I think filters are 
intended to be used only on string content.  But you can pass any kind of 
parameters to a plugin.

To learn how to create a plugin, see the Template::Plugin documentation--it's 
pretty simple.  Here's your example template rewritten to use a plugin:

[% USE plugin_my = MyPlugin     # Create a handle for the plugin %]
[% FOREACH participant IN participants %]
   Participant: [% participant.primary_key %]
   [% FOREACH service IN participant.services %]
       [% plugin_my.process_service( service ) # Pass the structure to the 
plugin %]
   [% END %]
[% END %]


Thank you for any pointers of what I am doing wrong or of better ways to
achieve what I am trying to do ...
Daniel.



########### OUTPUT ##############
#Dumper:
$VAR1 = {
          'service_name' => {
                              'src' => 'src1',
                              'srv' => 'serv1',
                              'dst' => 'dst1'
                            }
        };
# Filter:
GOT: $VAR1 = 'HASH(0x84be56c)';

#Template:
    Participant: 1

        HASH(0x84be56c)



########### TEMPLATE ##############

[% FOREACH participant IN participants %]
    Participant: [% participant.primary_key %]
    [% FOREACH service IN participant.services %]
        [% service FILTER flt_my %]
    [% END %]
[% END %]

[...]

--

C. Chad Wallace, B.Sc.
The Lodging Company
http://skihills.com/
OpenPGP Public Key ID: 0x262208A0

_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to