Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Damien Krotkine
committed
Sep 15, 2011
1 parent
c19bb31
commit e445bdc
Showing
6 changed files
with
141 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
_build | ||
.build | ||
o-* | ||
cover_db | ||
*~ | ||
*# | ||
*.bak | ||
*.old | ||
*.rej | ||
*.swp | ||
*.tmp | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{{$NEXT}} | ||
. First implementation. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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'); | ||
|