Hello community,

here is the log from the commit of package perl-AnyEvent-I3 for 
openSUSE:Factory checked in at 2012-09-05 09:48:23
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-AnyEvent-I3 (Old)
 and      /work/SRC/openSUSE:Factory/.perl-AnyEvent-I3.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "perl-AnyEvent-I3", Maintainer is ""

Changes:
--------
--- /work/SRC/openSUSE:Factory/perl-AnyEvent-I3/perl-AnyEvent-I3.changes        
2012-05-08 12:28:35.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.perl-AnyEvent-I3.new/perl-AnyEvent-I3.changes   
2012-09-05 09:48:26.000000000 +0200
@@ -1,0 +2,8 @@
+Tue Sep  4 13:02:12 UTC 2012 - [email protected]
+
+- updated to 0.13
+  * support the GET_VERSION request with a fall-back to i3 --version
+  * taint mode fix: remove relative directories from $ENV{PATH}
+  * taint mode fix for FreeBSD
+
+-------------------------------------------------------------------

Old:
----
  AnyEvent-I3-0.09.tar.gz

New:
----
  AnyEvent-I3-0.13.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ perl-AnyEvent-I3.spec ++++++
--- /var/tmp/diff_new_pack.bTIm9k/_old  2012-09-05 09:48:28.000000000 +0200
+++ /var/tmp/diff_new_pack.bTIm9k/_new  2012-09-05 09:48:28.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           perl-AnyEvent-I3
-Version:        0.09
+Version:        0.13
 Release:        0
 %define cpan_name AnyEvent-I3
 Summary:        communicate with the i3 window manager

++++++ AnyEvent-I3-0.09.tar.gz -> AnyEvent-I3-0.13.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/AnyEvent-I3-0.09/Changes new/AnyEvent-I3-0.13/Changes
--- old/AnyEvent-I3-0.09/Changes        2010-03-13 17:21:24.000000000 +0100
+++ new/AnyEvent-I3-0.13/Changes        2012-08-05 17:41:07.000000000 +0200
@@ -1,5 +1,52 @@
 Revision history for AnyEvent-I3
 
-0.01    2010-03-13
-        First version, released on an unsuspecting world.
+0.13    2012-08-05
 
+    * support the GET_VERSION request with a fall-back to i3 --version
+
+0.12    2012-07-11
+
+    * taint mode fix: remove relative directories from $ENV{PATH}
+
+0.11    2012-07-10
+
+    * taint mode fix for FreeBSD
+
+0.10    2012-07-09
+
+    * Use i3 --get-socketpath by default for determining the socket path
+    * Bugfix: Also delete callbacks which are triggered due to an error
+
+0.09    2011-10-12
+
+    * Implement GET_BAR_CONFIG request
+
+0.08    2011-09-26
+
+    * Implement GET_MARKS request
+    * The synopsis mentioned ->workspaces, but it’s ->get_workspaces
+
+0.07    2010-11-21
+
+    * Implement GET_TREE request
+
+0.06    2010-06-16
+
+    * Add check to Makefile to abort in a Windows environment (neither i3 nor
+      unix sockets available)
+
+0.05    2010-06-09
+
+    * use getpwuid() to resolve ~ in socket paths instead of glob()
+
+0.04    2010-03-27
+
+    * use new default ipc-socket path, glob() path, bump version
+
+0.03    2010-03-26
+
+    * fix MANIFEST
+
+0.02    2010-03-23
+
+    * first upload to CPAN
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/AnyEvent-I3-0.09/MANIFEST 
new/AnyEvent-I3-0.13/MANIFEST
--- old/AnyEvent-I3-0.09/MANIFEST       2011-10-20 21:29:43.000000000 +0200
+++ new/AnyEvent-I3-0.13/MANIFEST       2011-05-29 20:15:24.000000000 +0200
@@ -9,7 +9,7 @@
 inc/Module/Install/WriteAll.pm
 lib/AnyEvent/I3.pm
 Makefile.PL
-MANIFEST                       This list of files
+MANIFEST
 MANIFEST.SKIP
 META.yml
 README
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/AnyEvent-I3-0.09/META.yml 
new/AnyEvent-I3-0.13/META.yml
--- old/AnyEvent-I3-0.09/META.yml       2011-10-20 21:29:54.000000000 +0200
+++ new/AnyEvent-I3-0.13/META.yml       2012-08-05 17:41:22.000000000 +0200
@@ -1,14 +1,15 @@
 ---
 abstract: 'communicate with the i3 window manager'
 author:
-  - 'Michael Stapelberg, C<< <michael at stapelberg.de> >>'
+  - 'Michael Stapelberg, C<< <michael at i3wm.org> >>'
   - 'Michael Stapelberg'
 build_requires:
-  ExtUtils::MakeMaker: 6.42
+  ExtUtils::MakeMaker: 6.36
 configure_requires:
-  ExtUtils::MakeMaker: 6.42
+  ExtUtils::MakeMaker: 6.36
 distribution_type: module
-generated_by: 'Module::Install version 1.01'
+dynamic_config: 1
+generated_by: 'Module::Install version 1.06'
 license: gpl
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -25,4 +26,4 @@
   JSON::XS: 0
 resources:
   license: http://opensource.org/licenses/gpl-license.php
-version: 0.09
+version: 0.13
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/AnyEvent-I3-0.09/inc/Module/Install/Base.pm 
new/AnyEvent-I3-0.13/inc/Module/Install/Base.pm
--- old/AnyEvent-I3-0.09/inc/Module/Install/Base.pm     2011-10-20 
21:29:53.000000000 +0200
+++ new/AnyEvent-I3-0.13/inc/Module/Install/Base.pm     2012-08-05 
17:41:22.000000000 +0200
@@ -4,7 +4,7 @@
 use strict 'vars';
 use vars qw{$VERSION};
 BEGIN {
-       $VERSION = '1.01';
+       $VERSION = '1.06';
 }
 
 # Suspend handler for "redefined" warnings
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/AnyEvent-I3-0.09/inc/Module/Install/Can.pm 
new/AnyEvent-I3-0.13/inc/Module/Install/Can.pm
--- old/AnyEvent-I3-0.09/inc/Module/Install/Can.pm      2011-10-20 
21:29:53.000000000 +0200
+++ new/AnyEvent-I3-0.13/inc/Module/Install/Can.pm      2012-08-05 
17:41:22.000000000 +0200
@@ -3,13 +3,12 @@
 
 use strict;
 use Config                ();
-use File::Spec            ();
 use ExtUtils::MakeMaker   ();
 use Module::Install::Base ();
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-       $VERSION = '1.01';
+       $VERSION = '1.06';
        @ISA     = 'Module::Install::Base';
        $ISCORE  = 1;
 }
@@ -29,7 +28,7 @@
        eval { require $mod; $pkg->VERSION($ver || 0); 1 };
 }
 
-# check if we can run some command
+# Check if we can run some command
 sub can_run {
        my ($self, $cmd) = @_;
 
@@ -38,14 +37,88 @@
 
        for my $dir ((split /$Config::Config{path_sep}/, $ENV{PATH}), '.') {
                next if $dir eq '';
-               my $abs = File::Spec->catfile($dir, $_[1]);
+               require File::Spec;
+               my $abs = File::Spec->catfile($dir, $cmd);
                return $abs if (-x $abs or $abs = MM->maybe_command($abs));
        }
 
        return;
 }
 
