|
Revision 84
(checked in by miyagawa, 3 years ago)
|
Unified SmartFeed? and Rule API by ad-hoc hook addition. Fixes #28 and #31.
|
- Property svn:keywords set to
Id Revision
|
| Line | |
|---|
| 1 |
package Plagger::Rule; |
|---|
| 2 |
use strict; |
|---|
| 3 |
use UNIVERSAL::require; |
|---|
| 4 |
|
|---|
| 5 |
sub new { |
|---|
| 6 |
my($class, $config) = @_; |
|---|
| 7 |
|
|---|
| 8 |
if (my $exp = $config->{expression}) { |
|---|
| 9 |
$config->{module} = 'Expression'; |
|---|
| 10 |
} |
|---|
| 11 |
|
|---|
| 12 |
my $module = delete $config->{module}; |
|---|
| 13 |
$module = "Plagger::Rule::$module"; |
|---|
| 14 |
$module->require or die $@; |
|---|
| 15 |
|
|---|
| 16 |
my $self = bless {%$config}, $module; |
|---|
| 17 |
$self->init(); |
|---|
| 18 |
$self; |
|---|
| 19 |
} |
|---|
| 20 |
|
|---|
| 21 |
sub init { } |
|---|
| 22 |
|
|---|
| 23 |
sub id { |
|---|
| 24 |
my $self = shift; |
|---|
| 25 |
"xxx"; |
|---|
| 26 |
} |
|---|
| 27 |
|
|---|
| 28 |
sub as_title { |
|---|
| 29 |
my $self = shift; |
|---|
| 30 |
"xxx"; |
|---|
| 31 |
} |
|---|
| 32 |
|
|---|
| 33 |
1; |
|---|