Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sub BuildAndPrintTable
- {
- my $tbl = Text::ASCIITable->new( { headingText => "SOGo Configuration" } );
- $tbl->setCols('SOGo Variable', 'Your Provided Value');
- $tbl->setColWidth('SOGo Variable', 40, 1);
- $tbl->alignCol('Your Provided Value', 'left');
- # go over the hash from the configuration file and start
- # building our table
- foreach my $k ( keys %$sogo)
- {
- if(ref $sogo->{$k} eq 'HASH')
- {
- # We've likely encountered the SOGoUserSources dictionary
- # here, so we need to process this a bit differently.
- my $sources = $sogo->{$k};
- $tbl->addRowLine(); # this clears a bit of space for us
- foreach my $k ( keys %$sources )
- {
- $tbl->addRow($k, $sources->{$k});
- }
- $tbl->addRowLine();
- }
- else
- {
- $tbl->addRow($k, $sogo->{$k});
- }
- }
- print $tbl;
- }
- Results:
- +------------------------------------------+------------------------------------------------------------+
- | GroupSupport | HASH(0x8411978) |
- | UserAuthentication | HASH(0x84119e8) |
- +------------------------------------------+------------------------------------------------------------+
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement