3 |
use warnings; |
use warnings; |
4 |
use strict; |
use strict; |
5 |
|
|
6 |
|
use Carp qw/confess/; |
7 |
|
|
8 |
=head1 NAME |
=head1 NAME |
9 |
|
|
10 |
WebPAC::Output - The great new WebPAC::Output! |
WebPAC::Output - The great new WebPAC::Output! |
19 |
|
|
20 |
=head1 SYNOPSIS |
=head1 SYNOPSIS |
21 |
|
|
22 |
Quick summary of what the module does. |
Common routines for output formats |
23 |
|
|
24 |
Perhaps a little code snippet. |
=head1 FUNCTIONS |
25 |
|
|
26 |
use WebPAC::Output; |
=head2 ds_to_hash |
27 |
|
|
28 |
my $foo = WebPAC::Output->new(); |
my $hash = $self->ds_to_hash( $ds, 'display' |
29 |
... |
disable_key_mungle => 1, |
30 |
|
); |
31 |
|
|
32 |
=head1 EXPORT |
=cut |
33 |
|
|
34 |
A list of functions that can be exported. You can delete this section |
sub ds_to_hash { |
35 |
if you don't export anything, such as for a purely object-oriented module. |
my $self = shift; |
36 |
|
|
37 |
=head1 FUNCTIONS |
my $ds = shift || confess "need ds"; |
38 |
|
my $type = shift || confess "need type"; |
39 |
|
|
40 |
=head2 function1 |
my $opt = {@_}; |
41 |
|
|
42 |
=cut |
my $hash; |
43 |
|
|
44 |
sub function1 { |
foreach my $t ( keys %$ds ) { |
45 |
} |
my $name = $t; |
46 |
|
if ( ! $opt->{disable_key_mungle} ) { |
47 |
|
$name = lc($name); |
48 |
|
$name =~ s/\W+/_/g; |
49 |
|
} |
50 |
|
|
51 |
=head2 function2 |
# FIXME get rid of non hash values in data_structure for consistency? |
52 |
|
next unless ref($ds->{$t}) eq 'HASH'; |
53 |
|
|
54 |
=cut |
if ( defined( $ds->{$t}->{$type} ) ) { |
55 |
|
$hash->{$name} = $ds->{$t}->{$type}; |
56 |
|
} |
57 |
|
} |
58 |
|
|
59 |
sub function2 { |
return $hash; |
60 |
} |
} |
61 |
|
|
62 |
|
|
63 |
=head1 AUTHOR |
=head1 AUTHOR |
64 |
|
|
65 |
Dobrica Pavlinusic, C<< <dpavlin@rot13.org> >> |
Dobrica Pavlinusic, C<< <dpavlin@rot13.org> >> |
66 |
|
|
|
=head1 BUGS |
|
|
|
|
|
Please report any bugs or feature requests to |
|
|
C<bug-webpac-output@rt.cpan.org>, or through the web interface at |
|
|
L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=WebPAC>. |
|
|
I will be notified, and then you'll automatically be notified of progress on |
|
|
your bug as I make changes. |
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
|
|
|
|
67 |
=head1 COPYRIGHT & LICENSE |
=head1 COPYRIGHT & LICENSE |
68 |
|
|
69 |
Copyright 2005 Dobrica Pavlinusic, All Rights Reserved. |
Copyright 2005-2007 Dobrica Pavlinusic, All Rights Reserved. |
70 |
|
|
71 |
This program is free software; you can redistribute it and/or modify it |
This program is free software; you can redistribute it and/or modify it |
72 |
under the same terms as Perl itself. |
under the same terms as Perl itself. |