Parent Directory | Revision Log
r89@brr: root | 2007-11-18 01:51:20 +0100 - move $debug into MDAP and export it - iterate plugins correctly
1 | package MDAP; |
2 | use Exporter 'import'; |
3 | our @EXPORT = qw/ |
4 | once |
5 | dump |
6 | $debug |
7 | /; |
8 | |
9 | use strict; |
10 | use warnings; |
11 | |
12 | use Data::Dump qw/dump/; |
13 | |
14 | use Module::Pluggable search_path => 'MDAP', sub_name => 'plugins', require => 1; |
15 | my @plugins = __PACKAGE__->plugins; |
16 | warn "## found plugins: ",dump( @plugins ); |
17 | |
18 | our $debug = 0; |
19 | |
20 | =head1 NAME |
21 | |
22 | MDAP - common stuff |
23 | |
24 | =head1 FUNCTIONS |
25 | |
26 | =head2 once |
27 | |
28 | once("this message will be reported just once"); |
29 | |
30 | =cut |
31 | |
32 | our $once; |
33 | |
34 | sub once { |
35 | my $m = join('', @_); |
36 | $once->{$m}++; |
37 | print "$m\n" if ($once->{$m} == 1); |
38 | } |
39 | |
40 | sub DESTROY { |
41 | warn "all messages: ",dump( $once ); |
42 | } |
43 | |
44 | 1; |
ViewVC Help | |
Powered by ViewVC 1.1.26 |