Skip to content

Commit

Permalink
Released version 0.16
Browse files Browse the repository at this point in the history
  • Loading branch information
ingydotnet committed Sep 10, 2011
1 parent 6859ca3 commit c47bc8a
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 4 deletions.
5 changes: 5 additions & 0 deletions Changes
@@ -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:
Expand Down
4 changes: 2 additions & 2 deletions lib/Mo.pm
@@ -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])) } :
Expand Down
2 changes: 1 addition & 1 deletion t/Bar.pm
@@ -1,4 +1,4 @@
package Bar;
use Mo;
extends 'Foo';
extends 'Foo', 'Boo';
1;
6 changes: 6 additions & 0 deletions t/Boo.pm
@@ -0,0 +1,6 @@
package Boo;
use Mo;

has 'buff';

1;
2 changes: 2 additions & 0 deletions t/Foo.pm
@@ -1,4 +1,6 @@
package Foo;
use Mo;

has 'stuff';

1;
7 changes: 6 additions & 1 deletion t/extends.t
@@ -1,8 +1,13 @@
use Test::More tests => 1;
use Test::More tests => 4;

use lib 't';
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';

0 comments on commit c47bc8a

Please sign in to comment.