1 |
root |
1.1 |
## --------------------------------------------------------------------------- |
2 |
joko |
1.2 |
## $Id: Ref.pm,v 1.1 2003/01/22 17:59:22 root Exp $ |
3 |
root |
1.1 |
## --------------------------------------------------------------------------- |
4 |
joko |
1.2 |
## $Log: Ref.pm,v $ |
5 |
|
|
## Revision 1.1 2003/01/22 17:59:22 root |
6 |
|
|
## + refactored from Mail::Audit::Dispatch |
7 |
|
|
## |
8 |
root |
1.1 |
## --------------------------------------------------------------------------- |
9 |
|
|
|
10 |
|
|
|
11 |
|
|
package Data::Code::Ref; |
12 |
|
|
|
13 |
|
|
use strict; |
14 |
|
|
use warnings; |
15 |
|
|
|
16 |
|
|
require Exporter; |
17 |
|
|
our @ISA = qw( Exporter ); |
18 |
|
|
our @EXPORT_OK = qw( |
19 |
|
|
get_coderef |
20 |
|
|
); |
21 |
|
|
|
22 |
|
|
|
23 |
|
|
sub get_coderef { |
24 |
|
|
my $codepack = shift; |
25 |
|
|
my $method = shift; |
26 |
|
|
$codepack || return '[error]'; |
27 |
|
|
$method ||= ''; |
28 |
|
|
$method && ($codepack .= '::'); |
29 |
|
|
return eval '\&' . $codepack . $method . ';'; |
30 |
|
|
} |
31 |
|
|
|
32 |
|
|
1; |
33 |
joko |
1.2 |
__END__ |