-# can we locate a (the) C compiler
+# Can our C compiler environment build XS files
+sub can_xs {
+       my $self = shift;
+
+       # Ensure we have the CBuilder module
+       $self->configure_requires( 'ExtUtils::CBuilder' => 0.27 );
+
+       # Do we have the configure_requires checker?
+       local $@;
+       eval "require ExtUtils::CBuilder;";
+       if ( $@ ) {
+               # They don't obey configure_requires, so it is
+               # someone old and delicate. Try to avoid hurting
+               # them by falling back to an older simpler test.
+               return $self->can_cc();
+       }
+
+       # Do we have a working C compiler
+       my $builder = ExtUtils::CBuilder->new(
+               quiet => 1,
+       );
+       unless ( $builder->have_compiler ) {
+               # No working C compiler
+               return 0;
+       }
+
+       # Write a C file representative of what XS becomes
+       require File::Temp;
+       my ( $FH, $tmpfile ) = File::Temp::tempfile(
+               "compilexs-XXXXX",
+               SUFFIX => '.c',
+       );
+       binmode $FH;
+       print $FH <<'END_C';
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+
+int main(int argc, char **argv) {
+    return 0;
+}
+
+int boot_sanexs() {
+    return 1;
+}
+
+END_C
+       close $FH;
+
+       # Can the C compiler access the same headers XS does
+       my @libs   = ();
+       my $object = undef;
+       eval {
+               local $^W = 0;
+               $object = $builder->compile(
+                       source => $tmpfile,
+               );
+               @libs = $builder->link(
+                       objects     => $object,
+                       module_name => 'sanexs',
+               );
+       };
+       my $result = $@ ? 0 : 1;
+
+       # Clean up all the build files
+       foreach ( $tmpfile, $object, @libs ) {
+               next unless defined $_;
+               1 while unlink;
+       }
+
+       return $result;
+}
+
+# Can we locate a (the) C compiler
 sub can_cc {
        my $self   = shift;
        my @chunks = split(/ /, $Config::Config{cc}) or return;
@@ -78,4 +151,4 @@
 
 __END__
 
-#line 156
+#line 236
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/AnyEvent-I3-0.09/inc/Module/Install/Fetch.pm 
new/AnyEvent-I3-0.13/inc/Module/Install/Fetch.pm
--- old/AnyEvent-I3-0.09/inc/Module/Install/Fetch.pm    2011-10-20 
21:29:53.000000000 +0200
+++ new/AnyEvent-I3-0.13/inc/Module/Install/Fetch.pm    2012-08-05 
17:41:22.000000000 +0200
@@ -6,7 +6,7 @@
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-       $VERSION = '1.01';
+       $VERSION = '1.06';
        @ISA     = 'Module::Install::Base';
        $ISCORE  = 1;
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/AnyEvent-I3-0.09/inc/Module/Install/Makefile.pm 
new/AnyEvent-I3-0.13/inc/Module/Install/Makefile.pm
--- old/AnyEvent-I3-0.09/inc/Module/Install/Makefile.pm 2011-10-20 
21:29:53.000000000 +0200
+++ new/AnyEvent-I3-0.13/inc/Module/Install/Makefile.pm 2012-08-05 
17:41:22.000000000 +0200
@@ -8,7 +8,7 @@
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-       $VERSION = '1.01';
+       $VERSION = '1.06';
        @ISA     = 'Module::Install::Base';
        $ISCORE  = 1;
 }
@@ -215,18 +215,22 @@
        require ExtUtils::MakeMaker;
 
        if ( $perl_version and $self->_cmp($perl_version, '5.006') >= 0 ) {
-               # MakeMaker can complain about module versions that include
-               # an underscore, even though its own version may contain one!
-               # Hence the funny regexp to get rid of it.  See RT #35800
-               # for details.
-               my $v = $ExtUtils::MakeMaker::VERSION =~ /^(\d+\.\d+)/;
-               $self->build_requires(     'ExtUtils::MakeMaker' => $v );
-               $self->configure_requires( 'ExtUtils::MakeMaker' => $v );
+               # This previous attempted to inherit the version of
+               # ExtUtils::MakeMaker in use by the module author, but this
+               # was found to be untenable as some authors build releases
+               # using future dev versions of EU:MM that nobody else has.
+               # Instead, #toolchain suggests we use 6.59 which is the most
+               # stable version on CPAN at time of writing and is, to quote
+               # ribasushi, "not terminally fucked, > and tested enough".
+               # TODO: We will now need to maintain this over time to push
+               # the version up as new versions are released.
+               $self->build_requires(     'ExtUtils::MakeMaker' => 6.59 );
+               $self->configure_requires( 'ExtUtils::MakeMaker' => 6.59 );
        } else {
                # Allow legacy-compatibility with 5.005 by depending on the
                # most recent EU:MM that supported 5.005.
-               $self->build_requires(     'ExtUtils::MakeMaker' => 6.42 );
-               $self->configure_requires( 'ExtUtils::MakeMaker' => 6.42 );
+               $self->build_requires(     'ExtUtils::MakeMaker' => 6.36 );
+               $self->configure_requires( 'ExtUtils::MakeMaker' => 6.36 );
        }
 
        # Generate the MakeMaker params
@@ -241,7 +245,6 @@
 'all_from' if you prefer) in Makefile.PL.
 EOT
 
-       $DB::single = 1;
        if ( $self->tests ) {
                my @tests = split ' ', $self->tests;
                my %seen;
@@ -412,4 +415,4 @@
 
 __END__
 
-#line 541
+#line 544
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/AnyEvent-I3-0.09/inc/Module/Install/Metadata.pm 
new/AnyEvent-I3-0.13/inc/Module/Install/Metadata.pm
--- old/AnyEvent-I3-0.09/inc/Module/Install/Metadata.pm 2011-10-20 
21:29:53.000000000 +0200
+++ new/AnyEvent-I3-0.13/inc/Module/Install/Metadata.pm 2012-08-05 
17:41:22.000000000 +0200
@@ -6,7 +6,7 @@
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-       $VERSION = '1.01';
+       $VERSION = '1.06';
        @ISA     = 'Module::Install::Base';
        $ISCORE  = 1;
 }
