Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.
Some modules will have very little take-up, but when you need them, you need them. Hence, my Data::FetchPath, which should be on a mirror near you soon.
For a whole variety of reasons I sometimes find I need to know where in a data structure a particular piece of data is. I've used it for Prolog-style data unification and changing data structures on the fly, but I also sometimes use it for digging into complex objects and I want to know which path in a DBIx::Class resultsource holds a given value.
use Data::FetchPath 'path';
# find all http:// https:// urls
my $paths = path($complex_data_structure, qr{^https?://});
foreach my $path (@$paths) {
print eval "\$complex_data_structure->$path\n";
}
The data structure only supports array and hashrefs and the value you match against must be a scalar or a regex. Though as I was trying to explain this to my brother, I realized that I should add support for callbacks. For example, if you wanted to know how many values in an array of arrays are prime:
print scalar @{ path($AoA, sub { is_prime(shift) }) };
Callbacks should be trivial to add, but I need to get some sleep.
And yes, it handles circular data structures. That was my first bug with it. It's a bit hackish, but it does the job.
As is usually the case with most of my new code, you can get it from github.
Smartmatch? (Score:1)
Of course 5.10 is still rare in production - so in FormHandler we just emulate smartmatch.
Re: (Score:2)
We're not on 5.10 at work and probably won't be any time soon. Still, while smart match is a great "first check", does it return the paths? That's what I need, not just the values.