Permalink
Browse files

first implementation

  • Loading branch information...
1 parent c19bb31 commit e445bdc56b57dbee32b69e57a6467b1147437ade @dams committed Sep 15, 2011
Showing with 141 additions and 0 deletions.
  1. +13 −0 .gitignore
  2. +2 −0 Changes
  3. 0 README
  4. +66 −0 dist.ini
  5. +53 −0 lib/o.pm
  6. +7 −0 t/basic.t
View
@@ -0,0 +1,13 @@
+_build
+.build
+o-*
+cover_db
+*~
+*#
+*.bak
+*.old
+*.rej
+*.swp
+*.tmp
+
+
View
@@ -0,0 +1,2 @@
+{{$NEXT}}
+ . First implementation.
View
0 README
No changes.
View
@@ -0,0 +1,66 @@
+name = o
+author = Damien "dams" Krotkine
+license = Perl_5
+copyright_holder = Damien "dams" Krotkine
+copyright_year = 2011
+
+main_module = lib/o.pm
+
+; -- static meta-information
+[MetaResources]
+homepage = http://search.cpan.org/dist/o
+repository = http://github.com/dams/o-pm
+
+; -- fetch & generate files
+[GatherDir]
+
+; -- tests
+[CompileTests]
+;[CriticTests]
+[MetaTests]
+;[PodCoverageTests]
+[ExtraTests]
+
+; -- remove files
+[PruneCruft]
+[ManifestSkip]
+
+; -- get prereqs
+[AutoPrereqs]
+
+[Prereqs]
+[Prereqs / TestRequires]
+
+; -- munge files
+[NextRelease]
+[PkgVersion]
+[PodWeaver]
+[Prepender]
+copyright = 1
+
+; -- dynamic meta information
+; [InstallDirs]
+[MetaProvides::Package]
+
+
+; -- generate meta files
+[License]
+[MakeMaker]
+;[ModuleBuild]
+[MetaYAML]
+[Readme]
+[Manifest] ; should come last
+
+; -- release
+[CheckChangeLog]
+[Git::NextVersion]
+first_version = 0.100
+[Git::Tag]
+[Git::Check]
+[Git::Commit]
+[UploadToCPAN]
+[Git::Push]
+[Twitter]
+hash-tags = #perl #mo #object #cpan #release
+tweet_url = http://search.cpan.org/search?query={{$DIST}}&mode=all
+tweet = Just released {{$DIST}}-{{$VERSION}} on CPAN : {{$URL}}
View
@@ -0,0 +1,53 @@
+package o;
+
+# ABSTRACT: syntactic sugar to make Mo one-liners easier
+
+use strict;
+use warnings;
+
+BEGIN {
+ my $package;
+ sub import {
+ $package = $_[1] || 'Class';
+ }
+ use Filter::Simple sub { s/^/package $package;\nuse Mo;\n/; }
+}
+
+1;
+
+=head1 SYNOPSIS
+
+ # create a Mo class on the fly ...
+ perl -Mo=Foo -e 'has bar => ( default => sub { q[baz] } ); print Foo->new->bar' # prints baz
+
+=head1 DESCRIPTION
+
+o.pm is a simple source filter that adds
+C<package $name; use Mo;>
+to the beginning of your script and was entirely created because typing
+C<perl -e'package Foo; use Mo; ...'> is annoying.
+
+=head1 INTERFACE
+
+o provides exactly one method and it's automatically called by perl:
+
+=over 4
+
+=item B<import($package)>
+
+Pass a package name to import to be used by the source filter. The
+package defaults to C<Class> if none is given.
+
+=back
+
+=head1 DEPENDENCIES
+
+You will need L<Filter::Simple> and eventually L<Mo>
+
+=head1 INCOMPATIBILITIES
+
+None reported. But it is a source filter and might have issues there.
+
+=head1 BUGS
+
+See L<Mo/BUGS> for details on reporting bugs.
View
@@ -0,0 +1,7 @@
+use Test::More;
+
+plan tests => 1;
+
+is(`$^X -Mo=Foo -e 'has bar => ( default => sub { q[baz] } ); print Foo->new->bar'`,
+ 'baz');
+

0 comments on commit e445bdc

Please sign in to comment.