/[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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 913 - (show annotations)
Tue Oct 30 20:11:02 2007 UTC (16 years, 6 months ago) by dpavlin
File size: 1076 byte(s)
 r1372@llin:  dpavlin | 2007-10-30 20:26:52 +0100
 first real method in common WebPAC::Output as a move towards pluggable
 outputs

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

  ViewVC Help
Powered by ViewVC 1.1.26