in reply to Re^5: Class::InsideOut - yet another riff on inside out objects.
in thread Class::InsideOut - yet another riff on inside out objects.

Darn. I hoped there was something obvious I was missing :-)

While scanning all coderefs & symbol table entries might work for a lot of cases, I don't think it is completely general. For example, consider:

{ package Foo; use base qw(Class::InsideOut); sub new { return bless [], shift }; { my %foo : Field }; };

There are no subroutines that have %foo in their scope so, without generating code with a source filter, I can see no way of getting access to the pad with "%foo" in it.

Replies are listed 'Best First'.
Re^7: Class::InsideOut - yet another riff on inside out objects.
by diotalevi (Canon) on Dec 19, 2002 at 13:15 UTC

      No. Foo::new is not in %foo's scope.

      It also doesn't reference %foo - which probably means it would be optimised out of the pad even if it was in scope (not 100% on the details of this sort of optimisation so I could be wrong about that).