Kenichi Ishigaki > Groonga-API-0.03 > Ploonga

Download:
Groonga-API-0.03.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Source  

NAME ^

Ploonga - (yet another) interface to Groonga

SYNOPSIS ^

  use Ploonga;

  # Standalone mode
  my $ploonga = Ploonga->new(
    dbfile => 'db/test.db',
    no_create => 0, # set this to true if necessary
  );

  # Client mode
  my $ploonga = Ploonga->new(
    host => 'localhost',
    port => 10041,
  );

  # You can pass whatever builtin Groonga client accepts.
  my $ret = $ploonga->do('table_create --name Site --flags TABLE_HASH_KEY --key_type ShortText');

  # Extra args, instead of passing via stdin
  my $ret = $ploonga->do('load --table Site', <<'JSON');
  [
  {"_key":"http://example.org/","title":"This is test record 1!"},
  {"_key":"http://example.net/","title":"test record 2."},
  {"_key":"http://example.com/","title":"test test record three."},
  {"_key":"http://example.net/afr","title":"test record four."},
  {"_key":"http://example.org/aba","title":"test test test record five."},
  {"_key":"http://example.com/rab","title":"test test test test record six."},
  {"_key":"http://example.net/atv","title":"test test test record seven."},
  {"_key":"http://example.org/gat","title":"test test record eight."},
  {"_key":"http://example.com/vdw","title":"test test record nine."},
  ]
  JSON

DESCRIPTION ^

Unless you really want to do some complex stuff, this is the module you want to use to communicate with a Groonga database/server. The interface is almost the same as the builtin Groonga client. You simply don't need to quote commands nor decode json output by yourself.

If you do need, try Groonga::API, which provides raw interface to Groonga C APIs.

METHODS ^

new

Creates a client object. Available options are: dbfile/no_create (for standalone mode), host/port (for client mode).

You can also set encoding option to decode/encode when you send/receive data.

do

Takes a string expression which must contain a Groonga command (and optional string arguments to send), and returns the result, which may be a scalar, or some complex data structure.

ctx, db

Accessors to internal objects. Only useful when you use Groonga::API.

SEE ALSO ^

Groonga::API

http://groonga.org/

https://github.com/yappo/p5-Groonga/

AUTHOR ^

Kenichi Ishigaki, <ishigaki@cpan.org>

COPYRIGHT AND LICENSE ^

Copyright (C) 2013 by Kenichi Ishigaki.

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

syntax highlighting: