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.
  • Looks useful.

    However, the docs and synopsis need to cover "new" (if it is special somehow, how to define/redefine, if there is any support for default property values via named params (or not), how it looks on the using side, etc).
    • Yeah, lack of comprehensive docs are the biggest problem with Moose at this moment. I have been pondering a Moose::Cookbook for the next release, which should help. But for now, the first five tests are the best documentation (001-005)_basic.t.

      But to answer your questions ...

      • if it is special somehow
        Not "special" really, it just calls $self->meta->new_object(@_) to construct the instance, and the BUILDALL to run all the BUILD methods.
      • how to define/redefine
        The idea is that you dont have to define it, a sane default is provided for you and will handle 80% of your needs. If you redefine it, I suggest calling SUPER::new.
      • if there is any support for default property values via named params (or not)
        Yes, this is how the default one works, it will only store params if they are a valid slot value though, it will just ignore other values (you can fiddle with them in BUILD if you want though)
      • how it looks on the using side
        Basically like this: Foo->new(bar => 'baz').
      For the most part it works as &new will work in Perl 6.

      -- Stevan