This is an automated email from the git hooks/post-receive script.

abe pushed a commit to tag alt-io-all-new-0.00
in repository libio-all-perl.

commit a8d1dfd8bb2d673196ff5733550ecf8c2a428ad4
Author: Ingy döt Net <i...@ingy.net>
Date:   Mon Jul 16 00:07:33 2012 -0700

    latest changes.
---
 lib/Alt/IO/All/new.pm |  7 +++---
 lib/IO/All.pm         | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++
 lib/IO/All/OO.pm      | 19 ++++++++++++++++
 lib/IO/All/Plugin.pm  | 11 ++++++++++
 t/usage.t             | 35 +++++++++++++++++++++++++++++
 t/use.t               |  7 ++++++
 6 files changed, 137 insertions(+), 3 deletions(-)

diff --git a/lib/Alt/IO/All/new.pm b/lib/Alt/IO/All/new.pm
index 855df2c..63736e7 100644
--- a/lib/Alt/IO/All/new.pm
+++ b/lib/Alt/IO/All/new.pm
@@ -61,7 +61,7 @@ move the current API forward to the new API.
     * IO::All needs to be completely and consistently extensible
       * The extensions that ship with IO-All should be the same as third party
         extensions
-      * Extensions register capabilities with IO::All (tied to a scope)
+      * Plugins register capabilities with IO::All (tied to a scope)
     * IO::All operations can be strict or loose. Strict always throws errors on
       any possible error condition. Strict or loose should be determined by the
       presence of `use strict` in the scope (possibly).
@@ -69,7 +69,7 @@ move the current API forward to the new API.
       is loved by some and hated by others. It should probably be off by 
default
       for 2.0.
 
-=head1 IO::All Extensions
+=head1 IO::All Plugins
 
 Currently the extension API is fairly muddy. I would like the new API to
 require something like this:
@@ -91,11 +91,12 @@ automatically loaded, unless you say:
 
     use IO::All -none;
 
-Extensions can register 2 things:
+Plugins can register 2 things:
 
     1. Register a method (or methods) that will force a rebless in that class.
     2. Register a regexp (or function) that will cause a rebless when the input
        to io(...) matches.
+    3. Register overloads that the plugin responds to.
 
 These things are register according to the scope of the IO::All, so that the
 `io` function will do the right things.
diff --git a/lib/IO/All.pm b/lib/IO/All.pm
new file mode 100644
index 0000000..e337d2d
--- /dev/null
+++ b/lib/IO/All.pm
@@ -0,0 +1,61 @@
+##
+# name:      IO::All
+# author:    Ingy döt Net
+# abstract:  I Owe All of it to Graham and Damian!
+# license:   perl
+# copyright: 2004, 2006, 2008, 2010, 2012
+
+package IO::All;
+use IO::All::OO;
+use strict;
+
+our $VERSION = 0.44;
+
+use XXX;
+
+use constant registry => {};
+
+has plugins => (
+    default => sub {
+        [qw(
+            IO::All::File
+            IO::All::Dir
+        )];
+    }
+);
+
+my $arg_key_pattern = qr/^-(\w+)$/;
+sub import {
+    my $class = shift;
+    my $args = [];
+    my $insert;
+    while (@_) {
+        my $key = shift(@_);
+        die "Unknown argument '$key' for $class usage"
+            unless $key =~ $arg_key_pattern;
+        my $arg = [$1];
+        while (@_ and $_[0] !~ $arg_key_pattern) {
+            push @$arg, shift(@_);
+        }
+        push @$args, $arg;
+    }
+    my $caller = caller;
+    no strict 'refs';
+    *{"${caller}::io"} = $class->make_constructor($args);
+}
+
+sub make_constructor {
+    my ($class, $args) = @_;
+    return sub {
+        $class->new(%$args);
+    };
+}
+
+sub new {
+    my ($class, $object, $args) = @_;
+}
+
+sub BUILD {
+}
+
+1;
diff --git a/lib/IO/All/OO.pm b/lib/IO/All/OO.pm
new file mode 100644
index 0000000..fdcd1e9
--- /dev/null
+++ b/lib/IO/All/OO.pm
@@ -0,0 +1,19 @@
+##
+# name:      IO::All::OO
+# author:    Ingy döt Net
+# abstract:  IO::All OO Base Class
+# license:   perl
+# copyright: 2012
+
+package IO::All::OO;
+
+# use Mo qw'default build import exporter';
+#   The following line of code was produced from the previous line by
+#   Mo::Inline version 0.31
+no 
warnings;my$M=__PACKAGE__.'::';*{$M.Object::new}=sub{bless{@_[1..$#_]},$_[0]};*{$M.import}=sub{import
 warnings;$^H|=1538;my($P,%e,%o)=caller.'::';shift;eval"no 
Mo::$_",&{$M.$_.::e}($P,\%e,\%o,\@_)for@_;return 
if$e{M};%e=(extends,sub{eval"no 
$_[0]()";@{$P.ISA}=$_[0]},has,sub{my$n=shift;my$m=sub{$#_?$_[0]{$n}=$_[1]:$_[0]{$n}};$m=$o{$_}->($m,$n,@_)for
 sort keys%o;*{$P.$n}=$m},%e,);*{$P.$_}=$e{$_}for 
keys%e;@{$P.ISA}=$M.Object};*{$M.'default::e'}=sub{my($P,$e,$o)=@_;$o->{default}=sub{my($
 [...]
+
+sub chain {
+    die 42;
+}
+
+1;
diff --git a/lib/IO/All/Plugin.pm b/lib/IO/All/Plugin.pm
new file mode 100644
index 0000000..397bbd4
--- /dev/null
+++ b/lib/IO/All/Plugin.pm
@@ -0,0 +1,11 @@
+##
+# name:      IO::All::Plugin
+# author:    Ingy döt Net
+# abstract:  Base Class for IO::All Plugins
+# license:   perl
+# copyright: 2012
+
+package IO::All::Plugin;
+use IO::All::Mo;
+
+1;
diff --git a/t/usage.t b/t/usage.t
new file mode 100644
index 0000000..4d8ba32
--- /dev/null
+++ b/t/usage.t
@@ -0,0 +1,35 @@
+use TestML -run;
+
+
+__END__
+
+*perl.eval.manifest == *with;
+
+=== No plugin modules asked for
+--- perl
+package Foo;
+use IO::All;
+--- with
+Foo
+IO::All::File
+IO::All::Dir
+
+=== Declare plugins to work with
+--- perl
+package Bar;
+use IO::All with => [qw'File Socket'];
+--- with
+Bar
+IO::All::File
+IO::All::Socket
+
+=== Declare plugins in reverse order
+--- perl
+package Baz;
+use IO::All with => [qw'Socket File'];
+--- with
+Baz
+IO::All::Socket
+IO::All::File
+
+
diff --git a/t/use.t b/t/use.t
new file mode 100644
index 0000000..b5a3997
--- /dev/null
+++ b/t/use.t
@@ -0,0 +1,7 @@
+use Test::More tests => 1;
+
+use IO::All -with => qw(Foo Bar), -strict, -overload => 0;
+
+use XXX;
+
+XXX io('foo', 0);

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libio-all-perl.git

_______________________________________________
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits

Reply via email to