AnyEvent-Groonga
view release on metacpan or search on metacpan
Revision history for Perl extension AnyEvent::Groonga
0.08 2012/07/04
- patched some bugs and add 1 test ( it was given from SATOH.Koichi )
0.07 2011/11/18
- remove some debug code.
- add timeout option
0.06 2011/11/8
- fix a syntax error as 'filter' option was used.
0.05 2011/11/3
- fix a syntax error as 'filter' option was used.
- add a test
0.04 2011/3/3
lib/AnyEvent/Groonga.pm view on Meta::CPAN
use URI;
use URI::Escape;
use JSON;
use Try::Tiny;
use Encode;
use base qw(Class::Accessor::Fast);
our $VERSION = '0.08';
__PACKAGE__->mk_accessors($_)
for qw( protocol host port groonga_path database_path command_list debug);
sub new {
my $class = shift;
my $self = $class->SUPER::new(
{ protocol => 'gqtp',
host => 'localhost',
port => '10041',
groonga_path => which("groonga") || undef,
database_path => undef,
command_list => [
lib/AnyEvent/Groonga.pm view on Meta::CPAN
}
$value = $self->_select_filter($value);
}
elsif ( ref $value eq 'ARRAY' ) {
$value = join( ",", @$value );
}
$key = '--' . $key;
push @array, ( $key, $value );
}
$groonga_command .= join( " ", @array ) . '"';
warn($groonga_command) if $self->debug;
return $groonga_command;
}
sub _select_filter {
my $self = shift;
my $data = shift;
$data = decode( "utf8", $data ) unless utf8::is_utf8($data);
$data =~ /(^|[^\\])"|'/;
if ($1) {
$data =~ s/(^|[^\\])"|'/$1\\"/g;
use strict;
use warnings;
use lib '../lib';
use AnyEvent::Groonga;
use Test::More;
use FindBin;
use File::Spec;
_cleanup();
my $g = AnyEvent::Groonga->new( debug => 0 );
my $groonga_path = $g->groonga_path;
my $test_database_path
= File::Spec->catfile( $FindBin::RealBin, "data", "test.db" );
unless ( $groonga_path and -e $groonga_path ) {
plan skip_all => "groonga is not installed.";
}
else {
plan tests => 21;
}
t/05_regression.t view on Meta::CPAN
use warnings;
use utf8;
use lib '../lib';
use AnyEvent::Groonga;
use Test::More;
use FindBin;
use File::Spec;
unlink $_ for glob( File::Spec->catfile( $FindBin::RealBin, "data", "*") );
my $g = AnyEvent::Groonga->new( debug => 0 );
my $groonga_path = $g->groonga_path;
my $test_database_path
= File::Spec->catfile( $FindBin::RealBin, "data", "test.db" );
unless ( $groonga_path and -e $groonga_path ) {
plan skip_all => "groonga is not installed.";
}
else{
plan tests => 2;
}
( run in 1.393 second using v1.01-cache-2.11-cpan-49f99fa48dc )