Skip to content

Commit

Permalink
where applicable the Mo package also comes with double-colons
Browse files Browse the repository at this point in the history
  • Loading branch information
wchristian committed Sep 26, 2011
1 parent 81b1988 commit 13d8d8c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion lib/Mo.pm
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package Mo;
$VERSION=0.24;
no warnings;my$K=__PACKAGE__;*{$K.'::Object::new'}=sub{my$c=shift;my$s=bless{@_},$c;my@B;do{@B=($c.'::BUILD',@B)}while($c)=@{$c.'::ISA'};exists&$_&&&$_($s)for@B;$s};*{$K.'::import'}=sub{import warnings;$^H|=1538;my$P=caller."::";my%e=(extends=>sub{eval"no $_[0]()";@{$P.'ISA'}=$_[0]},has=>sub{my$n=shift;*{$P.$n}=sub{$#_?$_[0]{$n}=$_[1]:$_[0]{$n}}},);for(@_[1..$#_]){eval"require Mo::$_;1";%e=&{$K."::${_}::e"}($P=>%e)}*{$P.$_}=$e{$_}for keys%e;@{$P.'ISA'}=$K.'::Object'};
no warnings;my$K=__PACKAGE__."::";*{$K.'Object::new'}=sub{my$c=shift;my$s=bless{@_},$c;my@B;do{@B=($c.'::BUILD',@B)}while($c)=@{$c.'::ISA'};exists&$_&&&$_($s)for@B;$s};*{$K.'import'}=sub{import warnings;$^H|=1538;my$P=caller."::";my%e=(extends=>sub{eval"no $_[0]()";@{$P.'ISA'}=$_[0]},has=>sub{my$n=shift;*{$P.$n}=sub{$#_?$_[0]{$n}=$_[1]:$_[0]{$n}}},);for(@_[1..$#_]){eval"require Mo::$_;1";%e=&{$K."${_}::e"}($P=>%e)}*{$P.$_}=$e{$_}for keys%e;@{$P.'ISA'}=$K.'Object'};
4 changes: 2 additions & 2 deletions lib/Mo/has.pm
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package Mo::has;;package Mo;$K=__PACKAGE__;use Mo::default;use Mo::builder;
package Mo::has;;package Mo;$K=__PACKAGE__."::";use Mo::default;use Mo::builder;
$VERSION=0.24;
*{$K.'::has::e'}=sub{my$P=shift;&{$K.'::builder::e'}($P,&{$K.'::default::e'}($P,@_))};
*{$K.'has::e'}=sub{my$P=shift;&{$K.'builder::e'}($P,&{$K.'default::e'}($P,@_))};
10 changes: 5 additions & 5 deletions src/Mo.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package Mo;
$VERSION = 0.24;

no warnings;
my $MoPKG = __PACKAGE__;
my $MoPKG = __PACKAGE__."::";

*{$MoPKG.'::Object::new'} = sub {
*{$MoPKG.'Object::new'} = sub {
my $class = shift;
my $self = bless {@_}, $class;
my @build_subs;
Expand All @@ -19,7 +19,7 @@ my $MoPKG = __PACKAGE__;
$self;
};

*{$MoPKG.'::import'} = sub {
*{$MoPKG.'import'} = sub {
import warnings;
$^H |= 1538;
my $caller_pkg = caller."::";
Expand All @@ -40,8 +40,8 @@ my $MoPKG = __PACKAGE__;
);
for (@_[1..$#_]) {
eval "require Mo::$_;1";
%exports = &{$MoPKG."::${_}::e"}($caller_pkg => %exports);
%exports = &{$MoPKG."${_}::e"}($caller_pkg => %exports);
}
*{ $caller_pkg . $_} = $exports{$_} for keys %exports;
@{ $caller_pkg . 'ISA' } = $MoPKG.'::Object';
@{ $caller_pkg . 'ISA' } = $MoPKG.'Object';
};
8 changes: 4 additions & 4 deletions src/Mo/has.pm
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package Mo::has;;package Mo;$MoPKG = __PACKAGE__;
package Mo::has;;package Mo;$MoPKG = __PACKAGE__."::";
use Mo::default;
use Mo::builder;
$VERSION = 0.24;

*{$MoPKG.'::has::e'} = sub {
*{$MoPKG.'has::e'} = sub {
my $caller_pkg = shift;
&{$MoPKG.'::builder::e'}($caller_pkg,
&{$MoPKG.'::default::e'}($caller_pkg, @_));
&{$MoPKG.'builder::e'}($caller_pkg,
&{$MoPKG.'default::e'}($caller_pkg, @_));
};

0 comments on commit 13d8d8c

Please sign in to comment.