Class-Accessor-Inherited-XS

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

0.39 Mon Mar 24 12:34:06 MSK 2025
    - do make copy in getters to avoid some stack-not-refcounted corner cases

0.38 Tue Oct  4 21:42:44 MSK 2022
    - fix for broken 5.37

0.37 Tue Oct 27 11:36:44 MSK 2020
    - fix compilation on some clang compilers

0.36 Sun Sep 16 00:14:21 MSK 2018
    - change named callbacks implementation
    - add named callbacks to public API

0.35 Sun Aug 26 00:45:39 MSK 2018
    - added c++ backend for weak accessors
    - added c++ backend for named inherited accessors
    - rewrite accessor generation to recursive templates
    - better CAIXS interface

0.34 Sun Aug 13 23:55:53 MSK 2017
    - add missing file to MANIFEST

README  view on Meta::CPAN

        );

        package MyClass;
        use MyAccessor;
        use Class::Accessor::Inherited::XS {
            inherited    => ['foo'],
            inherited_cb => ['bar'],
        };

    You can register new inherited accessor types with associated read/write
    callbacks. Unlike Class::Accessor::Grouped, only a single callback can
    be set for a type, without per-class get_$type/set_$type lookups. You
    can omit either on_read or on_write if you don't need it to avoid
    performance losses from associated call.

    on_read callback receives a single argument - return value from the
    underlying inherited accessor. It's result is the new accessor's return
    value (and it isn't stored anywhere).

    on_write callback receives original accessor's arguments, and it's
    return value is stored as usual. Exceptions thrown from this callback

lib/Class/Accessor/Inherited/XS.pm  view on Meta::CPAN

        inherited_cb => {on_read => sub {}, on_write => sub{}, opts => $bitset},
    );

    package MyClass;
    use MyAccessor;
    use Class::Accessor::Inherited::XS {
        inherited    => ['foo'],
        inherited_cb => ['bar'],
    };

You can register new inherited accessor types with associated read/write callbacks. Unlike
L<Class::Accessor::Grouped>, only a single callback can be set for a type, without per-class
B<get_$type>/B<set_$type> lookups. You can omit either B<on_read> or B<on_write> if you don't
need it to avoid performance losses from associated call.

B<on_read> callback receives a single argument - return value from the underlying B<inherited> accessor. It's result
is the new accessor's return value (and it isn't stored anywhere).

B<on_write> callback receives original accessor's arguments, and it's return value is stored as usual.
Exceptions thrown from this callback will cancel store and will leave old value unchanged.



( run in 2.174 seconds using v1.01-cache-2.11-cpan-9b1e4054eb1 )