@@ -151,15 +151,21 @@
 sub install_as_vendor { $_[0]->installdirs('vendor') }
 
 sub dynamic_config {
-       my $self = shift;
-       unless ( @_ ) {
-               warn "You MUST provide an explicit true/false value to 
dynamic_config\n";
-               return $self;
+       my $self  = shift;
+       my $value = @_ ? shift : 1;
+       if ( $self->{values}->{dynamic_config} ) {
+               # Once dynamic we never change to static, for safety
+               return 0;
        }
-       $self->{values}->{dynamic_config} = $_[0] ? 1 : 0;
+       $self->{values}->{dynamic_config} = $value ? 1 : 0;
        return 1;
 }
 
+# Convenience command
+sub static_config {
+       shift->dynamic_config(0);
+}
+
 sub perl_version {
        my $self = shift;
        return $self->{values}->{perl_version} unless @_;
@@ -170,7 +176,7 @@
        # Normalize the version
        $version = $self->_perl_version($version);
 
-       # We don't support the reall old versions
+       # We don't support the really old versions
        unless ( $version >= 5.005 ) {
                die "Module::Install only supports 5.005 or newer (use 
ExtUtils::MakeMaker)\n";
        }
@@ -582,7 +588,7 @@
 sub requires_from {
        my $self     = shift;
        my $content  = Module::Install::_readperl($_[0]);
-       my @requires = $content =~ 
m/^use\s+([^\W\d]\w*(?:::\w+)*)\s+([\d\.]+)/mg;
+       my @requires = $content =~ 
m/^use\s+([^\W\d]\w*(?:::\w+)*)\s+(v?[\d\.]+)/mg;
        while ( @requires ) {
                my $module  = shift @requires;
                my $version = shift @requires;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/AnyEvent-I3-0.09/inc/Module/Install/Win32.pm 
new/AnyEvent-I3-0.13/inc/Module/Install/Win32.pm
--- old/AnyEvent-I3-0.09/inc/Module/Install/Win32.pm    2011-10-20 
21:29:53.000000000 +0200
+++ new/AnyEvent-I3-0.13/inc/Module/Install/Win32.pm    2012-08-05 
17:41:22.000000000 +0200
@@ -6,7 +6,7 @@
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-       $VERSION = '1.01';
+       $VERSION = '1.06';
        @ISA     = 'Module::Install::Base';
        $ISCORE  = 1;
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/AnyEvent-I3-0.09/inc/Module/Install/WriteAll.pm 
new/AnyEvent-I3-0.13/inc/Module/Install/WriteAll.pm
--- old/AnyEvent-I3-0.09/inc/Module/Install/WriteAll.pm 2011-10-20 
21:29:53.000000000 +0200
+++ new/AnyEvent-I3-0.13/inc/Module/Install/WriteAll.pm 2012-08-05 
17:41:22.000000000 +0200
@@ -6,7 +6,7 @@
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-       $VERSION = '1.01';
+       $VERSION = '1.06';
        @ISA     = qw{Module::Install::Base};
        $ISCORE  = 1;
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/AnyEvent-I3-0.09/inc/Module/Install.pm 
new/AnyEvent-I3-0.13/inc/Module/Install.pm
--- old/AnyEvent-I3-0.09/inc/Module/Install.pm  2011-10-20 21:29:53.000000000 
+0200
+++ new/AnyEvent-I3-0.13/inc/Module/Install.pm  2012-08-05 17:41:22.000000000 
+0200
@@ -31,7 +31,7 @@
        # This is not enforced yet, but will be some time in the next few
        # releases once we can make sure it won't clash with custom
        # Module::Install extensions.
-       $VERSION = '1.01';
+       $VERSION = '1.06';
 
        # Storage for the pseudo-singleton
        $MAIN    = undef;
@@ -451,7 +451,7 @@
 }
 
 sub _cmp ($$) {
-       _version($_[0]) <=> _version($_[1]);
+       _version($_[1]) <=> _version($_[2]);
 }
 
 # Cloned from Params::Util::_CLASS
@@ -467,4 +467,4 @@
 
 1;
 
-# Copyright 2008 - 2011 Adam Kennedy.
+# Copyright 2008 - 2012 Adam Kennedy.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/AnyEvent-I3-0.09/lib/AnyEvent/I3.pm 
new/AnyEvent-I3-0.13/lib/AnyEvent/I3.pm
--- old/AnyEvent-I3-0.09/lib/AnyEvent/I3.pm     2011-10-20 21:28:02.000000000 
+0200
+++ new/AnyEvent-I3-0.13/lib/AnyEvent/I3.pm     2012-08-05 17:31:48.000000000 
+0200
@@ -8,6 +8,7 @@
 use AnyEvent::Socket;
 use AnyEvent;
 use Encode;
+use Scalar::Util qw(tainted);
 
 =head1 NAME
 
@@ -15,11 +16,11 @@
 
 =cut
 
-our $VERSION = '0.09';
+our $VERSION = '0.13';
 
 =head1 VERSION
 
-Version 0.09
+Version 0.13
 
 =head1 SYNOPSIS
 
@@ -29,7 +30,7 @@
 
     use AnyEvent::I3 qw(:all);
 
-    my $i3 = i3("~/.i3/ipc.sock");
+    my $i3 = i3();
 
     $i3->connect->recv or die "Error connecting";
     say "Connected to i3";
@@ -44,12 +45,38 @@
     my $workspaces = i3->get_workspaces->recv;
     say "Currently, you use " . @{$workspaces} . " workspaces";
 
+A somewhat more involved example which dumps the i3 layout tree whenever there
+is a workspace event:
+
+    use Data::Dumper;
+    use AnyEvent;
+    use AnyEvent::I3;
+
+    my $i3 = i3();
+
+    $i3->connect->recv or die "Error connecting to i3";
+
+    $i3->subscribe({
+        workspace => sub {
+            $i3->get_tree->cb(sub {
+                my ($tree) = @_;
+                say "tree: " . Dumper($tree);
+            });
+        }
+    })->recv->{success} or die "Error subscribing to events";
+
+    AE::cv->recv
+
 =head1 EXPORT
 
 =head2 $i3 = i3([ $path ]);
 
-Creates a new C<AnyEvent::I3> object and returns it. C<path> is the path of
-the UNIX socket to connect to.
+Creates a new C<AnyEvent::I3> object and returns it.
+
+C<path> is an optional path of the UNIX socket to connect to. It is strongly
+advised to NOT specify this unless you're absolutely sure you need it.
+C<AnyEvent::I3> will automatically figure it out by querying the running i3
+instance on the current DISPLAY which is almost always what you want.
 
 =head1 SUBROUTINES/METHODS
 
@@ -67,10 +94,11 @@
 use constant TYPE_GET_TREE => 4;
 use constant TYPE_GET_MARKS => 5;
 use constant TYPE_GET_BAR_CONFIG => 6;
+use constant TYPE_GET_VERSION => 7;
 
 our %EXPORT_TAGS = ( 'all' => [
     qw(i3 TYPE_COMMAND TYPE_GET_WORKSPACES TYPE_SUBSCRIBE TYPE_GET_OUTPUTS
-       TYPE_GET_TREE TYPE_GET_MARKS TYPE_GET_BAR_CONFIG)
+       TYPE_GET_TREE TYPE_GET_MARKS TYPE_GET_BAR_CONFIG TYPE_GET_VERSION)
 ] );
 
 our @EXPORT_OK = ( @{ $EXPORT_TAGS{all} } );
@@ -89,15 +117,60 @@
     AnyEvent::I3->new(@_)
 }
 
