File: Exporter7.pm

package info (click to toggle)
libbadger-perl 0.16-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,400 kB
  • sloc: perl: 11,004; makefile: 9
file content (24 lines) | stat: -rw-r--r-- 563 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# test the export_hooks method
package My::Exporter7;
use base 'Badger::Exporter';

__PACKAGE__->export_hooks( foo => \&foo_hook, bar => \&bar_hook );

our $BUFFER = '';
our $DEBUG  = 0 unless defined $DEBUG;

sub foo_hook {
    my ($class, $target, $symbol, $rest) = @_;
    my $value = shift(@$rest);
    print STDERR "running foo_hook [$symbol:$value]\n" if $DEBUG;
    $BUFFER .= "[$symbol:$value]";
}

sub bar_hook {
    my ($class, $target, $symbol, $rest) = @_;
    print STDERR "running bar_hook [$symbol]\n" if $DEBUG;
    $BUFFER .= "[$symbol]";
}


1;