NAME

Apache2::ClickPath::Decode - Decode Apache2::ClickPath session IDs

SYNOPSIS

use Apache2::ClickPath::Decode;
my $decoder=Apache2::ClickPath::Decode->new;
$decoder->tag='-';
my $time=$decoder
            ->parse( 'http://bla.com/-PtVOR9:dxAredNNqtcus9NNNOdM/' )
            ->creation_time;

DESCRIPTION

Apache2::ClickPath::Decode provides an OO interface for decoding Apache2::ClickPath session identifiers.

Methods

This module uses Class::Member(3) to implement member functions. Thus, all member functions are lvalues, eg $decoder->tag='-'.

new

The constructor. If called as instance method it creates a new instance that inherits the friendly_session, tag and server_map attributes if they are not overridden be parameters.

new() accepts named parameters as NAME => VALUE pairs. The following parameters are recognized:

friendly_session
tag
server_map

for these 3 see the appropriate member functions below.

session

if a session is given, parse() is called immediately. So, the result is directly accessible.

parse

parse() is called with an optional parameter containing the actual session identifier. If ommitted the internally stored session identifier is used.

If the object's tag attribute is set the session can actually contain an URL or an arbitrary string containing a session identifier that is preceded with the tag and ended with a slash (/). After parsing the session member function returns the found session without surrounding characters.

After parse the session information can be fetched by creation_time server_pid, seq_number, connection_id, remote_session, remote_session_host and server_id member functions.

If the friendly_session attribute is given and the session contains a friendly session then the remote_session and remote_session_host member functions will return the remote session.

If the server_map attribute is set the server_id member function will return the machine's name according to the Apache2::ClickPaths's ClickPathMachine directive. Currently this attribute must be assigned an emtpy string or left undefined. Otherwize a warning is issued. If defined the sessions server-id part is directly assigned to server_id. If not defined it indicates that the ClickPathMachine directive was not given in your httpd.conf and the server-id is to be interpreted as IP address.

parse returns the object itself on success or undef.

Member Functions

tag

this member function matches Apache2::ClickPath's ClickPathSessionPrefix directive. If given the module can identify session identifiers in URLs. So, parse() can be called directly with an URL. If not given the whole string passed to parse() is tried as session identifier.

friendly_session

this matches Apache2::ClickPath's ClickPathFriendlySessions container directive. It can be set to a string consiting of lines each describing a friendly session as the directive in your httpd.conf does.

server_map

if left undefined parse() will interpret the server-id part of a session identifier as IP address. If set to an empty string it will not. In a future version of Apache2::ClickPath I plan to provide directives to give a table of (IP adress, machine name) pairs in the httpd.conf. Then all machines of a cluster can run with the same configuration files. Then the decoder will also be extented to map these names back and this attribute will be allowed to be assigned a non-empty string, too.

session

is initialized with a session identifier or an URL. After parse() is called it contains the session identifier.

remote_session
remote_session_host
server_id
creation_time
server_pid
seq_number
connection_id

These members are initialized be parse() to hold the components of the parsed session. For the first 3 see parse() above and Apache2::ClickPath(3). creation_time returns the sessions creation time in seconds since 1/1/1970 00:00 GMT, server_pid the WEB server's process id, seq_number a 16-bit number that is incremented for each new session a WEB server process creates. At process start up is is initialized with a random number. So it does not indicate how much sessions a server process has created. connection_id contains the Apache's connection ID. Refer to Apache's source code an docs for more information.

SEE ALSO

Apache2::ClickPath(3), http://httpd.apache.org

AUTHOR

Torsten Foertsch, <torsten.foertsch@gmx.net>

COPYRIGHT AND LICENSE

Copyright (C) 2004 by Torsten Foertsch

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