AidanLee has asked for the wisdom of the Perl Monks concerning the following question:

I've got a set of modules that use objects to represent nodes on a graph, and uses simple references to represent the arcs between them. What I'm trying to do now is introduce a concept whereby I can declare an arc as 'active' or 'inactive' without severing the arc. Similar to how you can leave a lamp plugged into the wall socket, and the electricity is either on or off.

What I'm wondering is if there might be a good metaphor using simple perl syntax to represent this phenomenon without a secondary data structure to store this active/inactive information. I tried adding a level of indirection, such as:
#active: push @{$object->{related}}, $object2; #inactive @{$object->{related}}, \$object2;
but that got to be a nightmare in remembering to dereference it everywhere. So I'm now wondering if there's a way to tag the reference in such a way as to be able to test for it's 'activeness'. Scalar::Util's weaken() function would be a great metaphor for this (testing with the isweak() function) but I can't afford to have weaken's intended effect as a side effect.

Note that I don't want to annotate the targeted object. The object isn't 'active' or 'inactive'. It's the arc drawn between the two.

I'm willing to entertain black magic at this point even if it doesn't prove feasible down the line. I'm a stickler for useable, straightforward syntax, even if it means some vodoo underneath.

update: After some discussion in the chatterbox with Mr. Muskrat and atcroft it became obvious that I hadn't provided enough information: At the moment the best strategy seems to be to keep the active/inactive information in a parallel data structure inside the tied array. That way i can do something like
[% IF object.related.isActive( related_obj ) %]...[% END %]
but if anyone has any other interesting approaches to this I'd be glad to hear them. The simpler for the template authors, the better.