package PhotoPub::InfoHelper;
require Exporter;
@ISA = qw(Exporter);
@EXPORT_OK = qw(&printout);

use strict;

sub printout {
  my ($prefix,$thing,$printablere) = @_;
  if(ref($thing) eq 'ARRAY') {
    foreach my $item (@$thing) {
      &printout($prefix,$item,$printablere);
    }
  } elsif(ref($thing) eq 'HASH') {
    while (my ($key,$value) = each %$thing) {
      $key="UNPRINTABLE" unless $key=~/$printablere/;
      &printout("$prefix -> $key",$value,$printablere);
    }
  } else {
    $thing="UNPRINTABLE" unless $thing=~/$printablere/;
    print "$prefix = $thing\n";
  }
}

