Class-Std-Slots

 view release on metacpan or  search on metacpan

lib/Class/Std/Slots.pm  view on Meta::CPAN

or like this:

    $my_obj->connect('some_signal', sub { print "Slot fired" });

In either case an anonymous hash containing options may be passed as an
additional argument.

=item C<< Slot '%s' not handled by %s >>

You're attempting to connect to a slot that isn't implemented by
the target object. Slots are normal member functions.

=item C<< disconnect must be called as a member >>

Disconnect should be called like this:

    # Disconnect one slot
    $my_obj->disconnect('some_signal', $other_obj, 'slot_name');

or like this:

    # Disconnect all slots in the specified object
    $my_obj->disconnect('some_signal', $other_obj);

or like this:

    # Disconnect all slots for a signal
    $my_obj->disconnect('some_signal');

or like this:

    # Disconnect all slots for all signals
    $my_obj->disconnect();

=item C<< Signal '%s' aready declared >>

You're attempting to declare a signal that already exists. This may be
because it has been declared as a signal or because the signal name
clashes with a method name.

Note that it is illegal to redeclare a signal in a subclass if a parent
already declares the signal. Since signals can't be declared to do
anything other than be a signal it makes no sense to redeclare a
signal in a subclass.

=back

=head1 CONFIGURATION AND ENVIRONMENT

Class::Std::Slots requires no configuration files or environment variables.

=head1 DEPENDENCIES

C<Class::Std>

=head1 INCOMPATIBILITIES

Only known to work in conjuction with C<Class::Std>. Only tested when used
with C<Class::Std> in the way shown in this document.

=head1 BUGS AND LIMITATIONS

No bugs have been reported.

Connecting the same slot to a signal multiple times actually makes multiple
connections and therefore invokes the slot as many times as it was registered
when the signal is emitted. Arguably only one connection to each slot should
be allowed. Let me know.

There is currently no way to disconnect an anonymous sub slot without also
disconnecting other slots from the same signal.

C<Class::Std::Slots> replaces the DESTROY sub injected into the caller's
namespace by C<Class::Std> and arranges to call the original destructor
after doing its own cleanup. This may interact badly with other modules that
also replace the C<Class::Std> destructor - although it is designed to ensure
it always calls whatever destructor it finds. Suggestions for a neater way
of chaining our destructor gratefully received.

I'm not sure that the code that prevents signals from re-entering (i.e. it's
an error to emit a signal if that signal is already being handled) might not
prevent some (fairly complex) techniques. If this proves to be a limitation
in practice it would be possible to add an option to each connection that
would allow that connection to be re-entrant.

Please report any bugs or feature requests to
C<bug-class-std-slots@rt.cpan.org>, or through the web interface at
L<http://rt.cpan.org>.

=head1 AUTHOR

Andy Armstrong  C<< <andy@hexten.net> >>

=head1 LICENCE AND COPYRIGHT

Copyright (c) 2006, Andy Armstrong C<< <andy@hexten.net> >>. All rights reserved.

This module is free software; you can redistribute it and/or
modify it under the same terms as Perl itself. See L<perlartistic>.

=head1 DISCLAIMER OF WARRANTY

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
NECESSARY SERVICING, REPAIR, OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE
LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL,
OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF



( run in 1.846 second using v1.01-cache-2.11-cpan-39bf76dae61 )