From what I understand inside-out classes structure "require one hash per declared attribute" (Perl Best Practices). I cannot see any obstacle and drawback if these hash structures are replaced with single hash reference.
Currently (Damian Conway):
package SomeClass; use Class::Std::Utils; { my %name_of; sub new { my ($class, $name) = @_; my $new_object = bless \do{my $anon_scalar}, $class; $name_of{ident $new_object} = $name; return $new_object; } sub get_name { my ($self) = @_; return $name_of{ident $self}; } }

My point of view:
package SomeClass; { # All I need: my $data; sub new { my ($class, $name) = @_; my $scalref; my $new = bless \$scalref, $class; my $addr = norm($new); $data->{$addr} = { name => $name, obj => $new, }; $new } sub get { my $self = shift; my $arg = shift; $self = norm($self); $data->{$self}{$arg}; } sub set { my $self = shift; my ($key, $val) = @_; $self = norm($self); $data->{$self}{$key} = $val; } sub norm { my $address = ($_[0] =~ /\(?x(\w+)/)[0] } }
And the usage:
#!/usr/bin/perl use strict; use SomeClass; my$_1 = SomeClass->new('ok, creation of obj 1'); my$_2 = SomeClass->new('ok, creation of obj 2'); print $_1->get('name'), $/; print $_2->get('name'), $/; $_1->set('name', 'object _1 new attr value'); $_2->set('name', 'object _2 new attr value'); print $_1->get('name'), $/; print $_2->get('name'), $/; print $_2->{'name'}, $/;



In reply to Inside-out classes structure by sh1tn

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.