/[webpac2]/trunk/lib/WebPAC/Output.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /trunk/lib/WebPAC/Output.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1068 - (hide annotations)
Tue Nov 27 23:45:28 2007 UTC (16 years, 6 months ago) by dpavlin
File size: 1176 byte(s)
 r1670@llin:  dpavlin | 2007-11-28 00:13:29 +0100
 - WebPAC::Output::Excel

1 dpavlin 1 package WebPAC::Output;
2    
3     use warnings;
4     use strict;
5    
6 dpavlin 913 use Carp qw/confess/;
7    
8 dpavlin 1 =head1 NAME
9    
10     WebPAC::Output - The great new WebPAC::Output!
11    
12     =head1 VERSION
13    
14     Version 0.01
15    
16     =cut
17    
18     our $VERSION = '0.01';
19    
20     =head1 SYNOPSIS
21    
22 dpavlin 913 Common routines for output formats
23 dpavlin 1
24 dpavlin 913 =head1 FUNCTIONS
25 dpavlin 1
26 dpavlin 913 =head2 ds_to_hash
27 dpavlin 1
28 dpavlin 1068 my $hash = $self->ds_to_hash( $ds, 'display'
29     disable_key_mungle => 1,
30     );
31 dpavlin 1
32 dpavlin 913 =cut
33 dpavlin 1
34 dpavlin 913 sub ds_to_hash {
35     my $self = shift;
36 dpavlin 1
37 dpavlin 1068 my $ds = shift || confess "need ds";
38     my $type = shift || confess "need type";
39 dpavlin 1
40 dpavlin 1068 my $opt = {@_};
41 dpavlin 1
42 dpavlin 913 my $hash;
43 dpavlin 1
44 dpavlin 913 foreach my $t ( keys %$ds ) {
45 dpavlin 1068 my $name = $t;
46     if ( ! $opt->{disable_key_mungle} ) {
47     $name = lc($name);
48     $name =~ s/\W+/_/g;
49     }
50 dpavlin 1
51 dpavlin 913 # FIXME get rid of non hash values in data_structure for consistency?
52     next unless ref($ds->{$t}) eq 'HASH';
53 dpavlin 1
54 dpavlin 913 if ( defined( $ds->{$t}->{$type} ) ) {
55     $hash->{$name} = $ds->{$t}->{$type};
56     }
57     }
58 dpavlin 1
59 dpavlin 913 return $hash;
60 dpavlin 1 }
61    
62 dpavlin 924
63 dpavlin 1 =head1 AUTHOR
64    
65     Dobrica Pavlinusic, C<< <dpavlin@rot13.org> >>
66    
67     =head1 COPYRIGHT & LICENSE
68    
69 dpavlin 913 Copyright 2005-2007 Dobrica Pavlinusic, All Rights Reserved.
70 dpavlin 1
71     This program is free software; you can redistribute it and/or modify it
72     under the same terms as Perl itself.
73    
74     =cut
75    
76     1; # End of WebPAC::Output

  ViewVC Help
Powered by ViewVC 1.1.26