1 |
## --------------------------------------------------------------------------- |
2 |
## $Id: Symbol.pm,v 1.1 2003/01/22 17:59:22 root Exp $ |
3 |
## --------------------------------------------------------------------------- |
4 |
## $Log: Symbol.pm,v $ |
5 |
## Revision 1.1 2003/01/22 17:59:22 root |
6 |
## + refactored from Mail::Audit::Dispatch |
7 |
## |
8 |
## --------------------------------------------------------------------------- |
9 |
|
10 |
|
11 |
package Data::Mungle::Code::Symbol; |
12 |
|
13 |
use strict; |
14 |
use warnings; |
15 |
|
16 |
require Exporter; |
17 |
our @ISA = qw( Exporter ); |
18 |
our @EXPORT_OK = qw( |
19 |
export_symbols |
20 |
); |
21 |
|
22 |
|
23 |
use Data::Mungle::Code::Ref qw( get_coderef ); |
24 |
|
25 |
sub export_symbols { |
26 |
my $symbols = shift; |
27 |
my $mixinPackage = shift; |
28 |
my $callPackage = shift; |
29 |
$callPackage ||= __PACKAGE__; |
30 |
foreach (@$symbols) { |
31 |
{ |
32 |
no strict 'refs'; |
33 |
my $newName = $mixinPackage . '::' . $_; |
34 |
*{$newName} = get_coderef($callPackage, $_); |
35 |
} |
36 |
} |
37 |
} |
38 |
|
39 |
1; |