Attributes are cool whenever out-of-band data is required. Some examples :
- I have a toy application here, where I use attributes to specify access levels for subroutines.
- If your application consists of a chain of list-munging subroutines, you can easily add tracking information as which routine touched which item without having to change/adapt every routine and without conflict with the output.
- The always present compiler hints or runtime type enforcement can also be implemented via attributes (like the :Integer attribute), but of course, this is also out-of-bound information about your "data" (this time, your program is regarded as data by perl)
perl -MHTTP::Daemon -MHTTP::Response -MLWP::Simple -e ' ; # The
$d = new HTTP::Daemon and fork and getprint $d->url and exit;#spider
($c = $d->accept())->get_request(); $c->send_response( new #in the
HTTP::Response(200,$_,$_,qq(Just another Perl hacker\n))); ' # web