The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Glib::Ex::SignalBits -- miscellaneous Glib signal helpers

SYNOPSIS

 use Glib::Ex::SignalBits;

FUNCTIONS

Accumulators

The following functions are designed for use as the "accumulator" in a signal created by Glib::Object::Subclass or Glib::Type->register_object(). The functions are trivial, but giving them names gets the right sense and order for the return values.

($cont, $ret) = Glib::Ex::SignalBits::accumulator_first ($hint, $acc, $ret)

Stop at and return the value from the first handler.

($cont, $ret) = Glib::Ex::SignalBits::accumulator_first_defined ($hint, $acc, $ret)

Stop at and return the first defined value, in the Perl sense. This means the first non-NULL Glib::Object, Glib::String, etc, or first non-undef Glib::Scalar.

Example

    use Glib::Object::Subclass
      'Gtk2::Widget',
      signals => {
        'make-title' => {
          param_types   => ['Glib::Int'],
          return_type   => 'Glib::String',
          flags         => ['run-last'],
          class_closure => \&my_default_make_title,
          accumulator   => \&Glib::Ex::SignalBits::accumulator_first_defined,
        },
      };

Don't forget to use Glib::Ex::SignalBits because a non-existent function in a signal accumulator will cause an abort() from Perl-Glib (as of version 1.220).

EXPORTS

Nothing is exported by default, but each function can be requested in usual Exporter style,

    use Glib::Ex::SignalBits 'accumulator_first';
    
    use Glib::Object::Subclass
      ... accumulator => \&accumulator_first

SEE ALSO

Glib::Object, Glib::Object::Subclass, Glib::Signal, Glib::Ex::SignalIds, Glib::Ex::FreezeNotify

HOME PAGE

http://user42.tuxfamily.org/glib-ex-objectbits/index.html

LICENSE

Copyright 2009, 2010, 2011, 2012, 2014 Kevin Ryde

Glib-Ex-ObjectBits is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.

Glib-Ex-ObjectBits is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with Glib-Ex-ObjectBits. If not, see http://www.gnu.org/licenses/.