<HTML dir=ltr><HEAD>
<META http-equiv=Content-Type content="text/html; charset=unicode">
<META content="MSHTML 6.00.2900.3243" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face="Courier New" color=#000000 size=2>This isn't recursive or general use or anything, but it's what I came up with to uppercase specific things in 16 different use cases in some software I'm working on today...&nbsp; I thought it was pretty clean given the task at hand. Feedback welcome.&nbsp; :)</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2>j</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
<DIV><BR><FONT face="Courier New" size=2>=head2 uppercase_everything</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2>RT7835 - Uppercase everything sent to OCIS</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2>&nbsp; $self-&gt;uppercase_everything($qualifiers);</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2>=cut</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2>sub uppercase_everything {<BR>&nbsp;&nbsp; my ($self, $qualifiers) = @_;<BR>&nbsp;&nbsp; foreach my $key (keys %$qualifiers) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # these two have to remain lower case or OWS pukes<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; next if ($key =~ /^(primary|preferred)$/);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (ref($qualifiers-&gt;{$key}) eq "ARRAY") {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # Ack. Sometimes an arrayref is handed in.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (@{$qualifiers-&gt;{$key}}) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (ref $_ eq "HASH") {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # Ack. Hashref inside the arrayref (e.g. UserDefinedValues)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; my $href = $_;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; foreach my $key (keys %$href) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $href-&gt;{$key} = uc $href-&gt;{$key};<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } else {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # Simple scalars in our arrayref (e.g. AddressLine)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; next unless (defined $_);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tr/a-z/A-Z/;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } elsif (ref($qualifiers-&gt;{$key}) eq "HASH") {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # Are we supposed to uppercase any hashrefs?<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } else {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # Simple scalar<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $qualifiers-&gt;{$key} = uc $qualifiers-&gt;{$key};<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp; }<BR>&nbsp;&nbsp; #warn Dumper($qualifiers);<BR>&nbsp;&nbsp; return 1;<BR>}</FONT></DIV>
<DIV><FONT face="Courier New"><BR><FONT size=2></FONT></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2>$&nbsp;cat Common.t<BR>use Test::More tests =&gt; 8;</FONT></DIV>
<DIV><FONT face="Courier New" size=2># Have to instantiate any of the children to test Common...<BR>use Omni2::Model::MF::OWS::Name;<BR>my $c = Omni2::Model::MF::OWS::Name-&gt;new();</FONT></DIV>
<DIV><BR><FONT face="Courier New" size=2># Test uppercase_everything().<BR># 'lower' values should stay lowercase. 'upper's should turn to 'UPPER'<BR>my $in = {<BR>&nbsp;&nbsp; primary&nbsp;&nbsp; =&gt; 'lower',<BR>&nbsp;&nbsp; test1&nbsp;&nbsp;&nbsp;&nbsp; =&gt; 'upper',<BR>&nbsp;&nbsp; preferred =&gt; 'lower',<BR>&nbsp;&nbsp; test2&nbsp;&nbsp;&nbsp;&nbsp; =&gt; [ 'upper', 'upper'],<BR>&nbsp;&nbsp; test3&nbsp;&nbsp;&nbsp;&nbsp; =&gt; [ { test4 =&gt; 'upper', test5 =&gt; 'upper' } ]<BR>};<BR>ok($c-&gt;uppercase_everything($in),&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'uppercase_everything()');<BR>is($in-&gt;{primary},&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'lower', 'primary');<BR>is($in-&gt;{test1},&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'UPPER', 'test1');<BR>is($in-&gt;{preferred},&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'lower', 'preferred');<BR>is($in-&gt;{test2}-&gt;[0],&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'UPPER', 'test2');<BR>is($in-&gt;{test2}-&gt;[1],&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'UPPER', 'test2');<BR>is($in-&gt;{test3}-&gt;[0]-&gt;{test4}, 'UPPER', 'test4');<BR>is($in-&gt;{test3}-&gt;[0]-&gt;{test5}, 'UPPER', 'test5');</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2>$&nbsp;perl Common.t<BR>1..8<BR>ok 1 - uppercase_everything()<BR>ok 2 - primary<BR>ok 3 - test1<BR>ok 4 - preferred<BR>ok 5 - test2<BR>ok 6 - test2<BR>ok 7 - test4<BR>ok 8 - test5<BR></FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
<DIV>&nbsp;</DIV></BODY></HTML>