Ruslan,

Ruslan U. Zakirov wrote:
 > I want next features:
1) Ordered container of any elements in its cells.

2) Support for many such containers in one object.
For example:
    One Object have next lists:
        Attribute
        Child
        Sibling

Can you give an example when it is useful for this module to store multiple containers (instead of a single container) in one object? If I need multiple containers in one variable, I would typically think of using a hash:


my $ml = {Child => new Class::MultiList(), Sibling => new Class::MultiList()}

rather than

  my $ml = new Class::MultiList;
  $ml->InitList(Name => 'Child');
  $ml->InitList(Name => 'Sibling');

Or, if you really want to do OO, you could implement two classes:

  my $ml = new Class::MyHash(
      Child   => new Class::MyList(),
      Sibling => new Class::MyList()
  );

which is more flexible because this also supports the inverse:

  my $ml = new Class::MyList(
      new Class::MyHash(),
      new Class::MyHash()
  );

Personally, I think the OO usage is overkill. It's fine for Java, but the Perl way of doing things is to keep things simple or to implement this with tied variables.

3) It's something like 'bidirect lists' in C which have next and prev refs, but I want abstract this class from data in cells.
Very good schem:
my $attr = $Obj->Attrs->First;
while ($attr->Next) {
...
}
but force me to change Attr object, so I've decided to use next style:
$Obj->InitList(Name => 'Attr');
$Obj->PushAttr($attr); #or
$Obj->Push(List => 'Attr', Element => $attr);


while (my $attr = $Obj->NextAttr) {
...
}

4) Main goal is walking through list(Next, Prev, First, Last)

5) I don't want to give public interface to internal array what other modules do.

Why not implement the module with Tie::Array?


6) I consider using of this module in OO enviorment so support for join method is something not normal.

I hope I've spot more light with this letter.

Best regards. Ruslan.


Mx.


-davidm





Reply via email to