Kentaro Kuribayashi > App-SocialSKK-0.02 > App::SocialSKK::Plugin

Download:
App-SocialSKK-0.02.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Source  

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 ^

AUTHOR ^

Kentaro Kuribayashi <kentaro@cpan.org>

syntax highlighting: