Artur,
I am using your Attribute::Handlers module, but I needed to make
a modification to it to enable better diagnostics. Basically, I have
the [meta-]handler store the filename and line number of the attribute
invocation, and then the handler is passed these as parameters. So, my
handlers now have a call spec of:
sub Args : ATTR(CODE) {
my($package, $symbol, $referent, $attr, $data,
$phase, $filename, $linenum) = @_;
}
That way, if there is an error in attribute processing (for
example, if the 'Args' attribute is applied twice to the same function),
then my error messages can print the filename and line number.
If you'd like, I'll share the code modifications with you. They
are trivial and took about 5 minutes to work into your code.
Sincerely,
David P. Feldman
I would welcome such a patch, it looks useful.
Thanks.
I had a quick look at your patch, and I have two small remarks :
1. for attributes on scalars (my $foo :Bar), $filename and $linenum
aren't set. Is it possible to handle this case too ? (if not, I'll
apply this patch anyway, only documenting that it works only for
subroutine attributes)
2. You didn't update the docs for the module.
2. No, I didn't update the docs because you might not have been
interested in the patch. Also, since we don't know what's up with #1
above, we should delay on the docs until we're sure my patch actually
works properly.
Maybe you can send me the test program you wrote along with environment
info. like Perl version. We're using Perl 5.6.1 here since it's the
version that's shipping with Solaris 9 and matches our version of
ActiveState on Windows.
=-Dave-F->
Actually I was testing with 5.9.4 + a bunch of patches, the current
development version of perl. And perl has evolved since then... I'll
have a look anyway.
Thanks, I've now applied your patch to the development version of
perl, with docs, tests, including two TODO tests for the feature that
doesn't work (yet) : reporting line and filename for scalar
attributes.