Tracks

書いてみたい方はココを参照下さい。

Class::Accessor::Lite - yet another accessor builder B!



Why do accessor builders modify @ISA? Doesn't it slow down method invocation? Class::Accessor::Lite is a yet-another accessor builder. The blurbs are:

  • compatible interface with Class::Accessor::Fast
  • does not alter @ISA
  • no dependencies
  • can set up read-only and / or write-only accessors and constructors

There is also a fancy interface (like Object::Tiny) to construct the accessors. The following code snippet should be self-explanatory.

package MyClass;

use Class::Accessor::Lite (
    new => 1,                # create constructor
    rw  => [ qw(foo bar) ],  # r/w accessor
    ro  => [ qw(baz) ],
    wo  => [ qw(hoge) ],
);

This entry was written by Kazuho Oku. His weblog can be found at: blog.kazuhooku.com.