Web::MREST::CLI(3pm)

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

✨ Web::MREST::CLI ✨

okay bestie, welcome to Web::MREST::CLI πŸ’… it's part of the User Contributed Perl Documentation crew, and it's the whole mood for CLI components. Let's get into it 🫢


🌸 VERSION 🌸

Version 0.284 πŸ’–


πŸ¦‹ DESCRIPTION πŸ¦‹

So this is the top-level module of the Web::MREST::CLI distribution, the main character of the whole thing πŸ‘‘ It exports some "generalized" functions that get used internally β€” but lowkey they're also useful if you just wanna write CLI clients in general. Sharing is caring fr fr 🌈


πŸŽ€ BASIC CLI CLIENT USAGE πŸŽ€

Once you've run the CLI client executable (mrest-cli), and assuming it's pointing correctly at a running MREST-compatible server, you can start exploring the REST API by issuing this command:

get /

If the server is running at http://localhost:5000, you can get that same info by pointing a web browser at that URI. Same energy, different vibe 🌐

This gives you a list of top-level resources. Now say you wanna view documentation on a resource called foo β€” issue this:

post docu pod foo

That documentation should include info on which HTTP methods you can use to access the resource πŸ‘€

And to view the documentation on the docu/pod resource itself:

post docu pod docu/pod

Yes bestie, it's documentation on the documentation. It's giving inception, it's giving self-aware, we love her πŸ’…


πŸ’« EXPORTS πŸ’«

(no exports listed here β€” this section is just vibing, empty, iconic in its silence πŸŽ€)


πŸ‘‘ PACKAGE VARIABLES πŸ‘‘

(also just vibing with nothing listed, no cap πŸ¦‹)


πŸ”₯ FUNCTIONS πŸ”₯

🌟 init_cli_client

Takes a PARAMHASH containing the possible parameters distro, sitedir, and debug_mode. Initializes the CLI client and hands you back a status object ✨

Heads up though: the distro string should use hyphens instead of double-colons, i.e. Foo-Bar instead of Foo::Bar. Don't come in with the colons, she will not understand you 😭

🌟 normalize_filespec

Give it a filename (a path) that might be relative or absolute, and it returns an absolute version. If the path was relative, it gets anchored to the home directory of the user we're running as 🏠 so it always lands somewhere real.

🌟 init_ua

Initialize the LWP::UserAgent singleton object ✨ one user agent, one queen, no duplicates.

Return the cookie_jar associated with our user agent πŸ“ cookies!! (metaphorical cookies, HTTP cookies, but still iconic).

🌟 send_req

Send a request to the server, get the response, convert it from JSON, and return it to the caller. And if something unexpected goes wrong? It dies πŸ’€ fr fr, it will just die on unexpected errors. No gentle letdown, no soft launch.


🌈 that's the whole page bestie, you ate it, no crumbs left, periodt πŸ‘‘

and that's a wrap on perl v5.40.1, dated 2025-06-08 🫢 go forth and CLI, my love, you've got this πŸ’–πŸŒΈβœ¨

πŸ“¦ where this page comes from