File perl-FUSE-Server.spec of Package perl-FUSE-Server

#
# spec file for package perl-FUSE-Server
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name:           perl-FUSE-Server
Version:        1.19
Release:        0
%define cpan_name FUSE-Server
Summary:        Perl-FUSE server
License:        CHECK(GPL-1.0+ or Artistic-1.0)
Group:          Development/Libraries/Perl
Url:            http://search.cpan.org/dist/FUSE-Server/
Source0:        http://www.cpan.org/authors/id/I/IA/IAMCAL/%{cpan_name}-%{version}.tar.gz
BuildArch:      noarch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  perl
BuildRequires:  perl-macros
%{perl_requires}

%description
The 'FUSE::Server' module will create a TCP FUSE server and dispatch
messages to registered event handlers.

The external interface to 'FUSE::Server' is:

* $s = FUSE::Server->new( [%options] );

The object constructor takes the following arguments in the options hash:

*Quiet = 0|1*

Whether to be quiet. Default is to report all events to STDOUT (not
'Quiet').

*Port = n*

The port for the server to listen on. Default is 1024.

*MaxClients = n*

Maximum incoming connections to allow. Default is SOMAXCONN.

* $s->bind();

This method starts the server listening on it's port and returns the IP
which it is listening on.

* $s->addCallback( $message, $coderef );

This method registers the referenced subroutine as a handler for the
specified message. When the server receives that message from the client,
it checks it's handler hash and dispatches the decoded message to the sub.
The sub should handle the following arguments:

'( $userid, $msg, $params )'

$userid contains the internal connection id for the client session. You can
use this id to associate logins with clients. The $msg parameter contains
the message the client sent. This allows one routine to handle more than
one message. Messages from clients are typically uppercase, with lowercase
messages being reserved for internal server events, such as client
connect/disconnect. The available internal messages are:

*client_start*

This message is sent when a client first connects. It is typically used to
issue a _SECRET_KEY_ message to the client.

*client_stop*

This message is sent when a client disconnects.

* $s->defaultCallback( $coderef );

For all messages without an assigned handler, the default handler (if set)
is sent the message. If you'd like to handle all messages internally, then
setup 'defaultCallback' without setting up any normal 'addCallback''s.

* $s->stop();

This method shuts down the server gracefully. Since the 'start' method
loops forever, the 'stop' method is generally set up to run on a signal.

* $s->start();

This method invokes the server's internal message pump. This loop can only
be broken by a signal.

* $s->send( $userid, $message, $params );

This method sends a message to a single client.

* $s->sendAll( $message, $params );

This method broadcasts a message to all clients.

%prep
%setup -q -n %{cpan_name}-%{version}

%build
%{__perl} Makefile.PL INSTALLDIRS=vendor
%{__make} %{?_smp_mflags}

%check
%{__make} test

%install
%perl_make_install
%perl_process_packlist
%perl_gen_filelist

%files -f %{name}.files
%defattr(-,root,root,755)
%doc Changes examples README

%changelog
openSUSE Build Service is sponsored by