Stories
Slash Boxes
Comments
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.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Ovid,

    Class::MOP::Immutable is specifically made to be used with Class::MOP::Class instances. It takes those and makes them immutable, meaning your (meta)class cannot be changed. It will not work for random classes (thought some of it's internals could be re-used to build a Class::Immutable).

    Class::Immutable could be as simple as calling Hash::Util::lock_keys on the instance (assuming its a HASH based instance of course). Of course some nice class-building sugar would be good too.

    - Stevan
    • Actually, you'd want to lock the values, too. Mainly, it would simply be a matter of writing a class with only accessors and no mutators. Then you'd just add a clone method which allows data values to be replaced.

      • Actually, you'd want to lock the values, too.

        Good point :)

        This would actually be quite easy to implement within the Moose/Class::MOP frameworks, if I get the tuits I might give it a whirl.

        - Stevan