POE::C...Message(3pm)

πŸ“¦
version 0.04 Β· 2 versions
, in fedora 43

πŸ’– POE::C...Message β€” the whole vibe πŸ’–

okay bestie, sit down, hydrate, because we're talking about POE::Component::Server::Bayeux::Client::Message, a little Perl module from the User Contributed Perl Documentation section, and it's genuinely so much more interesting than it sounds, I promise 🫢


✨ NAME ✨

POE::Component::Server::Bayeux::Client::Message β€” the lil object that represents a single message of a request. one message. one moment. main character energy fr fr πŸ’…


🌸 DESCRIPTION 🌸

So this whole thing is used internally by POE::Component::Server::Bayeux::Request. iykyk, you don't call it yourself, it's backstage crew but make it iconic.

It's the parent class of the different message types β€” that's Meta, Service, and Publish by default, like the default squad πŸ’– β€” and every one of those messages can override the object methods down below, or just call them via SUPER and vibe off the original. both are valid, no judgement 🌈


πŸ’… METHODS πŸ’…

πŸ‘‘ Accessors

these are the accessors to this object's hashref. yes it's a hashref. yes it's giving blessed-hash realness.

  • is_error β€” the error slot, keeps track of the oopsie πŸ’€
  • request β€” the request this message belongs to

πŸŽ€ Data Accessors

these reach into the message payload and grab the named field. one per field, no cap:

  • channel
  • version
  • minimumVersion
  • supportedConnectionTypes
  • clientId
  • advice
  • connectionType
  • id
  • timestamp
  • data
  • connectionId
  • successful
  • subscription
  • error
  • ext

πŸ¦‹ server_config ()

hands you back the server's args. that's it. that's the whole method. slay ✨

🧚 pre_handle ()

called by the request before handle(). this is the message's moment to mess with the queueing of the other messages in the request, or honestly do anything else it wants. chaotic freedom era πŸ’œ

πŸ”₯ handle ()

at the absolute minimum, this validates the fields of the message payload. and a message will usually drop a response in this block, like so:

$message->request->add_response({ successful => 1 });

look at it. it's beautiful. it's the whole point.

🌈 post_handle ()

like pre_handle(), but it happens after the handle() phase. bookend behaviour, we love symmetry 🫢

⭐ validate_fields (%spec)

give it a Params::Validate spec and it will test the payload for validity. and if it fails? the error message gets stored in is_error(). so like, failure is not silent here, it's documented and accounted for πŸ’…


πŸ’– CLASS METHODS πŸ’–

πŸŽ€ new (..)

basic new() call β€” it needs only 'request' and 'data'. low maintenance king πŸ‘‘

🌸 payload

returns the message payload. the data. the goods. periodt.

πŸ¦‹ mk_data_accessors (@method_names)

generates object accessor methods for the named methods you hand it. it supplements the generic methods that get created for all message types β€” so you're adding to the pile, not replacing it, got it? πŸ’œ


Copyright (c) 2008 Eric Waters and XMission LLC (http://www.xmission.com/). All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

The full text of the license can be found in the LICENSE file included with this module.


πŸ’œ AUTHOR πŸ’œ

Eric Waters <ewaters@uarc.com>


okay that's the whole page bestie, and as a lil sign-off: this gorgeousness is documented for perl v5.42.0, dated 2025-07-25 πŸŽ€ go forth and validate your fields, mwah πŸ’–βœ¨

πŸ“¦ where this page comes from