Hi
Is it possible in anyway to add a Perl attribute to a value instead of to a variable?
If I understand the docs correctly the following code associates an attribute with a variable given that the attribute MyAttr is available.
However I want to associate an attribute with a value and not with a variable. Something like this. Is this allowed in anyway?my $var :MyAttr;
my_func( 1, 'Hi there', { key => 'value } :MyAttr );
The above example could be solved by writing
my $var :MyAttr = { key => 'value' }; my_func( 1, 'Hi there', $var );
but that is not a satisfactory solutions in my case.
Also if an attribute cannot be associated with a value could anyone explain the reason behind this? I am wondering out of curiousity, it is not meant as a critisism to the attribute implementation in Perl.
Update: I no longer have use of actually doing this (see discussion below). I am however still curious if it is possible and if it is not, a possible explanation to why?
In reply to Adding attributes to values? by oyse
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |