r1670@llin: dpavlin | 2007-11-28 00:13:29 +0100
[webpac2] / lib / WebPAC / Output.pm
index ee35e7d..e0d4812 100644 (file)
@@ -25,23 +25,28 @@ Common routines for output formats
 
 =head2 ds_to_hash
 
-  my $hash = $self->ds_to_hash( $ds, 'display' );
+  my $hash = $self->ds_to_hash( $ds, 'display'
+       disable_key_mungle => 1,
+  );
 
 =cut
 
 sub ds_to_hash {
        my $self = shift;
 
-       my ( $ds, $type ) = @_;
+       my $ds = shift || confess "need ds";
+       my $type = shift || confess "need type";
 
-       confess "need ds" unless $ds;
-       confess "need type" unless $type;
+       my $opt = {@_};
 
        my $hash;
 
        foreach my $t ( keys %$ds ) {
-               my $name = lc($t);
-               $name =~ s/\W+/_/g;
+               my $name = $t;
+               if ( ! $opt->{disable_key_mungle} ) {
+                       $name = lc($name);
+                       $name =~ s/\W+/_/g;
+               }
 
                # FIXME get rid of non hash values in data_structure for consistency?
                next unless ref($ds->{$t}) eq 'HASH';