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

NAME

WL::Base - Base class for Wayland objects

SYNOPSIS

  # Obtain an object instance
  my $display = $conn->get_display ();

  # Attach callbacks for events
  $display->{'WL::wl_display::error'} = sub {
      my ($self, $object, $code, $message) = @_;
      die $message;
  };

  # Issue a request
  my $registry = $display->get_registry ();

  # Rebless to attach event handlers
  bless $registry, 'MyRegistry';

  package MyRegistry;
  use base qw/WL::wl_registry/;

  # Implementation of an event handler
  sub global
  {
      my ($self, $id, $class, $version) = @_;
      warn "Object $id is of class $class version $version";
  }

DESCRIPTION

WL::Base is a base class for Wayland protocol objects. It provides support routines for common Wayland object actions and helper routines. It should not be used directly.

Please consider this an alpha quality code, whose API can change at any time, until we reach version 1.0.

METHODS

new CONNECTION [ID]

Create a new object instance. This should not be used directly, as WL::Connection creates objects whenever needed.

First argument is the WL::Connection instance while second, optional is the object number. It only makes sense for remote objects, local objects get their number allocated automatically.

call OPCODE PAYLOAD [FILE]

Send a request. The payload is already serialized request body without opcode and size part.

Optional file is an open file handle that would get passed with the request as anciliary data.

AUTOLOAD [...]

If an attempt was made to call a method that does not exist (this happend upon event receipt), autoloader dispatches to a function reference if a property named like the event exists.

This makes it possible to attach event handlers without subclassing (it is still possible to implement event handlers in subclasses though).

FUNCTIONS

nv2fixed NUMBER

This is a helper routine that serializes a Perl numeric value to a Wayland 24.8 fixed format number.

fixed2nv FIXED

This is a helper routine that deserializes a Wayland 24.8 fixed format number to a Perl numeric value.

SEE ALSO

COPYRIGHT

Copyright 2013 Lubomir Rintel

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHORS

Lubomir Rintel lkundrak@v3.sk