root/trunk/plagger/lib/Plagger/Plugin/Notify/OpenBrowser.pm

Revision 1728 (checked in by miyagawa, 14 years ago)

Notify::OpenBrowser? (via http://blog.nomadscafe.jp/archives/000627.html) and MozRepl? extension

Line 
1 package Plagger::Plugin::Notify::OpenBrowser;
2 use strict;
3 use base qw( Plagger::Plugin );
4
5 sub init {
6     my $self = shift;
7     $self->SUPER::init(@_);
8
9     my $class  = 'Plagger::Plugin::Notify::OpenBrowser::' . lc($^O);
10     eval "require $class;";
11     if ($@) {
12         Plagger->context->error("Browser plugin doesn't run on your platform $^O");
13     }
14     bless $self, $class;
15 }
16
17 sub register {
18     my($self, $context) = @_;
19
20     $context->register_hook(
21         $self,
22         'publish.entry' => \&entry,
23     );
24 }
25
26 sub entry {
27     my($self, $context, $args) = @_;
28     $self->open($args->{entry}->permalink);
29 }
30
31 1;
32 __END__
33
34 =head1 NAME
35
36 Plagger::Plugin::Notify::OpenBrowser - Open updated entries in a browser
37
38 =head1 SYNOPSIS
39
40   - module: Notify::OpenBrowser
41
42 =head1 DESCRIPTION
43
44 This plugins opens updated entries in a browser of your choice. This
45 module will automatically use system default browser, except your OS
46 is Unix which uses Firefox explicitly.
47
48 =head1 EXAMPLES
49
50 Following configuration will get new items from your del.icio.us
51 network, deduplicate them and open them in a browser.
52
53   - module: Subscription::Config
54     config:
55       feed:
56         - http://del.icio.us/rss/network/{username}?private={private}
57
58   - module: Filter::Rule
59     rule:
60       module: Deduped
61
62   - module: Notify::OpenBrowser
63
64 =head1 AUTHOR
65
66 Masahiro Nagano
67
68 Tatsuhiko Miyagawa
69
70 =head1 SEE ALSO
71
72 L<Plagger>
73
74 =cut
Note: See TracBrowser for help on using the browser.