in reply to forks.pm finally supports : shared attribute, correctly?
- in addition to what you're doing - just to be safe. But this assumes that other people are playing by the rules, too. Exporting is messy business. I'm not an attributes.pm expert.$self->SUPER::HANDLE_foo_ATTRIBUTES()
When people "use typesafety", their module is coerced into inherting from it as well, making my MODIFY_foo_ATTRIBUTES visible from their package without exporting it at all. However, something like you're doing would mask it and things would break. Other people with other modules that add attributes to other peoples code might be doing what you're looking for - exporting MODIFY_foo_ATTRIBUTES directly into the using module.push @{$caller.'::ISA'}, 'typesafety';
For any given targ ($opcode->targ(), the "target", or index of a lexical variable in the current padlist - in other words, a "my" variable), you can see which package it was declared as being in using the new "my" syntax:my $name = (($curcv->PADLIST->ARRAY)[0]->ARRAY)[$targ]; return unless $name->can('SvSTASH'); my $type = $name->SvSTASH->NAME;
Given the targ index of "$bar" in the current pad, we can find out that "$bar" is supposed to be a FooBar!my FooBar $bar;
|
|---|