@@ -1,22 +1,30 @@
Revision history for MooseX::Log::Log4perl
- Added t/99bench.t for basic benchmark testing
+0.41 Thu Apr 29 2010
+ * Added POD::Covergage test (t/podcoverage.t)
+ * Added Perl::Critic test (t/pelr-critic.t)
+ * RT#57021: Raised dependency to Log::Log4perl 1.13 which first introduced the TRACE level (thanks Sam Vilain)
+ * Raise dependency for Moose to 0.65, which has fixes for Win32 Builds
+ * Updated Module::Install to 0.94
+ * Raise required perl version to 5.8
+
+0.40 Sun May 17 2009
+ * Added t/99bench.t for basic benchmark testing
0.31 Mon Jul 21 2008
- Fixed bug reported by Maik Hentsche
+ * Fixed bug reported by Maik Hentsche
0.30 Tue Jul 15 2008
- Corrected MANIFEST (added MANIFEST.SKIP to generate it correctly now)
- Improved pod and fixed typo in MooseX::Log::Log4perl::Easy
- Cleanup of tests and pod
- Repackage as 0.30 to fix failing cpan tests (and fix perl module version numbering for CPAN)
+ * Corrected MANIFEST (added MANIFEST.SKIP to generate it correctly now)
+ * Improved pod and fixed typo in MooseX::Log::Log4perl::Easy
+ * Cleanup of tests and pod
+ * Repackage as 0.30 to fix failing cpan tests (and fix perl module version numbering for CPAN)
0.2 Mon Jul 14 2008
- Added MooseX::Log::Log4perl::Easy for simple log interface
- this adds methods $self->log_error, $self->log_debug, ... for all log levels
- Cleanup of tests and pod
+ * Added MooseX::Log::Log4perl::Easy for simple log interface
+ this adds methods $self->log_error, $self->log_debug, ... for all log levels
+ * Cleanup of tests and pod
0.1 Thu Jul 10 2008
- Initial release with support for log4perl logging. (Roland Lammel)
- Logger init has to be done outside of this package for now.
-
+ * Initial release with support for log4perl logging. (Roland Lammel)
+ * Logger init has to be done outside of this package for now.
@@ -20,4 +20,7 @@ t/00load.t
t/01basic.t
t/02easy.t
t/99bench.t
+t/perl-critic.t
+t/perlcriticrc
t/pod.t
+t/podcoverage.t
@@ -9,7 +9,7 @@ build_requires:
configure_requires:
ExtUtils::MakeMaker: 6.42
distribution_type: module
-generated_by: 'Module::Install version 0.88'
+generated_by: 'Module::Install version 0.94'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -20,8 +20,9 @@ no_index:
- inc
- t
requires:
- Log::Log4perl: 0
- Moose: 0
+ Log::Log4perl: 1.13
+ Moose: 0.65
+ perl: 5.8.0
resources:
license: http://dev.perl.org/licenses/
-version: 0.40
+version: 0.41
@@ -6,8 +6,8 @@ all_from 'lib/MooseX/Log/Log4perl.pm';
build_requires 'IO::Scalar';
build_requires 'Test::More';
-requires 'Moose';
-requires 'Log::Log4perl';
+requires 'Moose' => 0.65;
+requires 'Log::Log4perl' => 1.13;
auto_install;
WriteAll;
@@ -670,9 +670,22 @@ sub _load {
# Load CPAN.pm and it's configuration
sub _load_cpan {
- return if $CPAN::VERSION and not @_;
+ return if $CPAN::VERSION and $CPAN::Config and not @_;
require CPAN;
- if ( $CPAN::HandleConfig::VERSION ) {
+
+ # CPAN-1.82+ adds CPAN::Config::AUTOLOAD to redirect to
+ # CPAN::HandleConfig->load. CPAN reports that the redirection
+ # is deprecated in a warning printed at the user.
+
+ # CPAN-1.81 expects CPAN::HandleConfig->load, does not have
+ # $CPAN::HandleConfig::VERSION but cannot handle
+ # CPAN::Config->load
+
+ # Which "versions expect CPAN::Config->load?
+
+ if ( $CPAN::HandleConfig::VERSION
+ || CPAN::HandleConfig->can('load')
+ ) {
# Newer versions of CPAN have a HandleConfig module
CPAN::HandleConfig->load;
} else {
@@ -802,4 +815,4 @@ END_MAKE
__END__
-#line 1056
+#line 1069
@@ -2,13 +2,13 @@
package Module::Install::AutoInstall;
use strict;
-use Module::Install::Base;
+use Module::Install::Base ();
-use vars qw{$VERSION $ISCORE @ISA};
+use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '0.88';
+ $VERSION = '0.94';
+ @ISA = 'Module::Install::Base';
$ISCORE = 1;
- @ISA = qw{Module::Install::Base};
}
sub AutoInstall { $_[0] }
@@ -4,7 +4,7 @@ package Module::Install::Base;
use strict 'vars';
use vars qw{$VERSION};
BEGIN {
- $VERSION = '0.88';
+ $VERSION = '0.94';
}
# Suspend handler for "redefined" warnings
@@ -13,42 +13,34 @@ BEGIN {
$SIG{__WARN__} = sub { $w };
}
-### This is the ONLY module that shouldn't have strict on
-# use strict;
-
-#line 45
+#line 42
sub new {
- my ($class, %args) = @_;
-
- foreach my $method ( qw(call load) ) {
- next if defined &{"$class\::$method"};
- *{"$class\::$method"} = sub {
- shift()->_top->$method(@_);
- };
+ my $class = shift;
+ unless ( defined &{"${class}::call"} ) {
+ *{"${class}::call"} = sub { shift->_top->call(@_) };
}
-
- bless( \%args, $class );
+ unless ( defined &{"${class}::load"} ) {
+ *{"${class}::load"} = sub { shift->_top->load(@_) };
+ }
+ bless { @_ }, $class;
}
-#line 66
+#line 61
sub AUTOLOAD {
- my $self = shift;
local $@;
- my $autoload = eval {
- $self->_top->autoload
- } or return;
- goto &$autoload;
+ my $func = eval { shift->_top->autoload } or return;
+ goto &$func;
}
-#line 83
+#line 75
sub _top {
$_[0]->{_top};
}
-#line 98
+#line 90
sub admin {
$_[0]->_top->{admin}
@@ -56,7 +48,7 @@ sub admin {
Module::Install::Base::FakeAdmin->new;
}
-#line 114
+#line 106
sub is_admin {
$_[0]->admin->VERSION;
@@ -83,4 +75,4 @@ BEGIN {
1;
-#line 162
+#line 154
@@ -2,16 +2,16 @@
package Module::Install::Can;
use strict;
-use Module::Install::Base;
-use Config ();
-use File::Spec ();
-use ExtUtils::MakeMaker ();
+use Config ();
+use File::Spec ();
+use ExtUtils::MakeMaker ();
+use Module::Install::Base ();
-use vars qw{$VERSION $ISCORE @ISA};
+use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '0.88';
+ $VERSION = '0.94';
+ @ISA = 'Module::Install::Base';
$ISCORE = 1;
- @ISA = qw{Module::Install::Base};
}
# check if we can load some module
@@ -2,13 +2,13 @@
package Module::Install::Fetch;
use strict;
-use Module::Install::Base;
+use Module::Install::Base ();
-use vars qw{$VERSION $ISCORE @ISA};
+use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '0.88';
+ $VERSION = '0.94';
+ @ISA = 'Module::Install::Base';
$ISCORE = 1;
- @ISA = qw{Module::Install::Base};
}
sub get_file {
@@ -2,13 +2,13 @@
package Module::Install::Include;
use strict;
-use Module::Install::Base;
+use Module::Install::Base ();
-use vars qw{$VERSION $ISCORE @ISA};
+use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '0.88';
+ $VERSION = '0.94';
+ @ISA = 'Module::Install::Base';
$ISCORE = 1;
- @ISA = qw{Module::Install::Base};
}
sub include {
@@ -2,14 +2,14 @@
package Module::Install::Makefile;
use strict 'vars';
-use Module::Install::Base;
-use ExtUtils::MakeMaker ();
+use ExtUtils::MakeMaker ();
+use Module::Install::Base ();
-use vars qw{$VERSION $ISCORE @ISA};
+use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '0.88';
+ $VERSION = '0.94';
+ @ISA = 'Module::Install::Base';
$ISCORE = 1;
- @ISA = qw{Module::Install::Base};
}
sub Makefile { $_[0] }
@@ -34,6 +34,17 @@ sub prompt {
}
}
+# Store a cleaned up version of the MakeMaker version,
+# since we need to behave differently in a variety of
+# ways based on the MM version.
+my $makemaker = eval $ExtUtils::MakeMaker::VERSION;
+
+# If we are passed a param, do a "newer than" comparison.
+# Otherwise, just return the MakeMaker version.
+sub makemaker {
+ ( @_ < 2 or $makemaker >= eval($_[1]) ) ? $makemaker : 0
+}
+
sub makemaker_args {
my $self = shift;
my $args = ( $self->{makemaker_args} ||= {} );
@@ -44,7 +55,7 @@ sub makemaker_args {
# For mm args that take multiple space-seperated args,
# append an argument to the current list.
sub makemaker_append {
- my $self = sShift;
+ my $self = shift;
my $name = shift;
my $args = $self->makemaker_args;
$args->{name} = defined $args->{$name}
@@ -107,6 +118,9 @@ sub tests_recursive {
%test_dir = ();
require File::Find;
File::Find::find( \&_wanted_t, $dir );
+ if ( -d 'xt' and ($Module::Install::AUTHOR or $ENV{RELEASE_TESTING}) ) {
+ File::Find::find( \&_wanted_t, 'xt' );
+ }
$self->tests( join ' ', map { "$_/*.t" } sort keys %test_dir );
}
@@ -130,12 +144,13 @@ sub write {
# an underscore, even though its own version may contain one!
# Hence the funny regexp to get rid of it. See RT #35800
# for details.
- $self->build_requires( 'ExtUtils::MakeMaker' => $ExtUtils::MakeMaker::VERSION =~ /^(\d+\.\d+)/ );
- $self->configure_requires( 'ExtUtils::MakeMaker' => $ExtUtils::MakeMaker::VERSION =~ /^(\d+\.\d+)/ );
+ my $v = $ExtUtils::MakeMaker::VERSION =~ /^(\d+\.\d+)/;
+ $self->build_requires( 'ExtUtils::MakeMaker' => $v );
+ $self->configure_requires( 'ExtUtils::MakeMaker' => $v );
} else {
# Allow legacy-compatibility with 5.005 by depending on the
# most recent EU:MM that supported 5.005.
- $self->build_requires( 'ExtUtils::MakeMaker' => 6.42 );
+ $self->build_requires( 'ExtUtils::MakeMaker' => 6.42 );
$self->configure_requires( 'ExtUtils::MakeMaker' => 6.42 );
}
@@ -145,57 +160,87 @@ sub write {
$args->{NAME} = $self->module_name || $self->name;
$args->{VERSION} = $self->version;
$args->{NAME} =~ s/-/::/g;
+ $DB::single = 1;
if ( $self->tests ) {
- $args->{test} = { TESTS => $self->tests };
+ $args->{test} = {
+ TESTS => $self->tests,
+ };
+ } elsif ( -d 'xt' and ($Module::Install::AUTHOR or $ENV{RELEASE_TESTING}) ) {
+ $args->{test} = {
+ TESTS => join( ' ', map { "$_/*.t" } grep { -d $_ } qw{ t xt } ),
+ };
}
if ( $] >= 5.005 ) {
$args->{ABSTRACT} = $self->abstract;
$args->{AUTHOR} = $self->author;
}
- if ( eval($ExtUtils::MakeMaker::VERSION) >= 6.10 ) {
- $args->{NO_META} = 1;
+ if ( $self->makemaker(6.10) ) {
+ $args->{NO_META} = 1;
+ #$args->{NO_MYMETA} = 1;
}
- if ( eval($ExtUtils::MakeMaker::VERSION) > 6.17 and $self->sign ) {
+ if ( $self->makemaker(6.17) and $self->sign ) {
$args->{SIGN} = 1;
}
unless ( $self->is_admin ) {
delete $args->{SIGN};
}
- # Merge both kinds of requires into prereq_pm
my $prereq = ($args->{PREREQ_PM} ||= {});
%$prereq = ( %$prereq,
- map { @$_ }
+ map { @$_ } # flatten [module => version]
map { @$_ }
grep $_,
- ($self->configure_requires, $self->build_requires, $self->requires)
+ ($self->requires)
);
# Remove any reference to perl, PREREQ_PM doesn't support it
delete $args->{PREREQ_PM}->{perl};
- # merge both kinds of requires into prereq_pm
+ # Merge both kinds of requires into BUILD_REQUIRES
+ my $build_prereq = ($args->{BUILD_REQUIRES} ||= {});
+ %$build_prereq = ( %$build_prereq,
+ map { @$_ } # flatten [module => version]
+ map { @$_ }
+ grep $_,
+ ($self->configure_requires, $self->build_requires)
+ );
+
+ # Remove any reference to perl, BUILD_REQUIRES doesn't support it
+ delete $args->{BUILD_REQUIRES}->{perl};
+
+ # Delete bundled dists from prereq_pm
my $subdirs = ($args->{DIR} ||= []);
if ($self->bundles) {
foreach my $bundle (@{ $self->bundles }) {
my ($file, $dir) = @$bundle;
push @$subdirs, $dir if -d $dir;
- delete $prereq->{$file};
+ delete $build_prereq->{$file}; #Delete from build prereqs only
}
}
+ unless ( $self->makemaker('6.55_03') ) {
+ %$prereq = (%$prereq,%$build_prereq);
+ delete $args->{BUILD_REQUIRES};
+ }
+
if ( my $perl_version = $self->perl_version ) {
eval "use $perl_version; 1"
or die "ERROR: perl: Version $] is installed, "
. "but we need version >= $perl_version";
+
+ if ( $self->makemaker(6.48) ) {
+ $args->{MIN_PERL_VERSION} = $perl_version;
+ }
}
$args->{INSTALLDIRS} = $self->installdirs;
- my %args = map { ( $_ => $args->{$_} ) } grep {defined($args->{$_})} keys %$args;
+ my %args = map {
+ ( $_ => $args->{$_} ) } grep {defined($args->{$_} )
+ } keys %$args;
my $user_preop = delete $args{dist}->{PREOP};
- if (my $preop = $self->admin->preop($user_preop)) {
+ if ( my $preop = $self->admin->preop($user_preop) ) {
foreach my $key ( keys %$preop ) {
$args{dist}->{$key} = $preop->{$key};
}
@@ -265,4 +310,4 @@ sub postamble {
__END__
-#line 394
+#line 439
@@ -2,18 +2,17 @@
package Module::Install::Metadata;
use strict 'vars';
-use Module::Install::Base;
+use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '0.88';
- @ISA = qw{Module::Install::Base};
+ $VERSION = '0.94';
+ @ISA = 'Module::Install::Base';
$ISCORE = 1;
}
my @boolean_keys = qw{
sign
- mymeta
};
my @scalar_keys = qw{
@@ -231,6 +230,8 @@ sub all_from {
die("The path '$file' does not exist, or is not a file");
}
+ $self->{values}{all_from} = $file;
+
# Some methods pull from POD instead of code.
# If there is a matching .pod, use that instead
my $pod = $file;
@@ -386,11 +387,10 @@ sub name_from {
}
}
-sub perl_version_from {
- my $self = shift;
+sub _extract_perl_version {
if (
- Module::Install::_read($_[0]) =~ m/
- ^
+ $_[0] =~ m/
+ ^\s*
(?:use|require) \s*
v?
([\d_\.]+)
@@ -399,6 +399,16 @@ sub perl_version_from {
) {
my $perl_version = $1;
$perl_version =~ s{_}{}g;
+ return $perl_version;
+ } else {
+ return;
+ }
+}
+
+sub perl_version_from {
+ my $self = shift;
+ my $perl_version=_extract_perl_version(Module::Install::_read($_[0]));
+ if ($perl_version) {
$self->perl_version($perl_version);
} else {
warn "Cannot determine perl version info from $_[0]\n";
@@ -426,13 +436,12 @@ sub author_from {
}
}
-sub license_from {
- my $self = shift;
+sub _extract_license {
if (
- Module::Install::_read($_[0]) =~ m/
+ $_[0] =~ m/
(
=head \d \s+
- (?:licen[cs]e|licensing|copyright|legal)\b
+ (?:licen[cs]e|licensing|copyrights?|legal)\b
.*?
)
(=head\\d.*|=cut.*|)
@@ -440,37 +449,51 @@ sub license_from {
/ixms ) {
my $license_text = $1;
my @phrases = (
- 'under the same (?:terms|license) as perl itself' => 'perl', 1,
- 'GNU general public license' => 'gpl', 1,
- 'GNU public license' => 'gpl', 1,
- 'GNU lesser general public license' => 'lgpl', 1,
- 'GNU lesser public license' => 'lgpl', 1,
- 'GNU library general public license' => 'lgpl', 1,
- 'GNU library public license' => 'lgpl', 1,
- 'BSD license' => 'bsd', 1,
- 'Artistic license' => 'artistic', 1,
- 'GPL' => 'gpl', 1,
- 'LGPL' => 'lgpl', 1,
- 'BSD' => 'bsd', 1,
- 'Artistic' => 'artistic', 1,
- 'MIT' => 'mit', 1,
- 'proprietary' => 'proprietary', 0,
+ 'under the same (?:terms|license) as (?:perl|the perl programming language)' => 'perl', 1,
+ 'under the terms of (?:perl|the perl programming language) itself' => 'perl', 1,
+ 'Artistic and GPL' => 'perl', 1,
+ 'GNU general public license' => 'gpl', 1,
+ 'GNU public license' => 'gpl', 1,
+ 'GNU lesser general public license' => 'lgpl', 1,
+ 'GNU lesser public license' => 'lgpl', 1,
+ 'GNU library general public license' => 'lgpl', 1,
+ 'GNU library public license' => 'lgpl', 1,
+ 'BSD license' => 'bsd', 1,
+ 'Artistic license' => 'artistic', 1,
+ 'GPL' => 'gpl', 1,
+ 'LGPL' => 'lgpl', 1,
+ 'BSD' => 'bsd', 1,
+ 'Artistic' => 'artistic', 1,
+ 'MIT' => 'mit', 1,
+ 'proprietary' => 'proprietary', 0,
);
while ( my ($pattern, $license, $osi) = splice(@phrases, 0, 3) ) {
- $pattern =~ s{\s+}{\\s+}g;
+ $pattern =~ s#\s+#\\s+#gs;
if ( $license_text =~ /\b$pattern\b/i ) {
- $self->license($license);
- return 1;
+ return $license;
}
}
+ } else {
+ return;
}
+}
- warn "Cannot determine license info from $_[0]\n";
- return 'unknown';
+sub license_from {
+ my $self = shift;
+ if (my $license=_extract_license(Module::Install::_read($_[0]))) {
+ $self->license($license);
+ } else {
+ warn "Cannot determine license info from $_[0]\n";
+ return 'unknown';
+ }
}
sub _extract_bugtracker {
- my @links = $_[0] =~ m#L<(\Qhttp://rt.cpan.org/\E[^>]+)>#g;
+ my @links = $_[0] =~ m#L<(
+ \Qhttp://rt.cpan.org/\E[^>]+|
+ \Qhttp://github.com/\E[\w_]+/[\w_]+/issues|
+ \Qhttp://code.google.com/p/\E[\w_\-]+/issues/list
+ )>#gx;
my %links;
@links{@links}=();
@links=keys %links;
@@ -486,7 +509,7 @@ sub bugtracker_from {
return 0;
}
if ( @links > 1 ) {
- warn "Found more than on rt.cpan.org link in $_[0]\n";
+ warn "Found more than one bugtracker link in $_[0]\n";
return 0;
}
@@ -506,6 +529,17 @@ sub requires_from {
}
}
+sub test_requires_from {
+ my $self = shift;
+ my $content = Module::Install::_readperl($_[0]);
+ my @requires = $content =~ m/^use\s+([^\W\d]\w*(?:::\w+)*)\s+([\d\.]+)/mg;
+ while ( @requires ) {
+ my $module = shift @requires;
+ my $version = shift @requires;
+ $self->test_requires( $module => $version );
+ }
+}
+
# Convert triple-part versions (eg, 5.6.1 or 5.8.9) to
# numbers (eg, 5.006001 or 5.008009).
# Also, convert double-part versions (eg, 5.8)
@@ -516,7 +550,8 @@ sub _perl_version {
$v =~ s/(\.\d\d\d)000$/$1/;
$v =~ s/_.+$//;
if ( ref($v) ) {
- $v = $v + 0; # Numify
+ # Numify
+ $v = $v + 0;
}
return $v;
}
@@ -526,23 +561,58 @@ sub _perl_version {
######################################################################
-# MYMETA.yml Support
+# MYMETA Support
sub WriteMyMeta {
die "WriteMyMeta has been deprecated";
}
-sub write_mymeta {
+sub write_mymeta_yaml {
my $self = shift;
- # If there's no existing META.yml there is nothing we can do
- return unless -f 'META.yml';
-
# We need YAML::Tiny to write the MYMETA.yml file
unless ( eval { require YAML::Tiny; 1; } ) {
return 1;
}
+ # Generate the data
+ my $meta = $self->_write_mymeta_data or return 1;
+
+ # Save as the MYMETA.yml file
+ print "Writing MYMETA.yml\n";
+ YAML::Tiny::DumpFile('MYMETA.yml', $meta);
+}
+
+sub write_mymeta_json {
+ my $self = shift;
+
+ # We need JSON to write the MYMETA.json file
+ unless ( eval { require JSON; 1; } ) {
+ return 1;
+ }
+
+ # Generate the data
+ my $meta = $self->_write_mymeta_data or return 1;
+
+ # Save as the MYMETA.yml file
+ print "Writing MYMETA.json\n";
+ Module::Install::_write(
+ 'MYMETA.json',
+ JSON->new->pretty(1)->canonical->encode($meta),
+ );
+}
+
+sub _write_mymeta_data {
+ my $self = shift;
+
+ # If there's no existing META.yml there is nothing we can do
+ return undef unless -f 'META.yml';
+
+ # We need Parse::CPAN::Meta to load the file
+ unless ( eval { require Parse::CPAN::Meta; 1; } ) {
+ return undef;
+ }
+
# Merge the perl version into the dependencies
my $val = $self->Meta->{values};
my $perl = delete $val->{perl_version};
@@ -558,7 +628,7 @@ sub write_mymeta {
}
# Load the advisory META.yml file
- my @yaml = YAML::Tiny::LoadFile('META.yml');
+ my @yaml = Parse::CPAN::Meta::LoadFile('META.yml');
my $meta = $yaml[0];
# Overwrite the non-configure dependency hashs
@@ -572,9 +642,7 @@ sub write_mymeta {
$meta->{build_requires} = { map { @$_ } @{ $val->{build_requires} } };
}
- # Save as the MYMETA.yml file
- print "Writing MYMETA.yml\n";
- YAML::Tiny::DumpFile('MYMETA.yml', $meta);
+ return $meta;
}
1;
@@ -2,12 +2,12 @@
package Module::Install::Win32;
use strict;
-use Module::Install::Base;
+use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '0.88';
- @ISA = qw{Module::Install::Base};
+ $VERSION = '0.94';
+ @ISA = 'Module::Install::Base';
$ISCORE = 1;
}
@@ -2,11 +2,11 @@
package Module::Install::WriteAll;
use strict;
-use Module::Install::Base;
+use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '0.88';
+ $VERSION = '0.94';;
@ISA = qw{Module::Install::Base};
$ISCORE = 1;
}
@@ -41,8 +41,18 @@ sub WriteAll {
# The Makefile write process adds a couple of dependencies,
# so write the META.yml files after the Makefile.
- $self->Meta->write if $args{meta};
- $self->Meta->write_mymeta if $self->mymeta;
+ if ( $args{meta} ) {
+ $self->Meta->write;
+ }
+
+ # Experimental support for MYMETA
+ if ( $ENV{X_MYMETA} ) {
+ if ( $ENV{X_MYMETA} eq 'JSON' ) {
+ $self->Meta->write_mymeta_json;
+ } else {
+ $self->Meta->write_mymeta_yaml;
+ }
+ }
return 1;
}
@@ -28,7 +28,7 @@ BEGIN {
# This is not enforced yet, but will be some time in the next few
# releases once we can make sure it won't clash with custom
# Module::Install extensions.
- $VERSION = '0.88';
+ $VERSION = '0.94';
# Storage for the pseudo-singleton
$MAIN = undef;
@@ -348,17 +348,24 @@ sub _caller {
return $call;
}
+# Done in evals to avoid confusing Perl::MinimumVersion
+eval( $] >= 5.006 ? <<'END_NEW' : <<'END_OLD' ); die $@ if $@;
sub _read {
local *FH;
- if ( $] >= 5.006 ) {
- open( FH, '<', $_[0] ) or die "open($_[0]): $!";
- } else {
- open( FH, "< $_[0]" ) or die "open($_[0]): $!";
- }
+ open( FH, '<', $_[0] ) or die "open($_[0]): $!";
+ my $string = do { local $/; <FH> };
+ close FH or die "close($_[0]): $!";
+ return $string;
+}
+END_NEW
+sub _read {
+ local *FH;
+ open( FH, "< $_[0]" ) or die "open($_[0]): $!";
my $string = do { local $/; <FH> };
close FH or die "close($_[0]): $!";
return $string;
}
+END_OLD
sub _readperl {
my $string = Module::Install::_read($_[0]);
@@ -379,18 +386,26 @@ sub _readpod {
return $string;
}
+# Done in evals to avoid confusing Perl::MinimumVersion
+eval( $] >= 5.006 ? <<'END_NEW' : <<'END_OLD' ); die $@ if $@;
sub _write {
local *FH;
- if ( $] >= 5.006 ) {
- open( FH, '>', $_[0] ) or die "open($_[0]): $!";
- } else {
- open( FH, "> $_[0]" ) or die "open($_[0]): $!";
+ open( FH, '>', $_[0] ) or die "open($_[0]): $!";
+ foreach ( 1 .. $#_ ) {
+ print FH $_[$_] or die "print($_[0]): $!";
}
+ close FH or die "close($_[0]): $!";
+}
+END_NEW
+sub _write {
+ local *FH;
+ open( FH, "> $_[0]" ) or die "open($_[0]): $!";
foreach ( 1 .. $#_ ) {
print FH $_[$_] or die "print($_[0]): $!";
}
close FH or die "close($_[0]): $!";
}
+END_OLD
# _version is for processing module versions (eg, 1.03_05) not
# Perl versions (eg, 5.8.1).
@@ -427,4 +442,4 @@ sub _CLASS ($) {
1;
-# Copyright 2008 - 2009 Adam Kennedy.
+# Copyright 2008 - 2010 Adam Kennedy.
@@ -4,14 +4,14 @@ use Moose::Role;
with 'MooseX::Log::Log4perl';
-our $VERSION = '0.40';
+our $VERSION = '0.41';
-sub log_fatal { local $Log::Log4perl::caller_depth += 1; shift->logger->fatal(@_); }
-sub log_error { local $Log::Log4perl::caller_depth += 1; shift->logger->error(@_); }
-sub log_warn { local $Log::Log4perl::caller_depth += 1; shift->logger->warn(@_); }
-sub log_info { local $Log::Log4perl::caller_depth += 1; shift->logger->info(@_); }
-sub log_debug { local $Log::Log4perl::caller_depth += 1; shift->logger->debug(@_); }
-sub log_trace { local $Log::Log4perl::caller_depth += 1; shift->logger->trace(@_); }
+sub log_fatal { local $Log::Log4perl::caller_depth += 1; return shift->logger->fatal(@_); }
+sub log_error { local $Log::Log4perl::caller_depth += 1; return shift->logger->error(@_); }
+sub log_warn { local $Log::Log4perl::caller_depth += 1; return shift->logger->warn(@_); }
+sub log_info { local $Log::Log4perl::caller_depth += 1; return shift->logger->info(@_); }
+sub log_debug { local $Log::Log4perl::caller_depth += 1; return shift->logger->debug(@_); }
+sub log_trace { local $Log::Log4perl::caller_depth += 1; return shift->logger->trace(@_); }
1;
@@ -19,11 +19,7 @@ __END__
=head1 NAME
-MooseX::Log::Log4perl::Easy - A Logging Role with easy interface for Moose based on L<MooseX::Log::Log4perl>
-
-=head1 VERSION
-
-This document describes MooseX::Log::Log4perl::Easy version 0.31
+MooseX::Log::Log4perl::Easy - A role for easy usage of logging in your Moose based modules based on L<MooseX::Log::Log4perl>
=head1 SYNOPSIS
@@ -53,8 +49,8 @@ logmethods for all available levels to your class instance. Hence it is possible
without having to access a seperate log attribute as in MooseX::Log::Log4perl;
-In case your app grows and you need more of the super-cow powers of Log4perl or simply don't want the additional
-methodes to clutter up your class you can simply replace all code C<< $self->log_LEVEL >> with
+In case your app grows and you need more of the super-cow powers of Log4perl or simply don't want the additional
+methodes to clutter up your class you can simply replace all code C<< $self->log_LEVEL >> with
C<< $self->log->LEVEL >>.
You can use the following regex substitution to accomplish that:
@@ -129,7 +125,7 @@ Contributions from Tim Bunce C<< <TIMB@cpan.org> >>
=head1 LICENCE AND COPYRIGHT
-Copyright (c) 2008-2009, Roland Lammel C<< <lammel@cpan.org> >>, http://www.quikit.at. Some rights reserved.
+Copyright (c) 2008-2010, Roland Lammel C<< <lammel@cpan.org> >>, http://www.quikit.at. Some rights reserved.
This module is free software; you can redistribute it and/or
modify it under the same terms as Perl itself. See L<perlartistic>.
@@ -1,9 +1,10 @@
package MooseX::Log::Log4perl;
+use 5.008;
use Moose::Role;
use Log::Log4perl;
-our $VERSION = '0.40';
+our $VERSION = '0.41';
has 'logger' => (
is => 'rw',
@@ -13,7 +14,7 @@ has 'logger' => (
);
sub log {
- return Log::Log4perl->get_logger($_[1]) if ($_[1] && !ref($_[1]));
+ return Log::Log4perl->get_logger($_[1]) if ($_[1] && !ref($_[1]));
return $_[0]->logger;
}
@@ -27,7 +28,7 @@ MooseX::Log::Log4perl - A Logging Role for Moose based on Log::Log4perl
=head1 VERSION
-This document describes MooseX::Log::Log4perl version 0.30
+This document describes MooseX::Log::Log4perl version 0.41
=head1 SYNOPSIS
@@ -114,7 +115,7 @@ Thanks to Michael Schilli C<< <m@perlmeister.com> >> for L<Log::Log4perl> and su
=head1 LICENCE AND COPYRIGHT
-Copyright (c) 2008-2009, Roland Lammel C<< <lammel@cpan.org> >>, http://www.quikit.at. Some rights reserved.
+Copyright (c) 2008-2010, Roland Lammel C<< <lammel@cpan.org> >>, http://www.quikit.at. Some rights reserved.
This module is free software; you can redistribute it and/or
modify it under the same terms as Perl itself. See L<perlartistic>.
@@ -8,8 +8,8 @@ use Log::Log4perl;
use vars qw($tmplogfile);
use Test::More;
-plan skip_all => "Set TEST_MAINT=1 if benchmark should be run with the testsuite" unless $ENV{TEST_MAINT};
-plan tests => 6;
+plan skip_all => "Author test. Set $ENV{TEST_AUTHOR} to a true value to run benchmark tests" unless $ENV{TEST_AUTHOR};
+plan tests => 8;
BEGIN { $tmplogfile = 'mxll4p_benchtest.log'; }
END {
@@ -17,7 +17,7 @@ END {
unlink($tmplogfile) if (-f $tmplogfile);
}
-{
+{
### Define a custom Log4perl appender that simply does not log anything
### as we only need to check on call performance not actuall performance
### of the appender
@@ -31,7 +31,7 @@ END {
use Moose;
with 'MooseX::Log::Log4perl';
-
+
sub testlog { shift->log->info("Just a test for logging"); }
sub testlogger { shift->logger->info("Just a test for logging"); }
__PACKAGE__->meta->make_immutable;
@@ -42,9 +42,9 @@ END {
use Log::Log4perl;
use vars qw($log);
-
+
BEGIN { $log = Log::Log4perl->get_logger(__PACKAGE__); }
-
+
sub new { bless({log=>$log},__PACKAGE__); }
sub log { return shift->{log}; };
@@ -52,6 +52,31 @@ END {
sub testlogdirect { $log->info("Just a test for logging"); }
}
+{
+ package BenchLogAnyNull;
+
+ use Log::Any qw($log);
+
+ sub new { bless({},__PACKAGE__); }
+ sub log { return $log; };
+
+ sub testlogdirect { $log->info("Just a test for logging"); }
+}
+
+{
+ package BenchLogAnyL4p;
+
+ use Log::Any qw($log);
+
+ BEGIN { Log::Any->set_adapter('Log4perl'); }
+
+ sub new { bless({},__PACKAGE__); }
+ sub log { return $log; };
+
+ sub testlogmethod { $log->info("Just a test for logging"); }
+ sub testlogdirect { $log->info("Just a test for logging"); }
+}
+
###
### Tests start here
###
@@ -63,12 +88,16 @@ log4perl.appender.Nirvana.layout = Log::Log4perl::Layout::PatternLayout
log4perl.appender.Nirvana.layout.ConversionPattern = %p [%c] %m%n
__ENDCFG__
Log::Log4perl->init(\$cfg);
-
+
my $mxl = new BenchMooseXLogLog4perl();
my $llp = new BenchLogLog4perl();
-
+ my $lan = new BenchLogAnyNull();
+ my $lal = new BenchLogAnyL4p();
+
isa_ok( $mxl, 'BenchMooseXLogLog4perl', 'Bench instance for MooseX::Log::Log4perl');
isa_ok( $llp, 'BenchLogLog4perl', 'Bench instance for Log::Log4perl');
+ isa_ok( $lan, 'BenchLogAnyNull', 'Bench instance for Log::Any with null adapter');
+ isa_ok( $lal, 'BenchLogAnyL4p', 'Bench instance for Log::Any with Log4perl adapter');
# my $bllp1 = Benchmark::timeit(100000, sub { $llp->testlog() });
# diag(timestr($bllp1));
@@ -77,13 +106,16 @@ __ENDCFG__
# my $bmxl1 = Benchmark::timeit(100000, sub { $mxl->testlog() });
# diag(timestr($bmxl1));
# my $bmxl2 = Benchmark::timeit(100000, sub { $mxl->testlogger() });
- # diag(timestr($bmxl2));
- ### We expect some bsaic performance of approx. 10% to Log4perl directly
+ # diag(timestr($bmxl2));
+ ### We expect some basic performance of approx. 95% of Log4perl directly
+ diag("Running benchmarks, please wait a minute...");
my $result = cmpthese(-10, {
'Log4perl direct' => sub { $llp->testlogdirect() },
'Log4perl method' => sub { $llp->testlogmethod() },
'MooseX-L4p logger' => sub { $mxl->testlogger() },
'MooseX-L4p log' => sub { $mxl->testlog() },
+ 'LogAny-Null' => sub { $lan->testlogdirect() },
+ 'LogAny-L4p' => sub { $lal->testlogdirect() },
});
### Compare the rates now
my %bench = ();
@@ -102,10 +134,10 @@ __ENDCFG__
"(%i / %i = %.2f %%) to Log4perl direct", $bench{'MooseX-L4p logger'}, $bench{'Log4perl direct'}, $rate_log));
$rate_logger = 100 * $bench{'MooseX-L4p logger'} / $bench{'Log4perl method'};
- ok($rate_logger > 97, sprintf("Call rate of ->logger must be above 98%% " .
+ ok($rate_logger > 97, sprintf("Call rate of ->logger must be above 97%% " .
"(%i / %i = %.2f %%) to Log4perl via method", $bench{'MooseX-L4p logger'}, $bench{'Log4perl method'}, $rate_logger));
$rate_log = 100 * $bench{'MooseX-L4p log'} / $bench{'Log4perl method'};
- ok($rate_log > 96, sprintf("Call rate of ->log must be above 97%% " .
+ ok($rate_log > 96, sprintf("Call rate of ->log must be above 96%% " .
"(%i / %i = %.2f %%) to Log4perl via method", $bench{'MooseX-L4p logger'}, $bench{'Log4perl method'}, $rate_log));
}
@@ -0,0 +1,21 @@
+use strict;
+use warnings;
+use File::Spec;
+use Test::More;
+use English qw(-no_match_vars);
+
+if ( not($ENV{TEST_AUTHOR} || $ENV{TEST_CRITIC}) ) {
+ my $msg = 'Author test. Set $ENV{TEST_AUTHOR} to a true value to run.';
+ plan( skip_all => $msg );
+}
+
+eval { require Test::Perl::Critic; };
+
+if ( $EVAL_ERROR ) {
+ my $msg = 'Test::Perl::Critic required to criticise code';
+ plan( skip_all => $msg );
+}
+
+my $rcfile = File::Spec->catfile( 't', 'perlcriticrc' );
+Test::Perl::Critic->import( -profile => $rcfile );
+all_critic_ok();
\ No newline at end of file
@@ -0,0 +1,9 @@
+severity = harsh
+# only = 1
+# force = 0
+verbose = 4
+# top = 50
+theme = core
+# include = NamingConventions ClassHierarchies #Space-delimited list
+exclude = Subroutines::RequireArgUnpacking Subroutines::RequireFinalReturn Subroutines::ProhibitBuiltinHomonyms Variables::RequireInitializationForLocalVars
+# criticism-fatal = 1 #Zero or One
@@ -1,6 +1,9 @@
-#!perl
-
+use strict;
+use warnings;
use Test::More;
+
eval "use Test::Pod 1.14";
-plan skip_all => "Test::Pod 1.14 required for testing POD" if $@;
+plan skip_all => 'Test::Pod 1.14 required' if $@;
+plan skip_all => 'set TEST_POD to enable this test' unless $ENV{TEST_POD};
+
all_pod_files_ok();
@@ -0,0 +1,9 @@
+use strict;
+use warnings;
+use Test::More;
+
+eval "use Test::Pod::Coverage 1.04";
+plan skip_all => 'Test::Pod::Coverage 1.04 required' if $@;
+plan skip_all => 'set TEST_POD to enable this test' unless $ENV{TEST_POD};
+
+all_pod_coverage_ok();