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


App-SocialSKK documentation Contained in the App-SocialSKK distribution.

Index


Code Index:

NAME

Top

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

SYNOPSIS

Top

  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

Top

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

Top

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

Top

* LWP::UserAgent::POE
* App::SocialSKK::Plugin::SocialIME
* App::SocialSKK::Plugin::Wikipedia
* App::SocialSKK::Plugin::HatenaBookmark

AUTHOR

Top

Kentaro Kuribayashi <kentaro@cpan.org>


App-SocialSKK documentation Contained in the App-SocialSKK distribution.

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

__PACKAGE__->mk_accessors(qw(ua));

sub get_candidates {
    die 'This method must be overridden by subclass';
}

1;

__END__