Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Released version 0.16

  • Loading branch information...
commit c47bc8a426408cd76eae236aa0f98597d9623fbd 1 parent 6859ca3
Ingy döt Net authored
5 Changes
View
@@ -1,4 +1,9 @@
---
+version: 0.16
+date: Sun Sep 11 01:31:30 CEST 2011
+changes:
+- extends can handle multiple parents
+---
version: 0.15
date: Sat Sep 10 23:40:23 CEST 2011
changes:
4 lib/Mo.pm
View
@@ -1,6 +1,6 @@
-package Mo; require strict; require warnings; $Mo::VERSION = '0.15';
+package Mo; require strict; require warnings; $Mo::VERSION = '0.16';
sub import {strict->import;warnings->import;my $p=caller;@{$p.'::ISA'}=$_[0];
- *{$p.'::extends'} = sub {@{(caller).'::ISA'} = $_[0]; eval "require $_[0]"};
+ *{$p.'::extends'} = sub {@{(caller).'::ISA'}=@_;eval "require $_" for @_};
*{$p.'::has'} = sub { my ($n, %a) = @_; my($d,$b)=@a{qw(default builder)};
*{(caller)."::$n"} = $d ? sub { $#_ ? ($_[0]{$n} = $_[1]) : (exists $_[0]{$n})
? $_[0]{$n} : ($_[0]{$n} = $d->($_[0])) } :
2  t/Bar.pm
View
@@ -1,4 +1,4 @@
package Bar;
use Mo;
-extends 'Foo';
+extends 'Foo', 'Boo';
1;
6 t/Boo.pm
View
@@ -0,0 +1,6 @@
+package Boo;
+use Mo;
+
+has 'buff';
+
+1;
2  t/Foo.pm
View
@@ -1,4 +1,6 @@
package Foo;
use Mo;
+has 'stuff';
+
1;
7 t/extends.t
View
@@ -1,4 +1,4 @@
-use Test::More tests => 1;
+use Test::More tests => 4;
use lib 't';
use Bar;
@@ -6,3 +6,8 @@ use Bar;
my $b = Bar->new;
ok $b->isa('Foo'), 'Bar is a subclass of Foo';
+
+is "@Bar::ISA", "Foo Boo", 'Extends adds multiple classes';
+
+ok 'Foo'->can('stuff'), 'Foo is loaded';
+ok 'Bar'->can('buff'), 'Boo is loaded';
Please sign in to comment.
Something went wrong with that request. Please try again.