+# Calls i3, even when running in taint mode.
+sub _call_i3 {
+    my ($args) = @_;
+
+    my $path_tainted = tainted($ENV{PATH});
+    # This effectively circumvents taint mode checking for $ENV{PATH}. We
+    # do this because users might specify PATH explicitly to call i3 in a
+    # custom location (think ~/.bin/).
+    (local $ENV{PATH}) = ($ENV{PATH} =~ /(.*)/);
+
+    # In taint mode, we also need to remove all relative directories from
+    # PATH (like . or ../bin). We only do this in taint mode and warn the
+    # user, since this might break a real-world use case for some people.
+    if ($path_tainted) {
+        my @dirs = split /:/, $ENV{PATH};
+        my @filtered = grep !/^\./, @dirs;
+        if (scalar @dirs != scalar @filtered) {
+            $ENV{PATH} = join ':', @filtered;
+            warn qq|Removed relative directories from PATH because you | .
+                 qq|are running Perl with taint mode enabled. Remove -T | .
+                 qq|to be able to use relative directories in PATH. | .
+                 qq|New PATH is "$ENV{PATH}"|;
+        }
+    }
+    # Otherwise the qx() operator wont work:
+    delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
+    chomp(my $result = qx(i3 $args));
+    # Circumventing taint mode again: the socket can be anywhere on the
+    # system and that’s okay.
+    if ($result =~ /^([^\0]+)$/) {
+        return $1;
+    }
+
+    warn "Calling i3 $args failed. Is DISPLAY set and is i3 in your PATH?";
+    return undef;
+}
+
 =head2 $i3 = AnyEvent::I3->new([ $path ])
 
