You are using subroutine prototypes to convey a count. Since you are looking up the prototype you must be building the argument list dynamically which means you are also bypassing the prototype (or using eval which is probably worse). So it seems you are misusing the prototype.
Now you want to put an attribute on the subroutine just so you can check for it. I think these both sound like you are fixated on using a specific channel for conveying information and you should consider alternatives.
You could convey the number of arguments by how many letters in the subroutine name and use uppercase if you want a reference and lower case if not. (just to give you an exagerated idea of how your current plan sounds to me)
Another alternative would be to have the subroutine return the meta information when you call it with no arguments:
meaning it wants 4 arguments that are references.sub mysub { return -4 unless @_; my( $svA, $svB, $svC, $svD )= @_; ... }
Good luck with your attributes problem. I did a quick look in perlsub which pointed to the documentation for attributes.pm which mentions doing custom attributes, so perhaps you should just go read that.
- tyeIn reply to Re: custom attribute? (wrong channel)
by tye
in thread custom attribute?
by Flame
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |