- 论坛徽章:
- 0
|
谢谢两位!
-------------------------------------------------------------
Here is an interesting idea that doesn't involve the Debug filter. Currently Perl subroutines have fairly limited support for formal parameter lists. You can specify the number of parameters and their type, but you still have to manually take them out of the @_ array yourself. Write a source filter that allows you to have a named parameter list. Such a filter would turn this:
sub MySub ($first, $second, @rest) { ... }into this:
sub MySub($$@) {
my ($first) = shift;
my ($second) = shift;
my (@rest) = @_;
...
}Finally, if you feel like a real challenge, have a go at writing a full-blown Perl macro preprocessor as a source filter. Borrow the useful features from the C preprocessor and any other macro processors you know. The tricky bit will be choosing how much knowledge of Perl's syntax you want your filter to have.
------------------------------------------------
就是说,perl总是用@_来中转参数,且不会自动放入子函数的参数中,需要手工处理,对不?
比较古怪。 |
|