1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/perl -w
use strict;
my $filter = Filter->new();
$filter->fillFilter();
$filter->doFilter();
package Filter;
sub new {
my $self = shift();
my $param = shift();
my $data = {};
return(bless $data, $self);
}
sub fillFilter {
my $self = shift();
push @{$self->{'__POOL__'}}, \&{$self->func1};
push @{$self->{'__POOL__'}}, \&{$self->func2};
use Data::Dumper;
print Dumper($self);
}
sub doFilter {
my $self = shift();
foreach my $func (@{$self->{'__POOL__'}}) {
print &{$func}(), "\n";
}
}
sub func1 {
my $self = shift();
my $param = shift();
print "func1\n";
return(1);
}
sub func2 {
my $self = shift();
my $param = shift();
print "func2\n";
return(1);
}
my $coderef = $object->can('methodname');