Permalink
Browse files

Released version 0.12

  • Loading branch information...
1 parent 8911edc commit 13098735b5d658bf8d962d90d0d8cd013d083850 @ingydotnet committed Sep 9, 2011
Showing with 124 additions and 46 deletions.
  1. +6 −0 Changes
  2. +3 −0 Makefile.PL
  3. +49 −7 README
  4. +9 −10 lib/Mo.pm
  5. +51 −9 lib/Mo.pod
  6. +6 −0 t/strict.t
  7. +0 −20 t/use_ok.t
View
@@ -1,4 +1,10 @@
---
+version: 0.12
+date: Fri Sep 9 07:52:13 CEST 2011
+changes:
+- dams++ golfing
+- Upgrade docs
+---
version: 0.11
date: Thu Sep 8 15:36:35 CEST 2011
changes:
View
@@ -1 +1,4 @@
use inc::Module::Package 'Ingy:modern 0.15';
+
+# Inline this to keep Mo.pm minimal:
+perl_version '5.006';
View
@@ -1,18 +1,60 @@
NAME
- Mo - Micro Objects
+ Mo - Micro Objects. Mo is less.
SYNOPSIS
- package Reaper;
- use Mo 'Cow Bell';
- extends 'SNL';
+ package Less;
+ use Mo;
+ extends 'Nothing';
- has noise => (is =>'ro');
+ has 'something' => ( is => 'rw' );
+
+ sub BUILD {
+ my $self = shift;
+ $self->SUPER::BUILD();
+ # ...
+ }
DESCRIPTION
- Moose led to Mouse led to Moo led to Mo. M, anyone?
+ use Mo. Mo is less.
+
+ Moose led to Mouse led to Moo led to Mo. M is nothing. Mo is more. Not
+ much.
+
+ When Moo is more than you need, drop an 'o' and get some Mo.
+
+FEATURES
+ This is what you get. Nothing Mo.
+
+ "new" method
+ Mo provides a "new" object constructor. It will call the "BUILD"
+ method after creation if it "can".
+
+ "extends"
+ Mo exports the "extends" keyword, to name your parent class. "Mo"
+ itself is your default parent class, of course.
+
+ "has"
+ Mo exports a "has" keyword, to generate accessors.
-AUTHOR
+ These accessors support "get" and "set" operations. That's it.
+
+ Any extra arguments after the name, are silently ignored.
+
+ has 'name';
+ has 'same' => ( is => 'ro' );
+
+ This lets you switch from Moo to Mo and back, without having to
+ change all your accessors.
+
+ "strict" and "warnings"
+ Mo turns on "use strict" and "use warnings".
+
+ Embeddable
+ Mo is tiny. You can easily inline it in your code, if you want to.
+
+AUTHORS
Ingy döt Net <ingy@cpan.org>
+
Damien 'dams' Krotkine <dams@cpan.org>
COPYRIGHT AND LICENSE
View
@@ -1,17 +1,16 @@
package Mo;
-
-our $VERSION = '0.11';
-
+require strict; require warnings;
+our $VERSION = '0.12';
sub import {
+ strict->import; warnings->import;
my $p = caller;
- *{$p.'::extends'} = sub { @{caller.'::ISA'} = $_[0] };
+ @{$p.'::ISA'} = $_[0];
+ *{$p.'::extends'} = sub { @{(caller).'::ISA'} = $_[0] };
*{$p.'::has'} = sub {
my $n = $_[0];
- *{caller."::$n"} = sub { @_-1 ? $_[0]->{$n} = $_[1] : $_[0]->{$n} };
+ *{(caller)."::$n"} = sub { @_-1 ? $_[0]->{$n} = $_[1] : $_[0]->{$n} };
};
- push @{$p.'::ISA'}, $_[0];
}
-
-sub new { my $s = bless { @_[1..$#_] }, $_[0]; $s->can('BUILD') && $s->BUILD; $s }
-
-1;
+sub new {
+ my $s = bless { @_[1..$#_] }, $_[0]; $s->can('BUILD') && $s->BUILD; $s
+}
View
@@ -2,31 +2,73 @@
=head1 NAME
-Mo - Micro Objects
+Mo - Micro Objects. Mo is less.
=head1 SYNOPSIS
- package Reaper;
- use Mo 'Cow Bell';
- extends 'SNL';
+ package Less;
+ use Mo;
+ extends 'Nothing';
- has noise;
+ has 'something' => ( is => 'rw' );
sub BUILD {
my $self = shift;
$self->SUPER::BUILD();
# ...
- }
+ }
=head1 DESCRIPTION
-Moose led to Mouse led to Moo led to Mo. M, anyone?
+use Mo. Mo is less.
-This is a minimalistic object oriented sugar.
+Moose led to Mouse led to Moo led to Mo. M is nothing. Mo is more. Not much.
-=head1 AUTHOR
+When Moo is more than you need, drop an 'o' and get some Mo.
+
+=head1 FEATURES
+
+This is what you get. Nothing Mo.
+
+=over
+
+=item C<new> method
+
+Mo provides a C<new> object constructor. It will call the C<BUILD> method after creation if it C<can>.
+
+=item C<extends>
+
+Mo exports the C<extends> keyword, to name your parent class. C<Mo> itself is
+your default parent class, of course.
+
+=item C<has>
+
+Mo exports a C<has> keyword, to generate accessors.
+
+These accessors support C<get> and C<set> operations. That's it.
+
+Any extra arguments after the name, are silently ignored.
+
+ has 'name';
+ has 'same' => ( is => 'ro' );
+
+This lets you switch from Moo to Mo and back, without having to change all
+your accessors.
+
+=item C<strict> and C<warnings>
+
+Mo turns on C<use strict> and C<use warnings>.
+
+=item Embeddable
+
+Mo is tiny. You can easily inline it in your code, if you want to.
+
+=back
+
+=head1 AUTHORS
Ingy döt Net <ingy@cpan.org>
+
Damien 'dams' Krotkine <dams@cpan.org>
=head1 COPYRIGHT AND LICENSE
View
@@ -0,0 +1,6 @@
+use Test::More tests => 1;
+
+eval 'package Foo; use Mo; $x = 1';
+
+like $@, qr/Global symbol "\$x" requires explicit package name/,
+ 'Mo is strict';
View
@@ -1,20 +0,0 @@
-use Test::More;
-use File::Find;
-
-my %skip = map {($_, 1)} qw{};
-
-my @modules = ();
-File::Find::find(sub {
- return unless -f $_ and $_ =~ /\.pm$/;
- my $module = $File::Find::name;
- $module =~ s!lib[\/\\](.*)\.pm$!$1!;
- $module =~ s!/+!::!g;
- return if $skip{$module};
- push @modules, $module;
-}, 'lib');
-
-plan tests => scalar(@modules);
-
-for my $module (sort @modules) {
- use_ok $module;
-}

0 comments on commit 1309873

Please sign in to comment.