Catman...::Path(3pm)

πŸ“¦
version 1.2025 Β· 4 versions
, in ubuntu resolute, ubuntu stonking

✨ Catmandu::Util::Path ✨

okay so bestie, gather round, because this is the Catmandu::Util::Path page β€” straight out of the User Contributed Perl Documentation, section 3pm, and it's giving path-related utility functions and nothing else. short page, elite content, we love a concise icon πŸ’…


πŸ¦‹ NAME πŸ¦‹

Catmandu::Util::Path β€” path related utility functions. that's it, that's the whole name, no notes πŸ’–


🌸 FUNCTIONS 🌸

looks_like_path($str)

this one is your lil vibe check for strings 🫢 it returns 1 if the string you handed it is a path, and 0 if it's not.

⚠️ but fr fr, at the moment it only recognizes Catmandu::Path::simple paths β€” and specifically ones prefixed with a dollar sign. that's the whole guest list. no plus-ones. periodt.

like, watch:

looks_like_path("$.foo.bar.$append")
# => 1
looks_like_path("waffles")
# => 0

"$.foo.bar.$append"? iconic, valid, a path. "waffles"? bestie that's breakfast, not a path πŸ’€ returns 0, respectfully.


as_path($str, $type)

this is the helper function that hands you back a Catmandu::Path instance for whatever path string you gave it. glow-up complete ✨

the optional $type argument gives preliminary support for alternative path implementations β€” and it defaults to 'simple'. so if you don't say anything, simple is what you get, and honestly? she's serving.

check the receipts:

as_path("$.foo.bar.$append")
# is equivalent to
Catmandu::Path::simple->new(path => "$.foo.bar.$append");

so yeah, as_path("$.foo.bar.$append") is literally the same thing as calling Catmandu::Path::simple->new(path => "$.foo.bar.$append") yourself. same energy, less typing, we stan a shortcut πŸ‘‘


πŸŽ€ quick recap so it's locked in: looks_like_path($str) = is it a path or not, as_path($str, $type) = gimme the actual path object. two functions, zero drama. ate. no cap. πŸ¦‹

and that's the whole page bestie, we made it 🫢 this was perl v5.40.1, dated 2026-01-24 β€” mwah, take care of her, she's tiny but she's perfect πŸ’–πŸŒΈβœ¨

πŸ“¦ where this page comes from