-Creates a new C<AnyEvent::I3> object and returns it. C<path> is the path of
-the UNIX socket to connect to.
+Creates a new C<AnyEvent::I3> object and returns it.
+
+C<path> is an optional path of the UNIX socket to connect to. It is strongly
+advised to NOT specify this unless you're absolutely sure you need it.
+C<AnyEvent::I3> will automatically figure it out by querying the running i3
+instance on the current DISPLAY which is almost always what you want.
 
 =cut
 sub new {
     my ($class, $path) = @_;
 
+    $path = _call_i3('--get-socketpath') unless $path;
+
+    # This is the old default path (v3.*). This fallback line can be removed in
+    # a year from now. -- Michael, 2012-07-09
     $path ||= '~/.i3/ipc.sock';
 
     # Check if we need to resolve ~
@@ -146,6 +219,7 @@
                 for my $type (keys %{$cb}) {
                     next if ($type & $event_mask) == $event_mask;
                     $cb->{$type}->();
+                    delete $cb->{$type};
                 }
 
                 # Trigger _error callback, if set
@@ -291,7 +365,7 @@
 
     return if defined($self->{ipchdl});
 
-    $self->connect->recv or die "Unable to connect to i3"
+    $self->connect->recv or die "Unable to connect to i3 (socket path " . 
$self->{path} . ")";
 }
 
 =head2 get_workspaces
@@ -374,6 +448,54 @@
     $self->message(TYPE_GET_BAR_CONFIG, $id)
 }
 
+=head2 get_version
+
+Gets the i3 version via IPC, with a fall-back that parses the output of i3
+--version (for i3 < v4.3).
+
+    my $version = i3->get_version()->recv;
+    say "major: " . $version->{major} . ", minor = " . $version->{minor};
+
+=cut
+sub get_version {
+    my ($self) = @_;
+
+    $self->_ensure_connection;
+
+    my $cv = AnyEvent->condvar;
+
+    my $version_cv = $self->message(TYPE_GET_VERSION);
+    my $timeout;
+    $timeout = AnyEvent->timer(
+        after => 1,
+        cb => sub {
+            warn "Falling back to i3 --version since the running i3 doesn’t 
support GET_VERSION yet.";
+            my $version = _call_i3('--version');
+            $version =~ s/^i3 version //;
+            my $patch = 0;
+            my ($major, $minor) = ($version =~ /^([0-9]+)\.([0-9]+)/);
+            if ($version =~ /^[0-9]+\.[0-9]+\.([0-9]+)/) {
+                $patch = $1;
+            }
+            # Strip everything from the © sign on.
+            $version =~ s/ ©.*$//g;
+            $cv->send({
+                major => int($major),
+                minor => int($minor),
+                patch => int($patch),
+                human_readable => $version,
+            });
+            undef $timeout;
+        },
+    );
+    $version_cv->cb(sub {
+        undef $timeout;
+        $cv->send($version_cv->recv);
+    });
+
+    return $cv;
+}
+
 =head2 command($content)
 
 Makes i3 execute the given command
@@ -392,7 +514,7 @@
 
 =head1 AUTHOR
 
-Michael Stapelberg, C<< <michael at stapelberg.de> >>
+Michael Stapelberg, C<< <michael at i3wm.org> >>
 
 =head1 BUGS
 
@@ -418,7 +540,7 @@
 
 =item * The i3 window manager website
 
-L<http://i3.zekjur.net/>
+L<http://i3wm.org>
 
 =back
 
@@ -428,7 +550,7 @@
 
 =head1 LICENSE AND COPYRIGHT
 
-Copyright 2010 Michael Stapelberg.
+Copyright 2010-2012 Michael Stapelberg.
 
 This program is free software; you can redistribute it and/or modify it
 under the terms of either: the GNU General Public License as published

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to