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