NAME
POEx::URI - URI extension for POE event specfiers
SYNOPSIS
use URI;
my $uri = URI->new( "$session/$event" );
$poe_kernel->post( $uri->session, $uri->event, @args );
$poe_kernel->post( @$uri, @args );
$uri->host( $host );
$uri->port( 33100 );
$poe_kernel->post( IKC => $uri, @args );
DESCRIPTION
This module implements the URIs that reference POE session/event tuples. Objects of this class represent non-standard "Uniform Resource Identifier references" of the poe: scheme.
The canonical forms of POE URIs are:
poe:event
poe:session/
poe:session/event
poe://kernel/session/
poe://kernel/session/event
Event parameters (->query) are not currently supported.
URI fragements (the bits after #
) make no sense.
METHODS
event
my $name = $uri->event
$old = $uri->event( $name );
Sets and returns the event part of the $uri. If the $name
contains a forward-slash (/), it is escaped (%2F).
To clear the event name, use ''
or undef
, which are equivalent.
session
my $name = $uri->session
$old = $uri->session( $name );
Sets and returns the session part of the $uri. If the $name
contains a forward-slash (/), it is escaped (%2F).
To clear the event name, use ''
or undef
, which are equivalent
kernel
my $kernel = $uri->kernel;
$old = $uri->kernel( $name );
Sets and returns the kernel part of the $uri. A kernel may be host:port, host (IKC), path to unix socket (IKC) or a local or remote kernel ID or alias.
To clear the kernel name, use ''
or undef
, which are equivalent.
host
$host = $uri->host;
$old = $uri->host( $host );
Sets and returns the host part of the $uri's kernel. If the kernel wasn't host:port, then it is converted to that.
port
$port = $uri->port;
$old = $uri->port( $port );
Sets and retuns the port part of the $uri's kernel. If the kernel wasn't a host name, then it becomes one.
default_port
The default POE port is 603 which is POE upside-down and backwards. Almost.
user
$user = $uri->user;
$old = $uri->user( $user );
Sets and returns the username part of the $uri's "userinfo" in URI. If the user name contains :
, it is escaped.
password
$pw = $uri->password;
$old = $uri->password( $passwd );
Sets and returns the password part of the $uri's "userinfo" in URI. If the password contains :
, it is escaped.
The user name and password are seperated by :
. This is might be a security issue. Beware.
While this method is called password, it works just as well with pass phrases.
as_array
$poe_kernel->post( @$uri, @args );
$poe_kernel->post( $uri->as_array, @args );
Returns a URI object to a session/event tuple, suitable for posting or calling. POEx::URI objects are also converted to arrays automatically by overloading.
If a kernel name is present, and it is not the local kernel ID, then it is prepended to the session name. This is compatible with IKC after subscribing to the remote session.
canonical
my $full = $uri->canonical;
Returns a normalized version of the URI. For POE URIs, the hostname is folded to lower case.
path
$path = $uri->path;
$old = $uri->path( $new_path );
Sets and returns the session/event tupple of a $uri. If the new path contains more then one slash, the last segment of the path is the event, and the others are the session and those slash are escaped.
path_segments
( $session, $event ) = $uri->path_segments;
@old = $uri->path_segments( @new );
Sets and returns the path. In a scalar context, it returns the same value as $uri->path. In a list context, it returns the unescaped path segments that make up the path. See "path_segments" in URI for more details.
SEE ALSO
AUTHOR
Philip Gwyn, <gwyn -at- cpan.org>
COPYRIGHT AND LICENSE
Some of this code is based on URI
and related subclasses was developed by Gisle Aas.
Copyright (C) 2009 by Philip Gwyn
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.