r48814 - in /trunk/libany-moose-perl: ./ debian/ lib/Any/ t/
jawnsy-guest at users.alioth.debian.org
jawnsy-guest at users.alioth.debian.org
Wed Dec 16 01:16:10 UTC 2009
Author: jawnsy-guest
Date: Wed Dec 16 01:16:05 2009
New Revision: 48814
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=48814
Log:
* New upstream release
* Rewrite control description
* Standards-Version 3.8.3 (no changes)
* Add myself to Uploaders and Copyright
Added:
trunk/libany-moose-perl/t/012-use_moose_util.t
- copied unchanged from r48813, branches/upstream/libany-moose-perl/current/t/012-use_moose_util.t
trunk/libany-moose-perl/t/012-use_mouse_util.t
- copied unchanged from r48813, branches/upstream/libany-moose-perl/current/t/012-use_mouse_util.t
trunk/libany-moose-perl/t/101-localize-errvar.t
- copied unchanged from r48813, branches/upstream/libany-moose-perl/current/t/101-localize-errvar.t
trunk/libany-moose-perl/t/release-pod-coverage.t
- copied unchanged from r48813, branches/upstream/libany-moose-perl/current/t/release-pod-coverage.t
trunk/libany-moose-perl/t/release-pod-syntax.t
- copied unchanged from r48813, branches/upstream/libany-moose-perl/current/t/release-pod-syntax.t
Modified:
trunk/libany-moose-perl/Changes
trunk/libany-moose-perl/MANIFEST
trunk/libany-moose-perl/META.yml
trunk/libany-moose-perl/Makefile.PL
trunk/libany-moose-perl/README
trunk/libany-moose-perl/debian/changelog
trunk/libany-moose-perl/debian/control
trunk/libany-moose-perl/debian/copyright
trunk/libany-moose-perl/dist.ini
trunk/libany-moose-perl/lib/Any/Moose.pm
trunk/libany-moose-perl/t/001-basic-moose.t
trunk/libany-moose-perl/t/002-other-modules-mouse.t
trunk/libany-moose-perl/t/003-is_moose_loaded.t
trunk/libany-moose-perl/t/005-is_class_loaded-mouse.t
trunk/libany-moose-perl/t/010-use_mouse_roles.t
Modified: trunk/libany-moose-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libany-moose-perl/Changes?rev=48814&op=diff
==============================================================================
--- trunk/libany-moose-perl/Changes (original)
+++ trunk/libany-moose-perl/Changes Wed Dec 16 01:16:05 2009
@@ -1,3 +1,11 @@
+0.11 Sun 19 Dec 2009
+ * Support "use Any::Moose '::Util::TypeConstraints'" (gfx)
+ * Support "no Any::Moose '::Util::TypeConstraints'" (gfx)
+ * $@ related fixes (gfx)
+ * Documentation and other minor improvements (gfx)
+ * Any::Moose should now work when you have Moose but not Mouse. Still need to
+ work out how to encode this in the installation system (Sartak)
+
0.10 Fri 19 Jun 2009
* Fix META.yml
Modified: trunk/libany-moose-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libany-moose-perl/MANIFEST?rev=48814&op=diff
==============================================================================
--- trunk/libany-moose-perl/MANIFEST (original)
+++ trunk/libany-moose-perl/MANIFEST Wed Dec 16 01:16:05 2009
@@ -17,5 +17,10 @@
t/005-is_class_loaded-mouse.t
t/010-use_mouse_roles.t
t/011-use_moose_roles.t
+t/012-use_moose_util.t
+t/012-use_mouse_util.t
t/020-strict.t
-t/100-canonicalize-fragments.t
+t/100-canonicalize-fragments.t
+t/101-localize-errvar.t
+t/release-pod-coverage.t
+t/release-pod-syntax.t
Modified: trunk/libany-moose-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libany-moose-perl/META.yml?rev=48814&op=diff
==============================================================================
--- trunk/libany-moose-perl/META.yml (original)
+++ trunk/libany-moose-perl/META.yml Wed Dec 16 01:16:05 2009
@@ -5,12 +5,14 @@
- 'Florian Ragwitz <rafl at debian.org>'
- 'Stevan Little <stevan at iinteractive.com>'
- 'Tokuhiro Matsuno <tokuhirom at gmail.com>'
-generated_by: 'Dist::Zilla::Plugin::MetaYAML version 1.091480'
+ - 'Goro Fuji <gfuji at cpan.org>'
+generated_by: 'Dist::Zilla version 1.093400'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: 1.4
name: Any-Moose
requires:
- Mouse: 0.21
-version: 0.10
+ Mouse: 0.40
+ perl: 5.006_002
+version: 0.11
Modified: trunk/libany-moose-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libany-moose-perl/Makefile.PL?rev=48814&op=diff
==============================================================================
--- trunk/libany-moose-perl/Makefile.PL (original)
+++ trunk/libany-moose-perl/Makefile.PL Wed Dec 16 01:16:05 2009
@@ -1,18 +1,22 @@
use strict;
use warnings;
+
+ BEGIN { require 5.006_002; }
use ExtUtils::MakeMaker;
WriteMakefile(
DISTNAME => 'Any-Moose',
NAME => 'Any::Moose',
- AUTHOR => 'Shawn\ M\ Moore\ \<sartak\@bestpractical\.com\>\,\ Florian\ Ragwitz\ \<rafl\@debian\.org\>\,\ Stevan\ Little\ \<stevan\@iinteractive\.com\>\,\ Tokuhiro\ Matsuno\ \<tokuhirom\@gmail\.com\>',
- ABSTRACT => 'use\ Moose\ or\ Mouse\ modules',
- VERSION => '0.10',
+ AUTHOR => "Shawn\ M\ Moore\ \<sartak\@bestpractical\.com\>\,\ Florian\ Ragwitz\ \<rafl\@debian\.org\>\,\ Stevan\ Little\ \<stevan\@iinteractive\.com\>\,\ Tokuhiro\ Matsuno\ \<tokuhirom\@gmail\.com\>\,\ Goro\ Fuji\ \<gfuji\@cpan\.org\>",
+ ABSTRACT => "use\ Moose\ or\ Mouse\ modules",
+ VERSION => '0.11',
EXE_FILES => [ qw() ],
- (eval { ExtUtils::MakeMaker->VERSION(6.21) } ? (LICENSE => 'perl') : ()),
+ (eval { ExtUtils::MakeMaker->VERSION(6.31) } ? (LICENSE => 'perl') : ()),
PREREQ_PM => {
- "Mouse" => '0.21',
+ "Mouse" => '0.40',
},
+ test => {TESTS => 't/*.t'}
);
+
Modified: trunk/libany-moose-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libany-moose-perl/README?rev=48814&op=diff
==============================================================================
--- trunk/libany-moose-perl/README (original)
+++ trunk/libany-moose-perl/README Wed Dec 16 01:16:05 2009
@@ -1,7 +1,7 @@
This archive contains the distribution Any-Moose, version
-0.10:
+0.11:
use Moose or Mouse modules
Modified: trunk/libany-moose-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libany-moose-perl/debian/changelog?rev=48814&op=diff
==============================================================================
--- trunk/libany-moose-perl/debian/changelog (original)
+++ trunk/libany-moose-perl/debian/changelog Wed Dec 16 01:16:05 2009
@@ -1,8 +1,10 @@
-libany-moose-perl (0.10-1) UNRELEASED; urgency=low
+libany-moose-perl (0.11-1) UNRELEASED; urgency=low
- IGNORE-VERSION: 0.10-1
- no reason to upload
-
+ [ Jonathan Yu ]
+ * New upstream release
+ * Rewrite control description
+ * Standards-Version 3.8.3 (no changes)
+ * Add myself to Uploaders and Copyright
[ Nathan Handler ]
* debian/watch: Update to ignore development releases.
@@ -17,7 +19,7 @@
perl (>= 5.6.0-{12,16}) with an unversioned dependency on perl (as
permitted by Debian Policy 3.8.3).
- -- Ryan Niebur <ryan at debian.org> Fri, 25 Sep 2009 00:23:53 -0700
+ -- Jonathan Yu <jawnsy at cpan.org> Tue, 15 Dec 2009 16:45:40 -0500
libany-moose-perl (0.09-1) unstable; urgency=low
Modified: trunk/libany-moose-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libany-moose-perl/debian/control?rev=48814&op=diff
==============================================================================
--- trunk/libany-moose-perl/debian/control (original)
+++ trunk/libany-moose-perl/debian/control Wed Dec 16 01:16:05 2009
@@ -2,22 +2,24 @@
Section: perl
Priority: optional
Build-Depends: debhelper (>= 7)
-Build-Depends-Indep: libmouse-perl (>= 0.21), perl, libmoose-perl, libmoosex-types-perl
+Build-Depends-Indep: perl, libmouse-perl (>= 0.40), libmoose-perl,
+ libmoosex-types-perl
Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
-Uploaders: Ryan Niebur <ryan at debian.org>
-Standards-Version: 3.8.2
+Uploaders: Ryan Niebur <ryan at debian.org>, Jonathan Yu <jawnsy at cpan.org>
+Standards-Version: 3.8.3
Homepage: http://search.cpan.org/dist/Any-Moose/
Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libany-moose-perl/
Vcs-Browser: http://svn.debian.org/viewsvn/pkg-perl/trunk/libany-moose-perl/
Package: libany-moose-perl
Architecture: all
-Depends: ${misc:Depends}, ${perl:Depends}, libmouse-perl (>= 0.21)
+Depends: ${misc:Depends}, ${perl:Depends}, libmouse-perl (>= 0.40)
Description: Perl interface to use Moose or Mouse modules
- Any::Moose allows a perl module to use Moose if it's loaded, and
- otherwise use Mouse. Moose and Mouse are compatible enough that
- anything that works with Mouse should work with Moose.
+ Any::Moose is a Perl module that intelligently loads either Moose or Mouse,
+ which provide nearly identical interfaces to the same modern object system.
+ This module takes advantage of the fact that anything that works with Mouse
+ should also work with Moose.
.
- Moose is an extension of the Perl 5 object system. Mouse is a more
- lightweight version, which runs faster and has less dependencies, but
- provides less of the functionality of Moose.
+ Note that using this module may not always be appropriate because Mouse is a
+ lightweight implementation of the Moose object system, which trades some of
+ the less-used functionality for increased performance.
Modified: trunk/libany-moose-perl/debian/copyright
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libany-moose-perl/debian/copyright?rev=48814&op=diff
==============================================================================
--- trunk/libany-moose-perl/debian/copyright (original)
+++ trunk/libany-moose-perl/debian/copyright Wed Dec 16 01:16:05 2009
@@ -11,6 +11,7 @@
Files: debian/*
Copyright: 2009, Ryan Niebur <ryan at debian.org>
+ 2009, Jonathan Yu <jawnsy at cpan.org>
License: Artistic | GPL-1+
License: Artistic
Modified: trunk/libany-moose-perl/dist.ini
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libany-moose-perl/dist.ini?rev=48814&op=diff
==============================================================================
--- trunk/libany-moose-perl/dist.ini (original)
+++ trunk/libany-moose-perl/dist.ini Wed Dec 16 01:16:05 2009
@@ -1,9 +1,10 @@
name = Any-Moose
-version = 0.10
+version = 0.11
author = Shawn M Moore <sartak at bestpractical.com>
author = Florian Ragwitz <rafl at debian.org>
author = Stevan Little <stevan at iinteractive.com>
author = Tokuhiro Matsuno <tokuhirom at gmail.com>
+author = Goro Fuji <gfuji at cpan.org>
license = Perl_5
copyright_holder = Best Practical Solutions
@@ -14,5 +15,5 @@
[PodWeaver]
[Prereq]
-Mouse = 0.21
-
+Mouse = 0.40
+perl = 5.006_002
Modified: trunk/libany-moose-perl/lib/Any/Moose.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libany-moose-perl/lib/Any/Moose.pm?rev=48814&op=diff
==============================================================================
--- trunk/libany-moose-perl/lib/Any/Moose.pm (original)
+++ trunk/libany-moose-perl/lib/Any/Moose.pm Wed Dec 16 01:16:05 2009
@@ -1,10 +1,12 @@
package Any::Moose;
-our $VERSION = '0.10';
-
+our $VERSION = '0.11';
# ABSTRACT: use Moose or Mouse modules
+use 5.006_002;
use strict;
use warnings;
+
+use Carp ();
our $PREFERRED = $ENV{'ANY_MOOSE'};
@@ -12,12 +14,9 @@
my $self = shift;
my $pkg = caller;
- # Any::Moose gives you strict and warnings (but only the first time, in case
- # you do something like: use Any::Moose; no strict 'refs')
- if (!defined(_backer_of($pkg))) {
- strict->import;
- warnings->import;
- }
+ # Any::Moose gives you strict and warnings
+ strict->import;
+ warnings->import;
# first options are for Mo*se
unshift @_, 'Moose' if !@_ || ref($_[0]);
@@ -40,22 +39,36 @@
}
sub unimport {
- my $self = shift;
- my $pkg = caller;
-
- my $backer = _backer_of($pkg);
-
- eval "package $pkg;\n"
- . '$backer->unimport(@_);';
+ my $sel = shift;
+ my $pkg = caller;
+ my $module;
+
+ if(@_){
+ $module = any_moose(shift, $pkg);
+ }
+ else {
+ $module = _backer_of($pkg);
+ }
+ my $e = do{
+ local $@;
+ eval "package $pkg;\n"
+ . '$module->unimport();';
+ $@;
+ };
+ Carp::croak("Cannot unimport Any::Moose: $e") if $e;
+ return;
}
sub _backer_of {
my $pkg = shift;
- return 'Mouse' if $INC{'Mouse.pm'}
- && Mouse::Meta::Class->_metaclass_cache($pkg);
- return 'Mouse::Role' if $INC{'Mouse/Role.pm'}
- && Mouse::Meta::Role->_metaclass_cache($pkg);
+ if(exists $INC{'Mouse.pm'}){
+ my $meta = Mouse::Util::get_metaclass_by_name($pkg);
+ if ($meta) {
+ return 'Mouse::Role' if $meta->isa('Mouse::Meta::Role');
+ return 'Mouse' if $meta->isa('Mouse::Meta::Class');
+ }
+ }
if (_is_moose_loaded()) {
my $meta = Class::MOP::get_metaclass_by_name($pkg);
@@ -97,8 +110,14 @@
require $file;
- eval "package $options->{package};\n"
- . '$module->import(@{ $options->{imports} });';
+ my $e = do {
+ local $@;
+ eval "package $options->{package};\n"
+ . '$module->import(@{ $options->{imports} });';
+ $@;
+ };
+ Carp::croak("Cannot import Any::Moose: $e") if $e;
+ return;
}
sub any_moose {
@@ -107,28 +126,34 @@
# Mouse gets first dibs because it doesn't introspect existing classes
- if ((_backer_of($package)||'') =~ /^Mouse/) {
+ my $backer = _backer_of($package) || '';
+
+ if ($backer =~ /^Mouse/) {
$fragment =~ s/^Moose/Mouse/;
return $fragment;
}
- return $fragment if (_backer_of($package)||'') =~ /^Moose/;
-
- # If we're loading up the backing class...
- if ($fragment eq 'Moose' || $fragment eq 'Moose::Role') {
- if (!$PREFERRED) {
- $PREFERRED = _is_moose_loaded() ? 'Moose' : 'Mouse';
-
- (my $file = $PREFERRED . '.pm') =~ s{::}{/}g;
- require $file;
- }
-
- $fragment =~ s/^Moose/Mouse/ if mouse_is_preferred();
- return $fragment;
- }
-
- require Carp;
- Carp::croak("Neither Moose nor Mouse backs the '$package' package.");
+ return $fragment if $backer =~ /^Moose/;
+
+ if (!$PREFERRED) {
+ local $@;
+ if (_is_moose_loaded()) {
+ $PREFERRED = 'Moose';
+ }
+ elsif (eval { require Mouse }) {
+ $PREFERRED = 'Mouse';
+ }
+ elsif (eval { require Moose }) {
+ $PREFERRED = 'Moose';
+ }
+ else {
+ require Carp;
+ Carp::confess("Unable to locate Mouse or Moose in INC");
+ }
+ }
+
+ $fragment =~ s/^Moose/Mouse/ if mouse_is_preferred();
+ return $fragment;
}
sub load_class {
@@ -146,7 +171,7 @@
sub moose_is_preferred { $PREFERRED eq 'Moose' }
sub mouse_is_preferred { $PREFERRED eq 'Mouse' }
-sub _is_moose_loaded { !!$INC{'Class/MOP.pm'} }
+sub _is_moose_loaded { exists $INC{'Class/MOP.pm'} }
sub is_moose_loaded {
Carp::carp("Any::Moose::is_moose_loaded is deprecated. Please use Any::Moose::moose_is_preferred instead");
@@ -156,7 +181,7 @@
sub _canonicalize_fragment {
my $fragment = shift;
- return 'Moose' if !defined($fragment);
+ return 'Moose' if !$fragment;
# any_moose("X::Types") -> any_moose("MooseX::Types")
$fragment =~ s/^X::/MooseX::/;
@@ -170,23 +195,21 @@
# any_moose("Util") -> any_moose("Moose::Util")
$fragment =~ s/^(?!Moose)/Moose::/;
- # any_moose("Moose::") (via any_moose("")) -> any_moose("Moose")
- $fragment =~ s/^Moose::$/Moose/;
-
return $fragment;
}
1;
-__END__
+=pod
+
=head1 NAME
Any::Moose - use Moose or Mouse modules
=head1 VERSION
-version 0.10
+version 0.11
=head1 SYNOPSIS
@@ -196,6 +219,9 @@
# uses Moose if it's loaded, Mouse otherwise
use Any::Moose;
+
+ # cleans the namespace up
+ no Any::Moose;
=head2 OTHER MODULES
@@ -230,12 +256,19 @@
Actual documentation is forthcoming, once we solidify all the bits of the API.
The examples above are very likely to continue working.
+=head1 SEE ALSO
+
+L<Moose>
+
+L<Mouse>
+
=head1 AUTHORS
Shawn M Moore <sartak at bestpractical.com>
Florian Ragwitz <rafl at debian.org>
Stevan Little <stevan at iinteractive.com>
Tokuhiro Matsuno <tokuhirom at gmail.com>
+ Goro Fuji <gfuji at cpan.org>
=head1 COPYRIGHT AND LICENSE
@@ -244,3 +277,8 @@
This is free software; you can redistribute it and/or modify it under
the same terms as perl itself.
+=cut
+
+
+__END__
+
Modified: trunk/libany-moose-perl/t/001-basic-moose.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libany-moose-perl/t/001-basic-moose.t?rev=48814&op=diff
==============================================================================
--- trunk/libany-moose-perl/t/001-basic-moose.t (original)
+++ trunk/libany-moose-perl/t/001-basic-moose.t Wed Dec 16 01:16:05 2009
@@ -1,9 +1,15 @@
#!/usr/bin/env perl
use strict;
use warnings;
-use Test::More tests => 9;
+use Test::More;
BEGIN { delete $ENV{ANY_MOOSE} }
+
+BEGIN {
+ eval 'require Mouse';
+ plan skip_all => 'Mouse not available' if $@;
+ plan tests => 9;
+}
do {
package Moused::Any::Moose;
Modified: trunk/libany-moose-perl/t/002-other-modules-mouse.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libany-moose-perl/t/002-other-modules-mouse.t?rev=48814&op=diff
==============================================================================
--- trunk/libany-moose-perl/t/002-other-modules-mouse.t (original)
+++ trunk/libany-moose-perl/t/002-other-modules-mouse.t Wed Dec 16 01:16:05 2009
@@ -1,9 +1,15 @@
#!/usr/bin/env perl
use strict;
use warnings;
-use Test::More tests => 2;
+use Test::More;
BEGIN { delete $ENV{ANY_MOOSE} }
+
+BEGIN {
+ eval 'require Mouse';
+ plan skip_all => 'Mouse not available' if $@;
+ plan tests => 2;
+}
do {
package Moused::Any::Moose;
@@ -11,7 +17,7 @@
use Any::Moose '::Util::TypeConstraints' => ['subtype', 'as'];
subtype 'XYZ' => as 'Int';
- ::ok(Mouse::Util::TypeConstraints::optimized_constraints()->{XYZ}, 'subtype used Mouse');
+ ::ok(Mouse::Util::TypeConstraints::find_type_constraint('XYZ'), 'subtype used Mouse');
};
SKIP: {
@@ -26,8 +32,7 @@
use Any::Moose '::Util::TypeConstraints' => ['subtype', 'as'];
subtype 'ABC' => as 'Int';
- #::ok(Mouse::Util::TypeConstraints::find_type_constraint('ABC'), 'subtype used Mouse');
- ::ok(Mouse::Util::TypeConstraints::optimized_constraints()->{ABC}, 'subtype used Mouse');
+ ::ok(Mouse::Util::TypeConstraints::find_type_constraint('ABC'), 'subtype used Mouse');
};
};
Modified: trunk/libany-moose-perl/t/003-is_moose_loaded.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libany-moose-perl/t/003-is_moose_loaded.t?rev=48814&op=diff
==============================================================================
--- trunk/libany-moose-perl/t/003-is_moose_loaded.t (original)
+++ trunk/libany-moose-perl/t/003-is_moose_loaded.t Wed Dec 16 01:16:05 2009
@@ -1,9 +1,15 @@
#!/usr/bin/env perl
use strict;
use warnings;
-use Test::More tests => 3;
+use Test::More;
BEGIN { delete $ENV{ANY_MOOSE} }
+
+BEGIN {
+ eval 'require Mouse';
+ plan skip_all => 'Mouse not available' if $@;
+ plan tests => 3;
+}
package Test;
BEGIN {
Modified: trunk/libany-moose-perl/t/005-is_class_loaded-mouse.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libany-moose-perl/t/005-is_class_loaded-mouse.t?rev=48814&op=diff
==============================================================================
--- trunk/libany-moose-perl/t/005-is_class_loaded-mouse.t (original)
+++ trunk/libany-moose-perl/t/005-is_class_loaded-mouse.t Wed Dec 16 01:16:05 2009
@@ -5,7 +5,11 @@
BEGIN { delete $ENV{ANY_MOOSE} }
-plan tests => 2;
+BEGIN {
+ eval 'require Mouse';
+ plan skip_all => 'Mouse not available' if $@;
+ plan tests => 2;
+}
{
package MyFoo;
Modified: trunk/libany-moose-perl/t/010-use_mouse_roles.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libany-moose-perl/t/010-use_mouse_roles.t?rev=48814&op=diff
==============================================================================
--- trunk/libany-moose-perl/t/010-use_mouse_roles.t (original)
+++ trunk/libany-moose-perl/t/010-use_mouse_roles.t Wed Dec 16 01:16:05 2009
@@ -1,9 +1,15 @@
#!/usr/bin/env perl
use strict;
use warnings;
-use Test::More tests => 1;
+use Test::More;
BEGIN { delete $ENV{ANY_MOOSE} }
+
+BEGIN {
+ eval 'require Mouse';
+ plan skip_all => 'Mouse not available' if $@;
+ plan tests => 1;
+}
{
package My::Role;
@@ -11,3 +17,4 @@
}
isa_ok(My::Role->meta, 'Mouse::Meta::Role');
+
More information about the Pkg-perl-cvs-commits
mailing list