Test::ttserver - ttserver runner for tests
use Test::More; use Test::ttserver; use TokyoTyrant; my $ttserver = Test::ttserver->new or plan 'skip_all' => $Test::ttserver::errstr; plan 'tests' => XXX; my $rdb = TokyoTyrant::RDB->new; $rdb->open( $ttserver->socket ); ...
Test::ttserver automatically setups a ttserver instance in a temporary directory, and destroys it when the perl script exits.
Test::ttserver
ttserver is the managing server of the database instance of the Tokyo Tyrant that is a network interface of the Tokyo Cabinet.
# on memory database my $ttserver = Test::ttserver->new(undef, debug => 1, port => 101978, ); Ex.) Dual Master # ttserver -port 1978 -ulog ulog-a -sid 1 -mhost localhost \ # -mport 1979 -rts a.rts casket-a.tch my $ttserver_a = Test::ttserver->new('casket-a.tch', port => 1978, ulog => 'ulog-a', sid => 1, mhost => 'localhost', mport => 1979, rts => 'a.rts', ) or plan 'skip_all' => $Test::ttserver::errstr; # ttserver -port 1979 -ulog ulog-b -sid 2 -mhost localhost \ # -mport 1978 -rts b.rts casket-b.tch my $ttserver_b = Test::ttserver->new('casket-b.tch', port => 1979, ulog => 'ulog-b', sid => 2, mhost => 'localhost', mport => 1978, rts => 'b.rts', ) or plan 'skip_all' => $Test::ttserver::errstr;
Create and run a ttserver instance. The instance is terminated when the returned object is being DESTROYed. If required programs (ttserver) were not found, the function returns undef and sets appropriate message to $Test::ttserver::errstr.
ttserver ups as "on memory database" if $dbname is specified undef.
$dbname must be named *.tch or *.tcb or *.tcf. See also the manual of Tokyo Tyrant and Tokyo Cabinet for details.
Returns directory under which the ttserver instance is being created. The property can be set as a parameter of the new function, in which case the directory will not be removed at exit.
new
Returns process id of ttserver (or undef if not running).
returns the host and port where server is bound on.
Starts ttserver. returns process id of ttserver if succeed.
Stops ttserver. returns true if succeed.
Setups the ttserver instance.
returns port where server is bound on.
returns the value of boolean that server is up or down.
returns the file path of process id of ttserver.
returns the argument values when ttserver was started.
TokyoTyrant, TokyoCabinet
Craftworks, <craftwork at cpan org>
<craftwork at cpan org>
Please report any bugs or feature requests to bug-test-ttserver@rt.cpan.org, or through the web interface at http://rt.cpan.org. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-test-ttserver@rt.cpan.org
Copyright (C) 2009 Craftworks, All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See http://www.perl.com/perl/misc/Artistic.html
To install Test::ttserver, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::ttserver
CPAN shell
perl -MCPAN -e shell install Test::ttserver
For more information on module installation, please visit the detailed CPAN module installation guide.