如何将任意哈希转换为html表

时间:2012-04-13 03:36:06

标签: html perl

我查看了HTML::QuickTable,但AFAIK只支持一级深度哈希。对于此模块,在多级哈希的情况下,我找不到为某些标头指定colspanrowspan的方法。对此有什么解决方案吗?

考虑这个哈希,需要将其转换为类似here的表:

my $persons = {
          'Person1' => {
                    'Prop1' => {
                                  'X' => '8',
                                  'Y' => '8'
                                },
                    'Prop2' => {
                                   'X' => '5',
                                   'Y' => '5'
                               },
                    'Prop3' => {
                                   'X' => '0',
                                   'Y' => '0'
                               },
                    'Prop4' => {
                                   'X' => '10',
                                   'Y' => '10'
                               },
                    'Prop5' => {
                                   'X' => '1',
                                   'Y' => '12'
                               }
                    },
          'Person2' => {
                    'Prop1' => {
                                  'X' => '12',
                                  'Y' => '12'
                                },
                    'Prop2' => {
                                  'X' => '12',
                                  'Y' => '12'
                               },
                    'Prop3' => {
                                  'X' => '12',
                                  'Y' => '12'
                               },
                    'Prop4' => {
                                  'X' => '12',
                                  'Y' => '12'
                               },
                    'Prop5' => {
                                  'X' => '12',
                                  'Y' => '12'
                               }
                    }
        };

1 个答案:

答案 0 :(得分:0)

您选中了HTML:::Table