[libx11-windowhierarchy-perl] 01/03: Import original source of X11-WindowHierarchy 0.004
Dima Kogan
dima at secretsauce.net
Wed Jan 15 09:03:45 UTC 2014
This is an automated email from the git hooks/post-receive script.
dkogan-guest pushed a commit to branch master
in repository libx11-windowhierarchy-perl.
commit 7650fbbbc0de0ff13a55ff3bb0dd8dd973a4c5a3
Author: Dima Kogan <dima at secretsauce.net>
Date: Wed Jan 15 00:29:25 2014 -0800
Import original source of X11-WindowHierarchy 0.004
---
Changes | 21 ++
INSTALL | 44 ++++
LICENSE | 379 +++++++++++++++++++++++++++++++
MANIFEST | 24 ++
META.json | 44 ++++
META.yml | 22 ++
Makefile.PL | 54 +++++
README | 13 ++
dist.ini | 64 ++++++
lib/X11/WindowHierarchy.pm | 234 +++++++++++++++++++
t/00-compile.t | 73 ++++++
t/00-pod.t | 5 +
t/00-use.t | 6 +
t/hierarchy.t | 18 ++
xt/author/test-eol.t | 9 +
xt/release/localbrew-dzil-clean-5.16.0.t | 77 +++++++
xt/release/localbrew-dzil-clean-5.8.9.t | 77 +++++++
xt/release/mojibake.t | 9 +
xt/release/pod-coverage.t | 13 ++
xt/release/pod-linkcheck.t | 20 ++
xt/release/pod-syntax.t | 7 +
xt/release/synopsis.t | 8 +
xt/release/test-version.t | 22 ++
xt/release/unused-vars.t | 8 +
24 files changed, 1251 insertions(+)
diff --git a/Changes b/Changes
new file mode 100644
index 0000000..9741f7d
--- /dev/null
+++ b/Changes
@@ -0,0 +1,21 @@
+Revision history for X11-WindowHierarchy
+
+0.004 2012-08-04 22:34:45 Europe/London
+ Replaced \v in window title cleanup regex to use an explicit
+ list of characters since perl<5.10.0 doesn't understand it.
+
+0.003 2012-08-01 20:42:42 Europe/London
+ Include geometry in datastructure we return, and provide an
+ example showing get-largest-window operation.
+
+ Also add parent.pm to prereqs, core since 5.10.1 but seems
+ polite to mention it since the rest of this module should be
+ 5.8-compatible.
+
+0.002 2012-07-23 04:52:49 Europe/London
+ Seems that I should be reading the manual on these dzil plugins, pod was broken
+ in that first release due to the @EXPORT definitions. Cleaned up a few other
+ documentation issues from initial release, code is unchanged.
+
+0.001 2012-07-23 04:36:26 Europe/London
+ Initial CPAN release
diff --git a/INSTALL b/INSTALL
new file mode 100644
index 0000000..4e64e80
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,44 @@
+
+This is the Perl distribution X11-WindowHierarchy.
+
+Installing X11-WindowHierarchy is straightforward.
+
+## Installation with cpanm
+
+If you have cpanm, you only need one line:
+
+ % cpanm X11::WindowHierarchy
+
+If you are installing into a system-wide directory, you may need to pass the
+"-S" flag to cpanm, which uses sudo to install the module:
+
+ % cpanm -S X11::WindowHierarchy
+
+## Installing with the CPAN shell
+
+Alternatively, if your CPAN shell is set up, you should just be able to do:
+
+ % cpan X11::WindowHierarchy
+
+## Manual installation
+
+As a last resort, you can manually install it. Download the tarball, untar it,
+then build it:
+
+ % perl Makefile.PL
+ % make && make test
+
+Then install it:
+
+ % make install
+
+If you are installing into a system-wide directory, you may need to run:
+
+ % sudo make install
+
+## Documentation
+
+X11-WindowHierarchy documentation is available as POD.
+You can run perldoc from a shell to read the documentation:
+
+ % perldoc X11::WindowHierarchy
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..e0745bd
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,379 @@
+This software is copyright (c) 2012 by Tom Molesworth.
+
+This is free software; you can redistribute it and/or modify it under
+the same terms as the Perl 5 programming language system itself.
+
+Terms of the Perl programming language system itself
+
+a) the GNU General Public License as published by the Free
+ Software Foundation; either version 1, or (at your option) any
+ later version, or
+b) the "Artistic License"
+
+--- The GNU General Public License, Version 1, February 1989 ---
+
+This software is Copyright (c) 2012 by Tom Molesworth.
+
+This is free software, licensed under:
+
+ The GNU General Public License, Version 1, February 1989
+
+ GNU GENERAL PUBLIC LICENSE
+ Version 1, February 1989
+
+ Copyright (C) 1989 Free Software Foundation, Inc.
+ 51 Franklin St, Suite 500, Boston, MA 02110-1335 USA
+
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The license agreements of most software companies try to keep users
+at the mercy of those companies. By contrast, our General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. The
+General Public License applies to the Free Software Foundation's
+software and to any other program whose authors commit to using it.
+You can use it for your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Specifically, the General Public License is designed to make
+sure that you have the freedom to give away or sell copies of free
+software, that you receive source code or can get it if you want it,
+that you can change the software or use pieces of it in new free
+programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of a such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must tell them their rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any program or other work which
+contains a notice placed by the copyright holder saying it may be
+distributed under the terms of this General Public License. The
+"Program", below, refers to any such program or work, and a "work based
+on the Program" means either the Program or any work containing the
+Program or a portion of it, either verbatim or with modifications. Each
+licensee is addressed as "you".
+
+ 1. You may copy and distribute verbatim copies of the Program's source
+code as you receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice and
+disclaimer of warranty; keep intact all the notices that refer to this
+General Public License and to the absence of any warranty; and give any
+other recipients of the Program a copy of this General Public License
+along with the Program. You may charge a fee for the physical act of
+transferring a copy.
+
+ 2. You may modify your copy or copies of the Program or any portion of
+it, and copy and distribute such modifications under the terms of Paragraph
+1 above, provided that you also do the following:
+
+ a) cause the modified files to carry prominent notices stating that
+ you changed the files and the date of any change; and
+
+ b) cause the whole of any work that you distribute or publish, that
+ in whole or in part contains the Program or any part thereof, either
+ with or without modifications, to be licensed at no charge to all
+ third parties under the terms of this General Public License (except
+ that you may choose to grant warranty protection to some or all
+ third parties, at your option).
+
+ c) If the modified program normally reads commands interactively when
+ run, you must cause it, when started running for such interactive use
+ in the simplest and most usual way, to print or display an
+ announcement including an appropriate copyright notice and a notice
+ that there is no warranty (or else, saying that you provide a
+ warranty) and that users may redistribute the program under these
+ conditions, and telling the user how to view a copy of this General
+ Public License.
+
+ d) You may charge a fee for the physical act of transferring a
+ copy, and you may at your option offer warranty protection in
+ exchange for a fee.
+
+Mere aggregation of another independent work with the Program (or its
+derivative) on a volume of a storage or distribution medium does not bring
+the other work under the scope of these terms.
+
+ 3. You may copy and distribute the Program (or a portion or derivative of
+it, under Paragraph 2) in object code or executable form under the terms of
+Paragraphs 1 and 2 above provided that you also do one of the following:
+
+ a) accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of
+ Paragraphs 1 and 2 above; or,
+
+ b) accompany it with a written offer, valid for at least three
+ years, to give any third party free (except for a nominal charge
+ for the cost of distribution) a complete machine-readable copy of the
+ corresponding source code, to be distributed under the terms of
+ Paragraphs 1 and 2 above; or,
+
+ c) accompany it with the information you received as to where the
+ corresponding source code may be obtained. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form alone.)
+
+Source code for a work means the preferred form of the work for making
+modifications to it. For an executable file, complete source code means
+all the source code for all modules it contains; but, as a special
+exception, it need not include source code for modules which are standard
+libraries that accompany the operating system on which the executable
+file runs, or for standard header files or definitions files that
+accompany that operating system.
+
+ 4. You may not copy, modify, sublicense, distribute or transfer the
+Program except as expressly provided under this General Public License.
+Any attempt otherwise to copy, modify, sublicense, distribute or transfer
+the Program is void, and will automatically terminate your rights to use
+the Program under this License. However, parties who have received
+copies, or rights to use copies, from you under this General Public
+License will not have their licenses terminated so long as such parties
+remain in full compliance.
+
+ 5. By copying, distributing or modifying the Program (or any work based
+on the Program) you indicate your acceptance of this license to do so,
+and all its terms and conditions.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the original
+licensor to copy, distribute or modify the Program subject to these
+terms and conditions. You may not impose any further restrictions on the
+recipients' exercise of the rights granted herein.
+
+ 7. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of the license which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+the license, you may choose any version ever published by the Free Software
+Foundation.
+
+ 8. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "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 PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 10. 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 PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (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 PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ Appendix: How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to humanity, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these
+terms.
+
+ To do so, attach the following notices to the program. It is safest to
+attach them to the start of each source file to most effectively convey
+the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) 19yy <name of author>
+
+ This program 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 1, or (at your option)
+ any later version.
+
+ This program 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 this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) 19xx name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the
+appropriate parts of the General Public License. Of course, the
+commands you use may be called something other than `show w' and `show
+c'; they could even be mouse-clicks or menu items--whatever suits your
+program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ program `Gnomovision' (a program to direct compilers to make passes
+ at assemblers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
+
+--- The Artistic License 1.0 ---
+
+This software is Copyright (c) 2012 by Tom Molesworth.
+
+This is free software, licensed under:
+
+ The Artistic License 1.0
+
+The Artistic License
+
+Preamble
+
+The intent of this document is to state the conditions under which a Package
+may be copied, such that the Copyright Holder maintains some semblance of
+artistic control over the development of the package, while giving the users of
+the package the right to use and distribute the Package in a more-or-less
+customary fashion, plus the right to make reasonable modifications.
+
+Definitions:
+
+ - "Package" refers to the collection of files distributed by the Copyright
+ Holder, and derivatives of that collection of files created through
+ textual modification.
+ - "Standard Version" refers to such a Package if it has not been modified,
+ or has been modified in accordance with the wishes of the Copyright
+ Holder.
+ - "Copyright Holder" is whoever is named in the copyright or copyrights for
+ the package.
+ - "You" is you, if you're thinking about copying or distributing this Package.
+ - "Reasonable copying fee" is whatever you can justify on the basis of media
+ cost, duplication charges, time of people involved, and so on. (You will
+ not be required to justify it to the Copyright Holder, but only to the
+ computing community at large as a market that must bear the fee.)
+ - "Freely Available" means that no fee is charged for the item itself, though
+ there may be fees involved in handling the item. It also means that
+ recipients of the item may redistribute it under the same conditions they
+ received it.
+
+1. You may make and give away verbatim copies of the source form of the
+Standard Version of this Package without restriction, provided that you
+duplicate all of the original copyright notices and associated disclaimers.
+
+2. You may apply bug fixes, portability fixes and other modifications derived
+from the Public Domain or from the Copyright Holder. A Package modified in such
+a way shall still be considered the Standard Version.
+
+3. You may otherwise modify your copy of this Package in any way, provided that
+you insert a prominent notice in each changed file stating how and when you
+changed that file, and provided that you do at least ONE of the following:
+
+ a) place your modifications in the Public Domain or otherwise make them
+ Freely Available, such as by posting said modifications to Usenet or an
+ equivalent medium, or placing the modifications on a major archive site
+ such as ftp.uu.net, or by allowing the Copyright Holder to include your
+ modifications in the Standard Version of the Package.
+
+ b) use the modified Package only within your corporation or organization.
+
+ c) rename any non-standard executables so the names do not conflict with
+ standard executables, which must also be provided, and provide a separate
+ manual page for each non-standard executable that clearly documents how it
+ differs from the Standard Version.
+
+ d) make other distribution arrangements with the Copyright Holder.
+
+4. You may distribute the programs of this Package in object code or executable
+form, provided that you do at least ONE of the following:
+
+ a) distribute a Standard Version of the executables and library files,
+ together with instructions (in the manual page or equivalent) on where to
+ get the Standard Version.
+
+ b) accompany the distribution with the machine-readable source of the Package
+ with your modifications.
+
+ c) accompany any non-standard executables with their corresponding Standard
+ Version executables, giving the non-standard executables non-standard
+ names, and clearly documenting the differences in manual pages (or
+ equivalent), together with instructions on where to get the Standard
+ Version.
+
+ d) make other distribution arrangements with the Copyright Holder.
+
+5. You may charge a reasonable copying fee for any distribution of this
+Package. You may charge any fee you choose for support of this Package. You
+may not charge a fee for this Package itself. However, you may distribute this
+Package in aggregate with other (possibly commercial) programs as part of a
+larger (possibly commercial) software distribution provided that you do not
+advertise this Package as a product of your own.
+
+6. The scripts and library files supplied as input to or produced as output
+from the programs of this Package do not automatically fall under the copyright
+of this Package, but belong to whomever generated them, and may be sold
+commercially, and may be aggregated with this Package.
+
+7. C or perl subroutines supplied by you and linked into this Package shall not
+be considered part of this Package.
+
+8. The name of the Copyright Holder may not be used to endorse or promote
+products derived from this software without specific prior written permission.
+
+9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+
+The End
+
diff --git a/MANIFEST b/MANIFEST
new file mode 100644
index 0000000..58435aa
--- /dev/null
+++ b/MANIFEST
@@ -0,0 +1,24 @@
+Changes
+INSTALL
+LICENSE
+MANIFEST
+META.json
+META.yml
+Makefile.PL
+README
+dist.ini
+lib/X11/WindowHierarchy.pm
+t/00-compile.t
+t/00-pod.t
+t/00-use.t
+t/hierarchy.t
+xt/author/test-eol.t
+xt/release/localbrew-dzil-clean-5.16.0.t
+xt/release/localbrew-dzil-clean-5.8.9.t
+xt/release/mojibake.t
+xt/release/pod-coverage.t
+xt/release/pod-linkcheck.t
+xt/release/pod-syntax.t
+xt/release/synopsis.t
+xt/release/test-version.t
+xt/release/unused-vars.t
diff --git a/META.json b/META.json
new file mode 100644
index 0000000..cf16ca3
--- /dev/null
+++ b/META.json
@@ -0,0 +1,44 @@
+{
+ "abstract" : "Retrieve information from X11 windows",
+ "author" : [
+ "Tom Molesworth <cpan at entitymodel.com>"
+ ],
+ "dynamic_config" : 0,
+ "generated_by" : "Dist::Zilla version 4.300021, CPAN::Meta::Converter version 2.120921",
+ "license" : [
+ "perl_5"
+ ],
+ "meta-spec" : {
+ "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
+ "version" : "2"
+ },
+ "name" : "X11-WindowHierarchy",
+ "prereqs" : {
+ "configure" : {
+ "requires" : {
+ "ExtUtils::MakeMaker" : "6.30"
+ }
+ },
+ "runtime" : {
+ "requires" : {
+ "X11::Protocol" : "0.56",
+ "parent" : "0"
+ }
+ },
+ "test" : {
+ "requires" : {
+ "Test::More" : "0.98"
+ }
+ }
+ },
+ "release_status" : "stable",
+ "resources" : {
+ "bugtracker" : {
+ "mailto" : "bug-x11-windowhierarchy at rt.cpan.org",
+ "web" : "http://rt.cpan.org/Public/Dist/Display.html?Name=X11-WindowHierarchy"
+ },
+ "homepage" : "http://search.cpan.org/dist/X11-WindowHierarchy/"
+ },
+ "version" : "0.004"
+}
+
diff --git a/META.yml b/META.yml
new file mode 100644
index 0000000..67afc3d
--- /dev/null
+++ b/META.yml
@@ -0,0 +1,22 @@
+---
+abstract: 'Retrieve information from X11 windows'
+author:
+ - 'Tom Molesworth <cpan at entitymodel.com>'
+build_requires:
+ Test::More: 0.98
+configure_requires:
+ ExtUtils::MakeMaker: 6.30
+dynamic_config: 0
+generated_by: 'Dist::Zilla version 4.300021, CPAN::Meta::Converter version 2.120921'
+license: perl
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-v1.4.html
+ version: 1.4
+name: X11-WindowHierarchy
+requires:
+ X11::Protocol: 0.56
+ parent: 0
+resources:
+ bugtracker: http://rt.cpan.org/Public/Dist/Display.html?Name=X11-WindowHierarchy
+ homepage: http://search.cpan.org/dist/X11-WindowHierarchy/
+version: 0.004
diff --git a/Makefile.PL b/Makefile.PL
new file mode 100644
index 0000000..876702b
--- /dev/null
+++ b/Makefile.PL
@@ -0,0 +1,54 @@
+
+use strict;
+use warnings;
+
+
+
+use ExtUtils::MakeMaker 6.30;
+
+
+
+my %WriteMakefileArgs = (
+ "ABSTRACT" => "Retrieve information from X11 windows",
+ "AUTHOR" => "Tom Molesworth <cpan\@entitymodel.com>",
+ "BUILD_REQUIRES" => {
+ "Test::More" => "0.98"
+ },
+ "CONFIGURE_REQUIRES" => {
+ "ExtUtils::MakeMaker" => "6.30"
+ },
+ "DISTNAME" => "X11-WindowHierarchy",
+ "EXE_FILES" => [],
+ "LICENSE" => "perl",
+ "NAME" => "X11::WindowHierarchy",
+ "PREREQ_PM" => {
+ "X11::Protocol" => "0.56",
+ "parent" => 0
+ },
+ "VERSION" => "0.004",
+ "test" => {
+ "TESTS" => "t/*.t"
+ }
+);
+
+
+unless ( eval { ExtUtils::MakeMaker->VERSION(6.56) } ) {
+ my $br = delete $WriteMakefileArgs{BUILD_REQUIRES};
+ my $pp = $WriteMakefileArgs{PREREQ_PM};
+ for my $mod ( keys %$br ) {
+ if ( exists $pp->{$mod} ) {
+ $pp->{$mod} = $br->{$mod} if $br->{$mod} > $pp->{$mod};
+ }
+ else {
+ $pp->{$mod} = $br->{$mod};
+ }
+ }
+}
+
+delete $WriteMakefileArgs{CONFIGURE_REQUIRES}
+ unless eval { ExtUtils::MakeMaker->VERSION(6.52) };
+
+WriteMakefile(%WriteMakefileArgs);
+
+
+
diff --git a/README b/README
new file mode 100644
index 0000000..d779ff2
--- /dev/null
+++ b/README
@@ -0,0 +1,13 @@
+
+
+This archive contains the distribution X11-WindowHierarchy,
+version 0.004:
+
+ Retrieve information from X11 windows
+
+This software is copyright (c) 2012 by Tom Molesworth.
+
+This is free software; you can redistribute it and/or modify it under
+the same terms as the Perl 5 programming language system itself.
+
+
diff --git a/dist.ini b/dist.ini
new file mode 100644
index 0000000..6891759
--- /dev/null
+++ b/dist.ini
@@ -0,0 +1,64 @@
+name = X11-WindowHierarchy
+author = Tom Molesworth <cpan at entitymodel.com>
+license = Perl_5
+copyright_holder = Tom Molesworth
+copyright_year = 2012
+main_module = lib/X11/WindowHierarchy.pm
+
+; can't use @Basic, due to ExtraTests, see below
+[GatherDir]
+[PruneCruft]
+[ManifestSkip]
+[MetaYAML]
+[License]
+[Readme]
+[ExecDir]
+[ShareDir]
+[MakeMaker]
+[Manifest]
+[TestRelease]
+[ConfirmRelease]
+[UploadToCPAN]
+[Prereqs]
+X11::Protocol = 0.56
+parent = 0
+[Prereqs / TestRequires]
+Test::More = 0.98
+[CheckExtraTests]
+[NextRelease]
+[VersionFromModule]
+[PodVersion]
+[PkgVersion]
+[Homepage]
+[Bugtracker]
+[InstallGuide]
+[MetaJSON]
+[PodSyntaxTests]
+[MojibakeTests]
+[Test::Compile]
+[Test::Synopsis]
+[Test::EOL]
+[Test::Version]
+; Broken - can't find CGI::Application, for example: https://rt.cpan.org/Ticket/Display.html?id=78729
+[Test::Pod::LinkCheck]
+[ArchiveRelease]
+directory = /home/tom/dev/CPAN-Archive
+; seems to be broken in several ways, even after getting past installation hurdles it complains
+; about the repository needing to be upgraded - all I want is the basic svn cp functionality
+; so handling this outside dzil for now
+; [Subversion::Tag]
+; tag_url = https://entitymodel.com/svn/tag/
+[Test::LocalBrew]
+; enable as patience dictates
+brews = dzil-clean-5.8.9
+; brews = dzil-clean-5.10.1
+; brews = dzil-clean-5.12.4
+; brews = dzil-clean-5.14.2
+brews = dzil-clean-5.16.0
+; these next two might break in not-quite-production-ready code
+[PodCoverageTests]
+[Test::UnusedVars]
+; Enabling this breaks the localbrew test due to hardcoded '../..' to find the top-level dist
+; directory, as long as I remember the dzil xtest step things seem to work okay with this
+; disabled though.
+; [ExtraTests]
diff --git a/lib/X11/WindowHierarchy.pm b/lib/X11/WindowHierarchy.pm
new file mode 100644
index 0000000..06626d0
--- /dev/null
+++ b/lib/X11/WindowHierarchy.pm
@@ -0,0 +1,234 @@
+package X11::WindowHierarchy;
+# ABSTRACT: Retrieve information from X11 windows
+use strict;
+use warnings;
+use parent qw(Exporter);
+
+our $VERSION = '0.004';
+
+=head1 NAME
+
+X11::WindowHierarchy - wrapper around L<X11::Protocol> for retrieving the current window hierarchy
+
+=head1 VERSION
+
+version 0.004
+
+=head1 SYNOPSIS
+
+ use X11::WindowHierarchy;
+
+ # Returns a list of all windows with at least one 'word' character in the
+ # window title, using the current $ENV{DISPLAY} to select the display and
+ # screen
+ my @windows = x11_filter_hierarchy(
+ filter => qr/\w/
+ );
+ printf "Found window [%s] (id %d)%s\n", $_->{title}, $_->{id}, $_->{pid} ? ' pid ' . $_->{pid} : '' for @windows;
+
+ # Dump all information we have about all windows on display :1
+ use Data::TreeDumper;
+ print DumpTree(x11_hierarchy(display => ':1'));
+
+=head1 DESCRIPTION
+
+Provides a couple of helper functions based on L<X11::Protocol> for
+extracting the current window hierarchy.
+
+=cut
+
+use X11::Protocol;
+
+our @EXPORT_OK = qw(x11_hierarchy x11_filter_hierarchy);
+our @EXPORT = qw(x11_hierarchy x11_filter_hierarchy);
+
+=head1 FUNCTIONS
+
+The following functions are exported by default, to avoid this:
+
+ use X11::WindowHierarchy qw();
+
+=cut
+
+=head2 x11_hierarchy
+
+Returns a hashref representing the current window hierarchy.
+
+Takes the following named parameters, all of which are optional:
+
+=over 4
+
+=item * display - DISPLAY string, such as ':0'
+
+=item * screen - the screen to use, such as 0 or 1
+
+=back
+
+Returns a hashref structure which contains the following keys:
+
+=over 4
+
+=item * id - the ID for this window
+
+=item * parent - the ID for the parent window
+
+=item * pid - the process ID for this window, if it has one
+
+=item * title - the window name, with any vertical whitespace (such as \n) converted to a single space
+
+=item * icon_name - the icon name
+
+=item * children - an arrayref of any child windows under this
+
+=back
+
+=cut
+
+sub x11_hierarchy {
+ my %args = @_;
+
+ # Only pass display if we have it
+ my $x = X11::Protocol->new(exists $args{display} ? (delete $args{display}) : ());
+ my $screen = delete $args{screen} || 0;
+
+ # Tree walker
+ my $code; $code = sub {
+ # We get a window ID.
+ my $win = shift;
+
+ # Extract all the properties we can
+ my %props = map {
+ # not entirely sure of the correct parameters for the API here, but, uh... "seems to work"
+ $_->[0] => ($x->GetProperty($win, $_->[1], 'AnyPropertyType', 0, 255))[0]
+ } map [
+ # pretty sure this only returns a scalar, and if it doesn't then we'll break in other ways,
+ # but the tests will save us!
+ $_ => scalar $x->atom($_, 1)
+ ], qw(
+ _NET_WM_ICON_NAME
+ _NET_WM_NAME
+ _NET_WM_PID
+ );
+
+ # Get all the geometry info apart from the root, since we know that already
+ my %geom = $x->GetGeometry($win);
+ delete $geom{root};
+ @props{keys %geom} = values %geom;
+
+ # Apply our ID
+ $props{id} = $win;
+
+ # Grab the pid if we have it
+ if(my $pid = delete $props{_NET_WM_PID}) {
+ $props{pid} = unpack 'L1', $pid;
+ }
+
+ # Get rid of any \n or similar chars, which seem to be legal in window titles for example
+ s/[\r\f\n\t\x0B]+/ /g for grep defined, values %props;
+
+ # Remap to something more friendly
+ $props{title} = delete $props{_NET_WM_NAME};
+ $props{icon_name} = delete $props{_NET_WM_ICON_NAME};
+
+ # Pull a list of all the child windows
+ my (undef, $parent, @kids) = $x->QueryTree($win);
+
+ # TODO seems to be consistent, but should check on l10n
+ undef $parent if $parent eq 'None';
+ $props{parent} = $parent if $parent;
+
+ # ... and recurse for each child window.
+ $props{children} = [ ];
+ push @{$props{children}}, $code->($_, $win) for @kids;
+ return \%props;
+ };
+
+ # Start at the root, work down.
+ my $tree = $code->($x->{screens}[$screen]{root});
+
+ # and we're done.
+ return $tree;
+}
+
+=head2 x11_filter_hierarchy
+
+Similar to L</x11_hierarchy> function, but instead of returning a tree hierarchy,
+returns a list of windows which match the given criteria.
+
+Takes the same parameters as L</x11_hierarchy>, with the addition of a C< filter >
+parameter.
+
+If given a coderef as the filter, this will be called for each window found,
+including the window in the output list if the coderef returns a true value.
+The hashref representing the window will be passed as the first parameter and
+for convenience is also available in $_. The full hierarchy will be constructed
+before filtering the list of windows, so you can perform matches based on
+the child elements if required.
+
+If given a regex as the filter, returns only the windows whose title matches
+the given regex.
+
+=cut
+
+sub x11_filter_hierarchy {
+ my %args = @_;
+ my $code = delete $args{filter};
+
+ if(ref($code) eq 'Regexp') {
+ my $re = $code;
+ $code = sub { return unless defined $_->{title}; $_->{title} =~ /$re/ };
+ }
+
+ my @out;
+ my @pending = x11_hierarchy(%args);
+ while(@pending) {
+ my $item = shift @pending;
+ push @pending, @{$item->{children}};
+
+ # Pass in $_[0] and $_ for convenience.
+ push @out, $item for grep $code->($item), $item;
+ }
+ @out
+}
+
+1;
+
+__END__
+
+=head1 EXAMPLES
+
+Get all window IDs for a given PID:
+
+ my @win = map $_->{id}, x11_filter_hierarchy(
+ filter => sub { $_->{pid} && $_->{pid} == $pid },
+ );
+
+Find the window ID for the largest (as measured by width x height) window
+for a given PID:
+
+ use List::UtilsBy qw(max_by);
+ my ($win) = max_by {
+ $_->{width} * $_->{height}
+ } map {
+ $_->{id}
+ } x11_filter_hierarchy(
+ filter => sub {
+ $_->{pid} && $_->{pid} == $pid
+ },
+ );
+
+=head1 SEE ALSO
+
+=over 4
+
+=item * L<X11::Protocol> - provides all the real functionality this module uses
+
+=back
+
+=head1 AUTHOR
+
+Tom Molesworth <cpan at entitymodel.com>
+
+=head1 LICENSE
+
+Copyright Tom Molesworth 2012. Licensed under the same terms as Perl itself.
diff --git a/t/00-compile.t b/t/00-compile.t
new file mode 100644
index 0000000..6771e12
--- /dev/null
+++ b/t/00-compile.t
@@ -0,0 +1,73 @@
+#!perl
+
+use strict;
+use warnings;
+
+use Test::More;
+
+
+
+use File::Find;
+use File::Temp qw{ tempdir };
+
+my @modules;
+find(
+ sub {
+ return if $File::Find::name !~ /\.pm\z/;
+ my $found = $File::Find::name;
+ $found =~ s{^lib/}{};
+ $found =~ s{[/\\]}{::}g;
+ $found =~ s/\.pm$//;
+ # nothing to skip
+ push @modules, $found;
+ },
+ 'lib',
+);
+
+sub _find_scripts {
+ my $dir = shift @_;
+
+ my @found_scripts = ();
+ find(
+ sub {
+ return unless -f;
+ my $found = $File::Find::name;
+ # nothing to skip
+ open my $FH, '<', $_ or do {
+ note( "Unable to open $found in ( $! ), skipping" );
+ return;
+ };
+ my $shebang = <$FH>;
+ return unless $shebang =~ /^#!.*?\bperl\b\s*$/;
+ push @found_scripts, $found;
+ },
+ $dir,
+ );
+
+ return @found_scripts;
+}
+
+my @scripts;
+do { push @scripts, _find_scripts($_) if -d $_ }
+ for qw{ bin script scripts };
+
+my $plan = scalar(@modules) + scalar(@scripts);
+$plan ? (plan tests => $plan) : (plan skip_all => "no tests to run");
+
+{
+ # fake home for cpan-testers
+ # no fake requested ## local $ENV{HOME} = tempdir( CLEANUP => 1 );
+
+ like( qx{ $^X -Ilib -e "require $_; print '$_ ok'" }, qr/^\s*$_ ok/s, "$_ loaded ok" )
+ for sort @modules;
+
+ SKIP: {
+ eval "use Test::Script 1.05; 1;";
+ skip "Test::Script needed to test script compilation", scalar(@scripts) if $@;
+ foreach my $file ( @scripts ) {
+ my $script = $file;
+ $script =~ s!.*/!!;
+ script_compiles( $file, "$script script compiles" );
+ }
+ }
+}
diff --git a/t/00-pod.t b/t/00-pod.t
new file mode 100755
index 0000000..f499d03
--- /dev/null
+++ b/t/00-pod.t
@@ -0,0 +1,5 @@
+use Test::More;
+eval "use Test::Pod 1.00";
+plan skip_all => "Test::Pod 1.00 required for testing POD" if $@;
+
+all_pod_files_ok();
diff --git a/t/00-use.t b/t/00-use.t
new file mode 100755
index 0000000..3170ef4
--- /dev/null
+++ b/t/00-use.t
@@ -0,0 +1,6 @@
+use strict;
+use warnings;
+
+use Test::More tests => 1;
+use_ok('X11::WindowHierarchy');
+
diff --git a/t/hierarchy.t b/t/hierarchy.t
new file mode 100644
index 0000000..06daf34
--- /dev/null
+++ b/t/hierarchy.t
@@ -0,0 +1,18 @@
+use strict;
+use warnings;
+use Test::More;
+use X11::WindowHierarchy;
+
+plan skip_all => 'Set $ENV{DISPLAY} to run this test' unless length $ENV{DISPLAY};
+
+plan tests => 6;
+
+# This is all pretty basic, maybe we should try starting up a few things with known
+# names / pids so we can check in more detail?
+ok(my $tree = x11_hierarchy(), 'can get hierarchy');
+is(ref $tree, 'HASH', 'is a hashref');
+ok(exists $tree->{children}, 'has arrayref of children');
+
+is(x11_filter_hierarchy(filter => sub { 0 }), 0, 'no windows with false coderef filter');
+ok(eval { x11_filter_hierarchy(filter => sub { 1 }); 1 }, 'no exception raised with true coderef filter');
+ok(eval { x11_filter_hierarchy(filter => qr/\w/); 1 }, 'no exception raised with regex filter');
diff --git a/xt/author/test-eol.t b/xt/author/test-eol.t
new file mode 100644
index 0000000..5eb035e
--- /dev/null
+++ b/xt/author/test-eol.t
@@ -0,0 +1,9 @@
+use strict;
+use warnings;
+use Test::More;
+
+# generated by Dist::Zilla::Plugin::Test::EOL 0.07
+eval "use Test::EOL; 1;" or die $@;
+# ^^ hack to get around prereqscanner detection, remove someday
+
+all_perl_files_ok({ trailing_whitespace => 1 });
diff --git a/xt/release/localbrew-dzil-clean-5.16.0.t b/xt/release/localbrew-dzil-clean-5.16.0.t
new file mode 100644
index 0000000..20e8ad8
--- /dev/null
+++ b/xt/release/localbrew-dzil-clean-5.16.0.t
@@ -0,0 +1,77 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use File::Spec;
+use File::Temp;
+use Test::More;
+
+delete @ENV{qw/AUTHOR_TESTING RELEASE_TESTING/};
+
+unless($ENV{'PERLBREW_ROOT'}) {
+ plan skip_all => "Environment variable 'PERLBREW_ROOT' not found";
+ exit;
+}
+
+my $brew = q[dzil-clean-5.16.0];
+
+my $cpanm_path = qx(which cpanm 2>/dev/null);
+unless($cpanm_path) {
+ plan skip_all => "The 'cpanm' program is required to run this test";
+ exit;
+}
+chomp $cpanm_path;
+
+my $perlbrew_bin = File::Spec->catdir($ENV{'PERLBREW_ROOT'}, 'perls',
+ $brew, 'bin');
+
+my ( $env, $status ) = do {
+ local $ENV{'SHELL'} = '/bin/bash'; # fool perlbrew
+ ( scalar(qx(perlbrew env $brew)), $? )
+};
+
+unless($status == 0) {
+ plan skip_all => "No such perlbrew environment '$brew'";
+ exit;
+}
+
+my @lines = split /\n/, $env;
+
+foreach my $line (@lines) {
+ if($line =~ /^\s*export\s+([0-9a-zA-Z_]+)=(.*)$/) {
+ my ( $k, $v ) = ( $1, $2 );
+ if($v =~ /^("|')(.*)\1$/) {
+ $v = $2;
+ $v =~ s!\\(.)!$1!ge;
+ }
+ $ENV{$k} = $v;
+ } elsif($line =~ /^unset\s+([0-9a-zA-Z_]+)/) {
+ delete $ENV{$1};
+ }
+}
+
+$ENV{'PATH'} = join(':', @ENV{qw/PERLBREW_PATH PATH_WITHOUT_PERLBREW/});
+
+plan tests => 1;
+
+my $tmpdir = File::Temp->newdir;
+
+my $pid = fork;
+if($pid) {
+ unless(defined $pid) {
+ fail "Forking failed!";
+ exit 1;
+ }
+ waitpid $pid, 0;
+ ok !$?, "cpanm should successfully install your dist with no issues";
+} else {
+ close STDOUT;
+ close STDERR;
+
+ chdir File::Spec->catdir($FindBin::Bin,
+ File::Spec->updir, File::Spec->updir); # exit test directory
+
+ exec 'perl', $cpanm_path, '-L', $tmpdir->dirname, '.';
+}
diff --git a/xt/release/localbrew-dzil-clean-5.8.9.t b/xt/release/localbrew-dzil-clean-5.8.9.t
new file mode 100644
index 0000000..a790510
--- /dev/null
+++ b/xt/release/localbrew-dzil-clean-5.8.9.t
@@ -0,0 +1,77 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use File::Spec;
+use File::Temp;
+use Test::More;
+
+delete @ENV{qw/AUTHOR_TESTING RELEASE_TESTING/};
+
+unless($ENV{'PERLBREW_ROOT'}) {
+ plan skip_all => "Environment variable 'PERLBREW_ROOT' not found";
+ exit;
+}
+
+my $brew = q[dzil-clean-5.8.9];
+
+my $cpanm_path = qx(which cpanm 2>/dev/null);
+unless($cpanm_path) {
+ plan skip_all => "The 'cpanm' program is required to run this test";
+ exit;
+}
+chomp $cpanm_path;
+
+my $perlbrew_bin = File::Spec->catdir($ENV{'PERLBREW_ROOT'}, 'perls',
+ $brew, 'bin');
+
+my ( $env, $status ) = do {
+ local $ENV{'SHELL'} = '/bin/bash'; # fool perlbrew
+ ( scalar(qx(perlbrew env $brew)), $? )
+};
+
+unless($status == 0) {
+ plan skip_all => "No such perlbrew environment '$brew'";
+ exit;
+}
+
+my @lines = split /\n/, $env;
+
+foreach my $line (@lines) {
+ if($line =~ /^\s*export\s+([0-9a-zA-Z_]+)=(.*)$/) {
+ my ( $k, $v ) = ( $1, $2 );
+ if($v =~ /^("|')(.*)\1$/) {
+ $v = $2;
+ $v =~ s!\\(.)!$1!ge;
+ }
+ $ENV{$k} = $v;
+ } elsif($line =~ /^unset\s+([0-9a-zA-Z_]+)/) {
+ delete $ENV{$1};
+ }
+}
+
+$ENV{'PATH'} = join(':', @ENV{qw/PERLBREW_PATH PATH_WITHOUT_PERLBREW/});
+
+plan tests => 1;
+
+my $tmpdir = File::Temp->newdir;
+
+my $pid = fork;
+if($pid) {
+ unless(defined $pid) {
+ fail "Forking failed!";
+ exit 1;
+ }
+ waitpid $pid, 0;
+ ok !$?, "cpanm should successfully install your dist with no issues";
+} else {
+ close STDOUT;
+ close STDERR;
+
+ chdir File::Spec->catdir($FindBin::Bin,
+ File::Spec->updir, File::Spec->updir); # exit test directory
+
+ exec 'perl', $cpanm_path, '-L', $tmpdir->dirname, '.';
+}
diff --git a/xt/release/mojibake.t b/xt/release/mojibake.t
new file mode 100644
index 0000000..2df76e7
--- /dev/null
+++ b/xt/release/mojibake.t
@@ -0,0 +1,9 @@
+#!perl
+
+use Test::More;
+
+eval 'use Test::Mojibake';
+plan skip_all => 'Test::Mojibake required for source encoding testing'
+ if $@;
+
+all_files_encoding_ok();
diff --git a/xt/release/pod-coverage.t b/xt/release/pod-coverage.t
new file mode 100644
index 0000000..b52218b
--- /dev/null
+++ b/xt/release/pod-coverage.t
@@ -0,0 +1,13 @@
+#!perl
+
+use Test::More;
+
+eval "use Test::Pod::Coverage 1.08";
+plan skip_all => "Test::Pod::Coverage 1.08 required for testing POD coverage"
+ if $@;
+
+eval "use Pod::Coverage::TrustPod";
+plan skip_all => "Pod::Coverage::TrustPod required for testing POD coverage"
+ if $@;
+
+all_pod_coverage_ok({ coverage_class => 'Pod::Coverage::TrustPod' });
diff --git a/xt/release/pod-linkcheck.t b/xt/release/pod-linkcheck.t
new file mode 100644
index 0000000..00602db
--- /dev/null
+++ b/xt/release/pod-linkcheck.t
@@ -0,0 +1,20 @@
+#!perl
+
+use strict;
+use warnings;
+use Test::More;
+
+foreach my $env_skip ( qw(
+ SKIP_POD_LINKCHECK
+) ){
+ plan skip_all => "\$ENV{$env_skip} is set, skipping"
+ if $ENV{$env_skip};
+}
+
+eval "use Test::Pod::LinkCheck";
+if ( $@ ) {
+ plan skip_all => 'Test::Pod::LinkCheck required for testing POD';
+}
+else {
+ Test::Pod::LinkCheck->new->all_pod_ok;
+}
diff --git a/xt/release/pod-syntax.t b/xt/release/pod-syntax.t
new file mode 100644
index 0000000..8a22900
--- /dev/null
+++ b/xt/release/pod-syntax.t
@@ -0,0 +1,7 @@
+#!perl
+use Test::More;
+
+eval "use Test::Pod 1.41";
+plan skip_all => "Test::Pod 1.41 required for testing POD" if $@;
+
+all_pod_files_ok();
diff --git a/xt/release/synopsis.t b/xt/release/synopsis.t
new file mode 100644
index 0000000..a5f7223
--- /dev/null
+++ b/xt/release/synopsis.t
@@ -0,0 +1,8 @@
+#!perl
+
+use Test::More;
+
+eval "use Test::Synopsis";
+plan skip_all => "Test::Synopsis required for testing synopses"
+ if $@;
+all_synopsis_ok('lib');
diff --git a/xt/release/test-version.t b/xt/release/test-version.t
new file mode 100644
index 0000000..b7a0f17
--- /dev/null
+++ b/xt/release/test-version.t
@@ -0,0 +1,22 @@
+use strict;
+use warnings;
+use Test::More;
+
+# generated by Dist::Zilla::Plugin::Test::Version 0.002004
+BEGIN { eval "use Test::Version; 1;" or die $@; }
+
+my @imports = ( 'version_all_ok' );
+
+my $params = {
+ is_strict => 0,
+ has_version => 1,
+};
+
+push @imports, $params
+ if version->parse( $Test::Version::VERSION ) >= version->parse('1.002');
+
+
+Test::Version->import(@imports);
+
+version_all_ok;
+done_testing;
diff --git a/xt/release/unused-vars.t b/xt/release/unused-vars.t
new file mode 100644
index 0000000..edbcb35
--- /dev/null
+++ b/xt/release/unused-vars.t
@@ -0,0 +1,8 @@
+#!perl
+
+use Test::More;
+
+eval "use Test::Vars";
+plan skip_all => "Test::Vars required for testing unused vars"
+ if $@;
+all_vars_ok();
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libx11-windowhierarchy-perl.git
More information about the Pkg-perl-cvs-commits
mailing list