POE(3)

πŸ“¦ version 0.04, in arch rolling

πŸŽ€ POE(3) β€” Curses::UI::POE, the POE-friendly glow-up πŸŽ€

🌸 NAME 🌸

Curses::UI::POE β€” A subclass makes Curses::UI POE Friendly. πŸ’…


✨ SYNOPSIS ✨

Okay bestie, here's the whole vibe:

use Curses::UI::POE;

my $cui = new Curses::UI::POE inline_states => {
    _start => sub {
        $_[HEAP]->dialog("Hello!");
    },

    _stop => sub {
        $_[HEAP]->dialog("Good bye!");
    },
};

$cui->mainloop

πŸ¦‹ INTRODUCTION πŸ¦‹

This is a subclass for Curses::UI that enables it to work with POE. It is designed to simply slide over Curses::UI. Keeping the API the same and simply forcing Curses::UI to do all of its event handling via POE, instead of internal to itself. This allows you to use POE behind the scenes for things like networking clients, without Curses::UI breaking your programs' functionality. No cap, that's the whole point. ✨


πŸ’– ADDITIONS πŸ’–

This is a list of distinct changes between the Curses::UI API and the Curses::UI::POE API. They should all be non-obstructive additions only, keeping Curses::UI::POE a drop-in replacement for Curses::UI. 🫢

πŸŽ€ Constructor Options πŸŽ€

πŸ’« inline_states πŸ’«

The inline_states constructor option lets you insert inline states into the Curses::UI::POE controlling session. Since Curses::UI::POE is implemented with a small session, I figured it might be useful to give you access to the controlling session for all POE-to-Interface interaction. It's giving "backstage pass to the event loop." 🎟️

While Curses::UI events are still seamlessly forced to use POE, this allows you to use it for a little bit more, such as catching responses from another POE component that should be directly connected with output. (See the IRC client example.) iykyk πŸ‘€

In this controlling session, however, the heap is predefined as the root Curses::UI object, which is a hash reference. In the Curses::UI object, all private data is indexed by a key beginning with "-". So if you wish to use the heap to store other data, simply don't use the "-" hash index prefix to avoid conflicts. tiny detail, big save. πŸ’›


⏰ TIMERS ⏰

The undocumented Curses::UI timers ($cui->timer) will still work, and they will be translated into POE delays. I would suggest not using them, however, as POE's internal alarms and delays are far more robust. πŸ”₯


πŸ’¬ DIALOGS πŸ’¬

The Curses::UI::POE dialog methods contain their own miniature event loop, similar to the way Curses::UI's dialog methods worked. However, instead of blocking and polling on readkeys, it incites its own custom miniature POE Event loop until the dialog has completed, and then its result is returned as per the Curses::UI specifications. Little loop, big main-character energy. 🌟


πŸͺ© MODALITY πŸͺ©

Curses::UI::POE builds its own internal modality structure. This allows Curses::UI to manage it, and POE to issue the (hopefully correct) events. To do this it uses its own custom (smaller) event loop, which is reentrant into the POE::Loop in use (in this case, usually POE::Loop::Select). This way there can be several recursed layers of event loops, forcing focus on the current modal widget, without stopping other POE::Sessions from running. layers on layers, but make it focused πŸŒ€


πŸ‘€ SEE ALSO πŸ‘€

  • POE
  • Curses::UI

Use of this module requires understanding of both the Curses::UI widget set and the POE Framework. Basically: know your widgets, know your POE. Periodt. πŸ‘‘


πŸ’€ BUGS πŸ’€

  • Dialogs before ->mainloop() β€” aka dialogs before Curses::UI::Mainloop.

Find more? Send them to me! tag@cpan.org πŸ“¬


πŸ‘‘ AUTHOR πŸ‘‘

Rocco Caputo (rcaputo@cpan.org)

Rocco has helped in an astronomical number of ways. He helped me work out a number of issues (including how to do this in the first place) and at least half the code, if not more, came from his fingertips. an icon, honestly. 🌟


🫢 MAINTAINER 🫢

Scott McCoy (tag@cpan.org)

This was my stupid idea. I also got to maintain it, although the original code (some of which may or may not still exist) came from Rocco. we love a chaotic origin story. οΏ½


πŸ’– That’s the page, bestie! Source/version tea: perl v5.38.2; date: 2024-07-13; manual: POE(3). Mwah! πŸ’–

πŸ“¦ where this page comes from