<div dir="ltr">To be more clear, searching hash keys isn't required as the string will have a sigil to identify strings to be interpolated, but if the strategy avoided looking at hash keys, that would help avoid potentially catastrophic mistakes.<div>
<br></div><div>J</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Jun 15, 2013 at 11:22 AM, benh <span dir="ltr"><<a href="mailto:ben.hengst@gmail.com" target="_blank">ben.hengst@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I agree though in my reading that is an expected feature:<br>
<div class="im"><br>
> ...would replace foo with bar in all strings at all levels.<br>
<br>
</div>Though again I could also be completely missing the intent here so it<br>
is a completely fair thing to mention.<br>
<div class="HOEnZb"><div class="h5"><br>
On Sat, Jun 15, 2013 at 10:10 AM, Braden Kelley <<a href="mailto:bmk@rentrak.com">bmk@rentrak.com</a>> wrote:<br>
> One potential problem with serializing using something like JSON::XS is a<br>
> simple regex replace would also end up replacing hash keys, not just their<br>
> values.<br>
><br>
> # from Josh Heumann on Friday 14 June 2013:<br>
>>Using YAML/JSON isn't a bad idea, but I'm worried about the<br>
>>performance hit.<br>
><br>
> As long as your replacement doesn't break quoting or otherwise trip on<br>
> the serialization, yeah.  JSON::XS was super quick and the fastest<br>
> serializer last time I checked.  You'll need the ram.<br>
><br>
> Recursive implementation is easy enough.<br>
><br>
> sub replace_deeply {<br>
>   my ($data, $match, $replace) = @_;<br>
>   my $r;<br>
>   $r = sub {<br>
>     my $ref = ref($_[0]) or return $_[0] =~ s/$match/$replace/;<br>
>     if($ref eq 'ARRAY') {<br>
>       $r->($_) for @{$_[0]}<br>
>     }<br>
>     elsif($ref eq 'HASH') {<br>
>       $r->($_) for values %{$_[0]};<br>
>     }<br>
>   };<br>
>   $r->($data);<br>
>   return $data;<br>
> }<br>
><br>
> --Eric<br>
> --<br>
> ---------------------------------------------------<br>
>     <a href="http://scratchcomputing.com" target="_blank">http://scratchcomputing.com</a><br>
> ---------------------------------------------------<br>
> _______________________________________________<br>
> Pdx-pm-list mailing list<br>
> <a href="mailto:Pdx-pm-list@pm.org">Pdx-pm-list@pm.org</a><br>
> <a href="http://mail.pm.org/mailman/listinfo/pdx-pm-list" target="_blank">http://mail.pm.org/mailman/listinfo/pdx-pm-list</a><br>
><br>
> _______________________________________________<br>
> Pdx-pm-list mailing list<br>
> <a href="mailto:Pdx-pm-list@pm.org">Pdx-pm-list@pm.org</a><br>
> <a href="http://mail.pm.org/mailman/listinfo/pdx-pm-list" target="_blank">http://mail.pm.org/mailman/listinfo/pdx-pm-list</a><br>
<br>
<br>
<br>
</div></div><div class="im HOEnZb">--<br>
benh~<br>
<br>
<a href="http://about.notbenh.info" target="_blank">http://about.notbenh.info</a><br>
<br>
Stability is not a Regression.<br>
</div><div class="HOEnZb"><div class="h5">_______________________________________________<br>
Pdx-pm-list mailing list<br>
<a href="mailto:Pdx-pm-list@pm.org">Pdx-pm-list@pm.org</a><br>
<a href="http://mail.pm.org/mailman/listinfo/pdx-pm-list" target="_blank">http://mail.pm.org/mailman/listinfo/pdx-pm-list</a><br>
<br>
</div></div></blockquote></div><br></div>