1 |
package MDAP; |
package MDAP; |
2 |
|
use Exporter 'import'; |
3 |
|
our @EXPORT = qw/ |
4 |
|
once |
5 |
|
dump |
6 |
|
/; |
7 |
|
|
8 |
use strict; |
use strict; |
9 |
use warnings; |
use warnings; |
14 |
my @plugins = __PACKAGE__->plugins; |
my @plugins = __PACKAGE__->plugins; |
15 |
warn "## found plugins: ",dump( @plugins ); |
warn "## found plugins: ",dump( @plugins ); |
16 |
|
|
17 |
|
=head1 NAME |
18 |
|
|
19 |
|
MDAP - common stuff |
20 |
|
|
21 |
|
=head1 FUNCTIONS |
22 |
|
|
23 |
|
=head2 once |
24 |
|
|
25 |
|
once("this message will be reported just once"); |
26 |
|
|
27 |
|
=cut |
28 |
|
|
29 |
|
our $once; |
30 |
|
|
31 |
|
sub once { |
32 |
|
my $m = join('', @_); |
33 |
|
$once->{$m}++; |
34 |
|
print "$m\n" if ($once->{$m} == 1); |
35 |
|
} |
36 |
|
|
37 |
|
sub DESTROY { |
38 |
|
warn "all messages: ",dump( $once ); |
39 |
|
} |
40 |
|
|
41 |
1; |
1; |