25 |
|
|
26 |
=head2 ds_to_hash |
=head2 ds_to_hash |
27 |
|
|
28 |
my $hash = $self->ds_to_hash( $ds, 'display' ); |
my $hash = $self->ds_to_hash( $ds, 'display' |
29 |
|
disable_key_mungle => 1, |
30 |
|
); |
31 |
|
|
32 |
=cut |
=cut |
33 |
|
|
34 |
sub ds_to_hash { |
sub ds_to_hash { |
35 |
my $self = shift; |
my $self = shift; |
36 |
|
|
37 |
my ( $ds, $type ) = @_; |
my $ds = shift || confess "need ds"; |
38 |
|
my $type = shift || confess "need type"; |
39 |
|
|
40 |
confess "need ds" unless $ds; |
my $opt = {@_}; |
|
confess "need type" unless $type; |
|
41 |
|
|
42 |
my $hash; |
my $hash; |
43 |
|
|
44 |
foreach my $t ( keys %$ds ) { |
foreach my $t ( keys %$ds ) { |
45 |
my $name = lc($t); |
my $name = $t; |
46 |
$name =~ s/\W+/_/g; |
if ( ! $opt->{disable_key_mungle} ) { |
47 |
|
$name = lc($name); |
48 |
|
$name =~ s/\W+/_/g; |
49 |
|
} |
50 |
|
|
51 |
# FIXME get rid of non hash values in data_structure for consistency? |
# FIXME get rid of non hash values in data_structure for consistency? |
52 |
next unless ref($ds->{$t}) eq 'HASH'; |
next unless ref($ds->{$t}) eq 'HASH'; |
59 |
return $hash; |
return $hash; |
60 |
} |
} |
61 |
|
|
62 |
|
|
63 |
=head1 AUTHOR |
=head1 AUTHOR |
64 |
|
|
65 |
Dobrica Pavlinusic, C<< <dpavlin@rot13.org> >> |
Dobrica Pavlinusic, C<< <dpavlin@rot13.org> >> |