IIRC, single element array refs get turned into single elements.  But, I
thought it was only an issue when returning lists and not list refs.

Anyway, this code and template:

    warn "in perl\n";
    my @options = $self->field('time_zone')->options;
    warn Dumper [EMAIL PROTECTED];

    my $options = $self->field('time_zone')->options;
    warn Dumper $options;

    [% 
        "in template\n" | stderr;
        USE Dumper;
        Dumper.dump( form.field('time_zone').options ) | stderr;

        FOR i = form.field('time_zone').options;
            "value = $i.value, lable = $i.label\n" | stderr;
        END;

    %]


results in:

in perl
$VAR1 = [
          {
            'value' => '1',
            'label' => 'America/Los_Angeles'
          }
        ];
$VAR1 = [
          {
            'value' => '1',
            'label' => 'America/Los_Angeles'
          }
        ];

in template
$VAR1 = {
          'value' => '1',
          'label' => 'America/Los_Angeles'
        };


value = America/Los_Angeles, lable = 
value = 1, lable = 

Where there's two elements in the array it works as expected.

in template
$VAR1 = [
          {
            'value' => '3',
            'label' => 'America/Chicago'
          },
          {
            'value' => '1',
            'label' => 'America/Los_Angeles'
          }
        ];
value = 3, lable = America/Chicago
value = 1, lable = America/Los_Angeles



-- 
Bill Moseley
[EMAIL PROTECTED]


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

Reply via email to