NAME
Apache::ClickPath::Decode - Decode Apache::ClickPath session IDs
SYNOPSIS
use Apache::ClickPath::Decode;
my $decoder=Apache::ClickPath::Decode->new;
$decoder->tag='-';
my $time=$decoder
->parse( 'http://bla.com/-PtVOR9:dxAredNNqtcus9NNNOdM/' )
->creation_time;
DESCRIPTION
Apache::ClickPath::Decode provides an OO interface for decoding Apache::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,tagandserver_mapattributes if they are not overridden be parameters.new()accepts named parameters asNAME => VALUEpairs. 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
tagattribute 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 thesessionmember function returns the found session without surrounding characters.After
parsethe session information can be fetched bycreation_timeserver_pid,seq_number,connection_id,remote_session,remote_session_hostandserver_idmember functions.If the
friendly_sessionattribute is given and the session contains a friendly session then theremote_sessionandremote_session_hostmember functions will return the remote session.If the
server_mapattribute is set theserver_idmember function will return the machine's name according to theApache::ClickPaths'sClickPathMachinedirective. 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 toserver_id. If not defined it indicates that theClickPathMachinedirective was not given in yourhttpd.confand the server-id is to be interpreted as IP address.parsereturns the object itself on success orundef.
Member Functions
- tag
-
this member function matches
Apache::ClickPath'sClickPathSessionPrefixdirective. 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 toparse()is tried as session identifier. - friendly_session
-
this matches
Apache::ClickPath'sClickPathFriendlySessionscontainer directive. It can be set to a string consiting of lines each describing a friendly session as the directive in yourhttpd.confdoes. - 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 ofApache::ClickPathI plan to provide directives to give a table of (IP adress, machine name) pairs in thehttpd.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 seeparse()above and Apache::ClickPath(3).creation_timereturns the sessions creation time in seconds since 1/1/1970 00:00 GMT,server_pidthe WEB server's process id,seq_numbera 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_idcontains the Apache's connection ID. Refer to Apache's source code an docs for more information.
SEE ALSO
Apache::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.