<p>What if main doesn't use Attr?</p>
<div class="gmail_quote">On 21 Jun 2011 22:25, "Aaron Crane" <<a href="mailto:perl@aaroncrane.co.uk">perl@aaroncrane.co.uk</a>> wrote:<br type="attribution">> Robert Rothenberg <<a href="mailto:robrwo@gmail.com">robrwo@gmail.com</a>> wrote:<br>
>> I am having a strange problem with Attribute::Handlers that looks like<br>>> some kind of bug:<br>>> when it's called from a separate package in a separate file, "foo"<br>>> is not called, although the compiler does accept the ":foo" attribute.<br>
> <br>> It seems to be working for me, unless I'm misunderstanding the problem:<br>> <br>> $ head *<br>> ==> Attr.pm <==<br>> package Attr;<br>> use Attribute::Handlers;<br>> sub UNIVERSAL::foo :ATTR(CODE) {<br>
>     warn "applying foo attribute to ", *{ $_[1] }, "\n";<br>> }<br>> 1;<br>> <br>> ==> Thing.pm <==<br>> package Thing;<br>> sub wobble :foo {}<br>> 1;<br>> <br>> ==> <a href="http://main.pl">main.pl</a> <==<br>
> use Attr;<br>> use Thing;<br>> sub wibble :foo {}<br>> $ perl <a href="http://main.pl">main.pl</a><br>> applying foo attribute to *Thing::wobble<br>> applying foo attribute to *main::wibble<br>> $ perl -MAttribute::Handlers -wE 'say for $^V, Attribute::Handlers->VERSION'<br>
> v5.12.1<br>> 0.88<br>> <br>> -- <br>> Aaron Crane ** <a href="http://aaroncrane.co.uk/">http://aaroncrane.co.uk/</a><br></div>