DDC::Filter - DDC Query utilities: server filters (wrapper sockets)
##======================================================================== ## PRELIMINARIES use DDC::Client; use DDC::Filter; ##======================================================================== ## Constructors etc $filter = $CLASS_OR_OBJ->new(%args); ##-- new filter object ##======================================================================== ## Logging $fh = $filter->logfh(); ##-- get log filehandle $filter = $filter->logclose(); ##-- close log filehandle undef = logmsg($level,@message); ##-- log a message ##======================================================================== ## Server Methods: run undef = $filter->run(); ##-- run the wrapper daemon ##======================================================================== ## Server Methods: callback \&callback_sub = $filter->_callback($netserver_generic); ##-- top-level callback ##======================================================================== ## Server Methods: filters $filtered_data = $filter->filterInput($data_from_client); ##-- input filtering callback $filtered_data = $filter->filterOutput($data_from_server); ##-- output filtering callback ##======================================================================== ## Inherited Methods # ... any DDC::Client method ...
DDC::Filter inherits from DDC::Client.
Hash mapping symbolic log levels to numeric values, exportable.
$filter = $CLASS_OR_OBJ->new(%args);
( connect=>\%connectArgs, ##-- passed to IO::Socket::INET->new(), ##-- client args bind =>\%bindArgs, ##-- args to NetServer::Generic->new() logfile => $filename, ##-- for logging (defualt=&STDERR) loglevel => $level, ##-- log level )
( server=>$server, ##-- a NetServer::Generic object for listening )
PeerAddr=>'localhost', PeerPort=>50000, Proto=>'tcp', Type=>SOCK_STREAM, Blocking=>1,
(for connecting to the underlying DDC server).
#hostname=>'localhost', port=>$60000, mode=>"forking", allowed=>['127.0.0.1'], listen=>128, timeout=>60,
(for accepting incoming client connections).
$fh = $filter->logfh();
Get logging filehandle.
$filter = $filter->logclose();
Close log filehandle.
undef = logmsg($level,@message);
Potentially log a message at $level.
undef = $filter->run();
Run the server, accepting incoming connections and calling callback(s) for each incoming query.
\&callback_sub = $filter->_callback($netserver_generic);
Generic NetServer::Generic callback, called for each client. The default implmentation calls the filterInput() and filterOutput() methods, which should be sufficient for many applications.
$filtered_data = $filter->filterInput($data_from_client);
This method may be overridden in derived classes to perform filtering of data to be passed to the real DDC server.
The default implementation just returns $data_from_client unchanged.
$filtered_data = $filter->filterOutput($data_from_server);
This method may be overridden in derived classes to perform filtering of data to be passed back to the querying client.
The default implementation just returns $data_from_server unchanged.
Bryan Jurish <moocow@cpan.org>
Copyright (C) 2006-2016 by Bryan Jurish
This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.14.2 or, at your option, any later version of Perl 5 you may have available.
To install DDC::Concordance, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DDC::Concordance
CPAN shell
perl -MCPAN -e shell install DDC::Concordance
For more information on module installation, please visit the detailed CPAN module installation guide.