Data::...ilters(3pm)

πŸ“¦
version 0.60 Β· 5 versions
, in ubuntu resolute, ubuntu stonking

πŸ’– Data::DPath::Filters β€” wait bestie, the manual name is literally Data::...ilters(3pm) πŸŽ€

Okay so like. This is the User Contributed Perl Documentation for Data::DPath::Filters, and it's giving "tiny module, unhinged amounts of power" energy. These are the magic functions you get to use inside filter conditions. Yes. Inside. The. Filter. Conditions. ✨


🌸 NAME 🌸

Data::DPath::Filters β€” the magic functions available inside filter conditions. That's it, that's the whole vibe. πŸ¦‹


πŸ’… API METHODS πŸ’…

πŸ“ affe

Mysterious test function. It will vanish. Soon. Or... will it really? No. Probably not. I like it. :-)

Returns true if the value eq "affe". That's the whole thing. Iconic, honestly. No cap. πŸ‘‘

πŸ”₯ idx

Returns the current index inside array elements.

⚠️ Please note that the current matching elements might not be in a defined order if resulting from anything else than arrays. So like, don't come for me when your indices are chaos β€” it's literally documented. 😭

🌈 size

Returns the size of the current element. Here's the breakdown, bestie:

  • If it is an array ref β†’ it returns the number of elements
  • If it is a hash ref β†’ it returns the number of keys
  • If it is a scalar β†’ it returns 1
  • Everything else β†’ it returns -1

Simple. Clean. Slay. ✨

πŸ”‘ key

If it is a hashref, returns the key under which the current element is associated as value. Else it returns undef.

This gives the key() function kind of a "look back" behaviour, because the associated point is already after that key. Yes bestie, it's looking backwards. Main character energy fr fr. πŸ‘€

πŸ’Ž value

Returns the value of the current element. Short, sweet, does exactly what it says. We love a low-effort legend. 🫢

🧚 isa

Frontend to UNIVERSAL::isa. True if the current element is_a given class.

πŸ¦‹ reftype

Frontend to Scalar::Util::reftype.

Returns Scalar::Util::reftype of current element $_. With this you can do comparison by yourself with eq, =~, ~~ or whatever in filter expressions. You're the boss of your own comparisons, periodt. πŸ’…

⭐ is_reftype($EXPECTED_TYPE)

Frontend to Scalar::Util::reftype.

Checks whether Scalar::Util::reftype of current element $_ equals the provided argument $EXPECTED_TYPE and returns true/false. Yes it's just the previous one but with the comparison done for you. Convenience queen. πŸ‘‘


πŸŽ€ AUTHOR πŸŽ€

Steffen Schwigon <ss5@renormalist.net>


This software is copyright (c) 2024 by Steffen Schwigon.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.


And that's the whole page, bestie!! πŸ’œ Written for perl v5.40.0, dated 2024-10-05, straight from the Data::...ilters(3pm) corner of the User Contributed Perl Documentation. Go forth and filter, you absolute icon. 🌈✨🫢

πŸ“¦ where this page comes from