给定一个 Perl 包 Foo.pm,例如
package Foo;
use strict;
sub bar {
# some code here
}
sub baz {
# more code here
}
1;
如何编写脚本来提取每个子的文本源代码,从而产生哈希:
$VAR1 = {
'bar' => 'sub bar {
# some code here
}',
'baz' => 'sub baz {
# more code here
}'
};
我希望文本与包装、空格和所有内容中出现的完全相同。
谢谢。