package Class::Definition; use Attribute::Handlers; sub UNIVERSAL::DEFINITION : ATTR(CODE) { print "UNIVERSAL::DEFINITION: @_\n"; } 1;
I succesfully get this printed: UNIVERSAL::DEFINITION: main GLOB(0x283179c) CODE(0x225454) DEFINITION whatever CHECKuse Class::Definition; sub TEST : DEFINITION('whatever') {}
When it runs I get this error message:use warnings; use strict; use Class::Definition; sub CLASS : DEFINITION( ATTRIBUTES: PRIVATE: pvt_at1 pvt_at2 pvt_at3 PROTECTED: ptc_at1 ptc_at2 ptc_at3 PUBLIC: pub_at1 pub_at2 pub_at3 METHODS: PRIVATE: pvt_mt1 pvt_mt2 pvt_mt3 PROTECTED: ptc_mt1 ptc_mt2 ptc_mt3 PUBLIC: pub_mt1 pub_mt2 pub_mt3 );
Invalid CODE attribute: pub_mt1 ( ATTRIBUTES: PRIVATE: pvt_at1 pvt_at2 pvt_at3 PROTECTED: ptc_at1 ptc_at2 ptc_at3 PUBLIC: pub_at1 pub_at2 pub_at3 METHODS: PRIVATE: pvt_mt1 pvt_mt2 pvt_mt3 PROTECTED: ptc_mt1 ptc_mt2 ptc_mt3 PUBLIC: pub_mt1 pub_mt2 pub_mt3 ) at attrtest.pl line 6 BEGIN failed--compilation aborted at attrtest.pl line 18.
I get this as an error:use warnings; use strict; use Class::Definition; sub CLASS : DEFINITION( ATTRIBUTES: );
Invalid CODE attribute: INITION( ATTRIBUTES: ) at attrtest.pl line 6 BEGIN failed--compilation aborted at attrtest.pl line 9.
Edited by planetscape - added readmore tags
In reply to Abusing attributes (possible perl bug?) by acid06
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |