App::SocialSKK::Plugin - Baseclass of Social SKK Plugins
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
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.
my $plugin = App::SocialSKK::Plugin::YourPlugin->new(\%config);
Creates and returns new object of the plugin.
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.
# 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.
LWP::UserAgent::POE
App::SocialSKK::Plugin::SocialIME
App::SocialSKK::Plugin::Wikipedia
App::SocialSKK::Plugin::HatenaBookmark
Kentaro Kuribayashi <kentaro@cpan.org>
To install App::SocialSKK, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::SocialSKK
CPAN shell
perl -MCPAN -e shell install App::SocialSKK
For more information on module installation, please visit the detailed CPAN module installation guide.