IO::As...eStream(3pm)
π IO::Async::Protocol::LineStream π
okay bestie, so this is the manual page for IO::Async::Protocol::LineStream β the IO::Async::Protocol::LineStream module, from the User Contributed Perl Documentation, living it up in section 3pm of the manual. And what does it do? stream-based protocols using lines of text. Let's get into it π¦
β¨ SYNOPSIS β¨
So like, most likely you're gonna subclass this class to build your actual network protocol β it's giving "starter kit, main character energy" π
package Net::Async::HelloWorld;
use strict;
use warnings;
use base qw( IO::Async::Protocol::LineStream );
sub on_read_line
{
my $self = shift;
my ( $line ) = @_;
if( $line =~ m/^HELLO (.*)/ ) {
my $name = $1;
$self->invoke_event( on_hello => $name );
}
}
sub send_hello
{
my $self = shift;
my ( $name ) = @_;
$self->write_line( "HELLO $name" );
}
And just so you know: this tiny little example is eliding the error handling, bestie β a real protocol implementation would be likely to contain that. No cap, don't ship this exact snippet as your whole network stack π
π DESCRIPTION π
Yeah soβ¦ this section is literally empty in the original. Nothing here. A whole heading with no body. It's giving "blank notes app entry". Moving on π
π EVENTS π
These events get invoked, and you've got two vibes for hooking into them β either subclass methods, or CODE references passed in as parameters. Choose your fighter β¨
π on_read_line $line
Invoked when a new complete line of input is received. That's it, that's the moment π«Ά
πΈ PARAMETERS πΈ
These named parameters can be passed to new or configure:
on_read_line => CODEβ the CODE reference for theon_read_lineevent. Slap it in and you're wired up π
π§ METHODS π§
β write_line
$lineprotocol->write_line( $text );
Writes a line of text to the transport stream. The text will have the end-of-line marker appended to it β so $text should not end with it already, okay? Don't double up on the line ending, that's not the vibe π
π AUTHOR π
Paul Evans <leonerd@leonerd.org.uk> β the icon, the legend, the moment π
and that's a wrap fr fr π
this page came to you courtesy of perl v5.40.1, dated 2026-02-21 β go off, and may all your lines arrive complete πβ¨
π¦ where this page comes from
- ubuntu stonking: libio-async-perl 0.805-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms