|
Revision 12
(checked in by yohei, 2 years ago)
|
Add a missing module description to module document.
|
| Line | |
|---|
| 1 |
package Plagger::Plugin::Subscription::BrowserHistory; |
|---|
| 2 |
use strict; |
|---|
| 3 |
use base qw( Plagger::Plugin ); |
|---|
| 4 |
|
|---|
| 5 |
sub init { |
|---|
| 6 |
my $self = shift; |
|---|
| 7 |
$self->SUPER::init(@_); |
|---|
| 8 |
|
|---|
| 9 |
my $browser =$self->conf->{browser} || $self->auto_configure; |
|---|
| 10 |
my $class = __PACKAGE__ . "::$browser"; |
|---|
| 11 |
$class->require or Plagger->context->error("Error loading $class: $@"); |
|---|
| 12 |
|
|---|
| 13 |
bless $self, $class; |
|---|
| 14 |
} |
|---|
| 15 |
|
|---|
| 16 |
sub auto_configure { |
|---|
| 17 |
my $self = shift; |
|---|
| 18 |
|
|---|
| 19 |
my $path = $self->conf->{path}; |
|---|
| 20 |
if ($path) { |
|---|
| 21 |
|
|---|
| 22 |
if ($path =~ /history\.dat$/) { |
|---|
| 23 |
Plagger->context->log(debug => "$path is a Mozilla history"); |
|---|
| 24 |
return 'Mozilla'; |
|---|
| 25 |
} |
|---|
| 26 |
} |
|---|
| 27 |
} |
|---|
| 28 |
|
|---|
| 29 |
sub register { |
|---|
| 30 |
my($self, $context) = @_; |
|---|
| 31 |
$context->register_hook( |
|---|
| 32 |
$self, |
|---|
| 33 |
'subscription.load' => $self->can('load'), |
|---|
| 34 |
); |
|---|
| 35 |
} |
|---|
| 36 |
|
|---|
| 37 |
sub load { die 'Override load' } |
|---|
| 38 |
|
|---|
| 39 |
1; |
|---|
| 40 |
__END__ |
|---|
| 41 |
|
|---|
| 42 |
=head1 NAME |
|---|
| 43 |
|
|---|
| 44 |
Plagger::Plugin::Subscription::BrowserHistory - Subscription to URLs in Browser History |
|---|
| 45 |
|
|---|
| 46 |
=head1 SYNOPSIS |
|---|
| 47 |
|
|---|
| 48 |
- module: Subscription::BrowserHistory |
|---|
| 49 |
config: |
|---|
| 50 |
browser: Mozilla |
|---|
| 51 |
path: /path/to/history.dat |
|---|
| 52 |
|
|---|
| 53 |
=head1 DESCRIPTION |
|---|
| 54 |
|
|---|
| 55 |
This plugin allows you to subscribe to your browser history. |
|---|
| 56 |
|
|---|
| 57 |
=head1 CONFIG |
|---|
| 58 |
|
|---|
| 59 |
=over 4 |
|---|
| 60 |
|
|---|
| 61 |
=item browser |
|---|
| 62 |
|
|---|
| 63 |
Specify your broser name. |
|---|
| 64 |
|
|---|
| 65 |
=item path |
|---|
| 66 |
|
|---|
| 67 |
Specify path to your browser history file. |
|---|
| 68 |
|
|---|
| 69 |
=back |
|---|
| 70 |
|
|---|
| 71 |
=head1 AUTHOR |
|---|
| 72 |
|
|---|
| 73 |
Yohei Fushii |
|---|
| 74 |
|
|---|
| 75 |
=head1 SEE ALSO |
|---|
| 76 |
|
|---|
| 77 |
L<Plagger>, L<File::Mork> |
|---|
| 78 |
|
|---|
| 79 |
=cut |
|---|