Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • Just curious, why do you prefer OIO over Moose?

    • As I said, it's merely a preference. There's nothing that I found so far that is a show-stopper or an overwhelming advantage for any of them. This being said...

      The biggest plus of OIO, for me, is how inside-out objects ensure that colliding fields are not clobbered, but masked:

      package Foo;
      use Moose;
      has 'x' => ( default => 'foo', is => 'rw' );

      package Bar;
      use Moose;
      extends 'Foo';
      has 'x' => ( +default => 'bar' );

      package main;
      my $obj = Bar->new;
      say $obj->x;       

  • The first impression from the synopsis is that the syntax seems pretty comfortable.

    And from what I could tell by browsing the docs it does deal with my biggest problem with inside-out-objects: debuggability.

    With the dynamic typing in Perl, if I'm confused as to what I'm looking at it's essential to be able to dump the object data structure easily just to see what's what. I'm assuming (well, hoping) that's covered by the "Object Serialization" blurb.

    • It is covered. And provided that your class is relatively plain vanilla, the dump() method will do what you want:

      package Foo;
      use Object::InsideOut;
      my @x : Field :Acc('x') :Default('foo');
      my @y : Field :Acc('y') :Default('bar');
      my @z : Field :Acc('z') :Default('baz');

      package main;
      my $obj = Foo->new;

      use Data::Dumper;
      say Dumper $obj->dump;