The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

App::SocialSKK::Plugin - Baseclass of Social SKK Plugins

SYNOPSIS

  package App::SocialSKK::Plugin::YourPlugin;
  use strict;
  use warnings;
  use base qw(App::SocialSKK::Plugin);

  sub get_candidates {
      my ($self, $text) = @_;
      my $res = $self->ua->get('http://example.com/');
      if ($res->is_success) {
          my @candidates;

          # Do some formatting against $res->content and push results
          # into @candidates

          return @candidates;
      }
  }

  1;

  # Then, add a line like below into your .socialskk:
  plugins:
    - name: YourPlugin
      config:
        foo: bar
        baz: qux

DESCRIPTION

App::SocialSKK::Plugin is a baseclass of Social SKK plugins. It offers get_candidates() interface and built-in useragent object to retrieve some data from the Web.

METHODS

nwe ( \%config )

      my $plugin = App::SocialSKK::Plugin::YourPlugin->new(\%config);

    Creates and returns new object of the plugin.

get_candidates ( $text )

      my @candidates = $plugin->get_candidates($text);

    Takes a EUC-JP string as an input and processes and returns candidates for the string.

    This method must be overridden by subclass.

ua ()

      # In your plugin:
      my $res = $self->ua->get('http://example.com/');

    Returns LWP::UserAgent::POE object for non-blocking network retrieval. You can use it to do with the data on the Web.

SEE ALSO

  • LWP::UserAgent::POE

  • App::SocialSKK::Plugin::SocialIME

  • App::SocialSKK::Plugin::Wikipedia

  • App::SocialSKK::Plugin::HatenaBookmark

AUTHOR

Kentaro Kuribayashi <kentaro@cpan.org>