On Thu Dec 29 20:21:46 2011, bugs@bereft.net wrote:
Show quoted text>
> Hello Steven,
>
> On 29/12/11 19:47, steven haryanto via RT wrote:
> [..]
> >
> > I needed to convert all coderefs to a string (e.g. "<CODE>") to
> safely
> > pass a data structure to JSON encoder, but none of the rmap_*
> functions
> > seem to have coderef support.
> >
>
> I do have a comment from long ago in the code:
>
> # Others like CODE, Regex, etc are ignored
>
> but I can't see why that would have to be the case...
> Your use case sounds reasonable.
>
> (Urgh, going through my ancient code is horrible)
>
> I've added in CODE and rmap_code, but think I have to leave code refs
> out of ALL for compatibility. I've added your example to:
>
>
https://github.com/bowman/Data-Rmap
>
> # replace CODE with "<CODE>"
> $ perl -MData::Rmap=:all -E 'say join ":", rmap_code { "<CODE>" }
> sub{},sub{}'
> <CODE>:<CODE>
>
> So please have a look and test. I'll release it soon.
>
> Thanks for your suggestion,
>
> Brad
> Brad
Hi Brad,
Wow, not expecting a prompt reply! Thanks a lot for implementing this.
Also, please consider adding an option for rmap_all (or some other new
function) to get *all* kinds of data, be it Regexp and others. I
actually did once or twice having to search and replace all qr//
objects into its stringified form, again for passing to subsystems
outside of Perl. The ability to get all weird and Perl-specific objects
*is* the important factor here.
Regards,
Steven