1package X11::Xlib::XID; 2use strict; 3use warnings; 4use Carp; 5use X11::Xlib; 6 7# All modules in dist share a version 8BEGIN { our $VERSION= $X11::Xlib::VERSION; } 9 10sub new { 11 my $class= shift; 12 my %args= (@_ == 1 && ref $_[0] eq 'HASH')? %{$_[0]} : @_; 13 defined $args{display} or croak "'display' is required"; 14 defined $args{xid} or croak "'xid' is required"; 15 bless \%args, $class; 16} 17 18sub display { croak "read-only" if @_ > 1; $_[0]{display} } 19 20sub xid { croak "read-only" if @_ > 1; $_[0]{xid} } 21*id= *xid; 22 23sub autofree { my $self= shift; $self->{autofree}= shift if @_; $self->{autofree} } 24 25sub summarize { 26 my $self= shift; 27 my $type= (split '::', ref $self)[-1]; 28 return $type.'-'.$self->xid; 29} 30 311; 32 33__END__ 34 35=head1 NAME 36 37X11::Xlib::XID - Base class for objects wrapping an XID 38 39=head1 ATTRIBUTES 40 41=head2 display 42 43Required. The L<X11::Xlib::Display> where the resource is located. 44 45=head2 xid 46 47Required. The X11 numeric ID for this resource. 48 49=head2 autofree 50 51Whether this object should control the lifespan of the remote resource, 52by calling an Xlib Free/Destroy function if it goes out of scope. 53The default is False, since this base class has no idea how to release 54any resources. 55 56=head1 METHODS 57 58=head2 summarize 59 60Return a human-readable string describing the object. The text is subject 61to change, and may be customized for the specific subclass. 62 63=head1 AUTHOR 64 65Olivier Thauvin, E<lt>nanardon@nanardon.zarb.orgE<gt> 66 67Michael Conrad, E<lt>mike@nrdvana.netE<gt> 68 69=head1 COPYRIGHT AND LICENSE 70 71Copyright (C) 2009-2010 by Olivier Thauvin 72 73Copyright (C) 2017 by Michael Conrad 74 75This library is free software; you can redistribute it and/or modify 76it under the same terms as Perl itself, either Perl version 5.10.0 or, 77at your option, any later version of Perl 5 you may have available. 78 79=cut 80