Net-Clacks
view release on metacpan or search on metacpan
lib/Net/Clacks/Server.pm view on Meta::CPAN
sub _handleMessageDirect($self, $cid, $inmsg) {
if($inmsg =~ /^NOTIFY\ (.*)/) {
return true unless($self->_requirePermission($cid, 'write'));
my %tmp = (
sender => $cid,
type => 'NOTIFY',
name => $1,
);
push @{$self->{outbox}}, \%tmp;
} elsif($inmsg =~ /^SET\ (.+?)\=(.*)/) {
return true unless($self->_requirePermission($cid, 'write'));
my %tmp = (
sender => $cid,
type => 'SET',
name => $1,
value => $2,
);
push @{$self->{outbox}}, \%tmp;
} else {
# "not handled in this sub"
return false;
}
return true;
}
1;
__END__
=head1 NAME
Net::Clacks::Server - server for CLACKS interprocess messaging
=head1 SYNOPSIS
use Net::Clacks::Server;
=head1 DESCRIPTION
This implements the server for the CLACKS interprocess messaging protocol. It supports Interclacks mode,
for a master/client server architecture.
=head2 new
Create a new instance.
=head2 init
DEPRECATED: Initialize server instance (required before running). This is now a dummy function that will show a deprecation warning and return.
Initialization is now done automatically when calling run().
=head2 run
Run the server instance in it's own event loop. Only returns when server is shutdown.
=head2 runOnce
Run through the event loop once. This allows you to use your own programs event loop, and call runOnce a couple of times per second. It is a good idea to call runShutdown() to cleanly
disconnect clients before exiting your program. runOnce() returns a "work count" number, on which you *may* decide on how busy the server is and when to call runOnce() next.
=head2 runShutdown
Shuts down all connections. This is called automatically if you use run(), but not if you use runOnce()
=head1 IMPORTANT NOTE
Please make sure and read the documentations for L<Net::Clacks> as it contains important information
pertaining to upgrades and general changes!
=head1 AUTHOR
Rene Schickbauer, E<lt>cavac@cpan.orgE<gt>
=head1 COPYRIGHT AND LICENSE
Copyright (C) 2008-2024 Rene Schickbauer
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.10.0 or,
at your option, any later version of Perl 5 you may have available.
=cut
( run in 0.674 second using v1.01-cache-2.11-cpan-39bf76dae61 )