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::Ref; |
9 |
|
|
|
10 |
|
|
use strict; |
11 |
|
|
use warnings; |
12 |
|
|
|
13 |
|
|
require Exporter; |
14 |
|
|
our @ISA = qw( Exporter ); |
15 |
|
|
our @EXPORT_OK = qw( |
16 |
|
|
get_coderef |
17 |
|
|
); |
18 |
|
|
|
19 |
|
|
|
20 |
|
|
sub get_coderef { |
21 |
|
|
my $codepack = shift; |
22 |
|
|
my $method = shift; |
23 |
|
|
$codepack || return '[error]'; |
24 |
|
|
$method ||= ''; |
25 |
|
|
$method && ($codepack .= '::'); |
26 |
|
|
return eval '\&' . $codepack . $method . ';'; |
27 |
|
|
} |
28 |
|
|
|
29 |
|
|
1; |