Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
Reflex::Role::ConnectiUser)Contributed Perl DocumenReflex::Role::Connecting(3)

NAME
       Reflex::Role::Connecting	- add non-blocking client connecting to	a
       class

VERSION
       This document describes version 0.100, released on April	02, 2017.

SYNOPSIS
	       package Reflex::Connector;

	       use Moose;
	       extends 'Reflex::Base';

	       has socket => (
		       is	 => 'rw',
		       isa	 => 'FileHandle',
	       );

	       has port	=> (
		       is => 'ro',
		       isa => 'Int',
	       );

	       has address => (
		       is      => 'ro',
		       isa     => 'Str',
		       default => '127.0.0.1',
	       );
       TODO - Changed.
	       with 'Reflex::Role::Connecting' => {
		       connector   => 'socket',	     # Default!
		       address	   => 'address',     # Default!
		       port	   => 'port',	     # Default!
		       cb_success  => 'on_connection',
		       cb_error	   => 'on_error',
	       };

	       1;

DESCRIPTION
       Reflex::Role::Connecting	is a Moose parameterized role that adds	non-
       blocking	connect() behaviors to classes.

       See Reflex::Connector if	you prefer runtime composition with objects,
       or if Moose syntax just gives you the willies.

   Required Role Parameters
       None.

   Optional Parameters
       address

       "address" defines the attribute that will contain the address to	which
       the class will connect.	The address() attribute	will be	used if	the
       class doesn't override the name.	 The default address will be the IPv4
       localhost, "127.0.0.1".

       port

       "port" defines the attribute that will contain the port to which	this
       role will connect.  By default, the role	will use the port() attribute.
       There is	no default port() value.

       socket

       The "socket" parameter must contain the name of an attribute that
       contains	the connecting socket handle.  "socket"	will be	used if	a name
       isn't provided.	A "socket" must	be provided if two or more client
       connections will	be created from	the same class,	otherwise they will
       both attempt to use the same "socket".

       Reflex::Role::Connecting	will create a plain TCP	socket if "socket"'s
       attribute is empty at connecting	time.  A class may build its own
       socket, if it needs to set special options.

       The role	will generate additional methods and callbacks that are	named
       after "socket".	For example, if	"socket" contains XYZ, then the
       default error callback will be on_XYZ_error().

       cb_success

       "cb_success" overrides the default name for the class's successful
       connection handler method.  This	handler	will be	called whenever	a
       client connection is successfully connected.

       The default method name is "on_${socket}_success", where	$socket	is the
       name of the socket attribute.

       The role	defines	a default "on_${socket}_success" callback that emits
       an event	with the callback's parameters.	 The default event is the
       "socket"	name followed by "_success", as	in "XYZ_success".

       The role's "ev_success" parameter changes the name of the success event
       to be emitted.

       All callback methods receive two	parameters: $self and an anonymous
       hash containing information specific to the callback.  In
       "cb_success"'s case, the	anonymous hash contains	one value: the socket
       that has	just established a connection.

       cb_error

       "cb_error" names	the $self method that will be called whenever
       connect() encounters an error.  By default, this	method will be the
       catenation of "on_", the	"socket" name, and "_error".  As in
       on_XYZ_error(), if the socket attribute is named	"XYZ".

       The role	defines	a default callback that	will emit an event with
       cb_error()'s parameters.	 The default event is the "socket" name
       followed	by "_error".  For example, "XYZ_error".	 The role's "ev_error"
       parameter changes the event to be emitted.

       "cb_error" callbacks receive two	parameters, $self and an anonymous
       hashref of named	values specific	to the callback.  Reflex error
       callbacks include three standard	values.	 "errfun" contains a single
       word description	of the function	that failed.  "errnum" contains	the
       numeric value of	$! at the time of failure.  "errstr" holds the
       stringified version of $!.

       Values of $! are	passed as parameters since the global variable may
       change before the callback can be invoked.

       When overriding this callback, please be	sure to	call stopped(),	which
       is provided by Reflex::Role::Collectible.  Calling stopped() is vital
       for collectible objects to be released from memory when managed by
       Reflex::Collection.

EXAMPLES
       TODO - I'm sure there are some.

SEE ALSO
       Please see those	modules/websites for more information related to this
       module.

       o   Reflex

       o   Reflex

       o   Reflex::Role::Accepting

       o   Reflex::Acceptor

       o   Reflex::Connector

       o   "ACKNOWLEDGEMENTS" in Reflex

       o   "ASSISTANCE"	in Reflex

       o   "AUTHORS" in	Reflex

       o   "BUGS" in Reflex

       o   "BUGS" in Reflex

       o   "CONTRIBUTORS" in Reflex

       o   "COPYRIGHT" in Reflex

       o   "LICENSE" in	Reflex

       o   "TODO" in Reflex

BUGS AND LIMITATIONS
       You can make new	bug reports, and view existing ones, through the web
       interface at <http://rt.cpan.org/Public/Dist/Display.html?Name=Reflex>.

AUTHOR
       Rocco Caputo <rcaputo@cpan.org>

COPYRIGHT AND LICENSE
       This software is	copyright (c) 2017 by Rocco Caputo.

       This is free software; you can redistribute it and/or modify it under
       the same	terms as the Perl 5 programming	language system	itself.

AVAILABILITY
       The latest version of this module is available from the Comprehensive
       Perl Archive Network (CPAN). Visit <http://www.perl.com/CPAN/> to find
       a CPAN site near	you, or	see <https://metacpan.org/module/Reflex/>.

DISCLAIMER OF WARRANTY
       BECAUSE THIS SOFTWARE IS	LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
       FOR THE SOFTWARE, TO THE	EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT
       WHEN OTHERWISE STATED IN	WRITING	THE COPYRIGHT HOLDERS AND/OR OTHER
       PARTIES PROVIDE THE SOFTWARE "AS	IS" WITHOUT WARRANTY OF	ANY KIND,
       EITHER EXPRESSED	OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
       WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
       ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF	THE SOFTWARE IS	WITH
       YOU. SHOULD THE SOFTWARE	PROVE DEFECTIVE, YOU ASSUME THE	COST OF	ALL
       NECESSARY SERVICING, REPAIR, OR CORRECTION.

       IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR	AGREED TO IN WRITING
       WILL ANY	COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
       REDISTRIBUTE THE	SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE
       TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR
       CONSEQUENTIAL DAMAGES ARISING OUT OF THE	USE OR INABILITY TO USE	THE
       SOFTWARE	(INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
       RENDERED	INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
       FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
       SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
       DAMAGES.

perl v5.32.0			  2017-04-02	   Reflex::Role::Connecting(3)

NAME | VERSION | SYNOPSIS | DESCRIPTION | EXAMPLES | SEE ALSO | BUGS AND LIMITATIONS | AUTHOR | COPYRIGHT AND LICENSE | AVAILABILITY | DISCLAIMER OF WARRANTY

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=Reflex::Role::Connecting&sektion=3&manpath=FreeBSD+12.1-RELEASE+and+Ports>

home | help