From: Graham Knop Date: Sun, 26 Jul 2020 15:52:31 +0000 (+0200) Subject: Merge pull request #170 from perl-catalyst/haarg/no-dev-circ-deps X-Git-Tag: v5.90_127~10 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=964bf130533c001789a80ef193f03d5c5f3817eb;hp=3e79d24e8b4d680f0ea07f41bae38fec9ad16000 Merge pull request #170 from perl-catalyst/haarg/no-dev-circ-deps Eliminate circular dependencies in develop prereqs --- diff --git a/.travis.yml b/.travis.yml index 275b17c..841d936 100644 --- a/.travis.yml +++ b/.travis.yml @@ -50,8 +50,8 @@ script: - cpanm --notest --metacpan --skip-satisfied YAML::Syck # both author deps & reverse deps: - - cpanm --metacpan --skip-satisfied Catalyst::View::TT - - cpanm --metacpan --skip-satisfied Catalyst::Plugin::Authentication + - cpanm --metacpan --skip-satisfied Catalyst::View::TT || ( cat ~/.cpanm/build.log; false ) + - cpanm --metacpan --skip-satisfied Catalyst::Plugin::Authentication || ( cat ~/.cpanm/build.log; false ) # pure reverse deps (call with --test-only): - cpanm --test-only --metacpan -v Catalyst::Devel diff --git a/.yath.rc b/.yath.rc new file mode 100644 index 0000000..8e772a1 --- /dev/null +++ b/.yath.rc @@ -0,0 +1,20 @@ +[test] +-j 4 +-P Catalyst +-P Catalyst::Action +-P Catalyst::ActionRole::ConsumesContent +-P Catalyst::ActionRole::HTTPMethods +-P Catalyst::ActionRole::QueryMatching +-P Catalyst::ActionRole::Scheme +-P Catalyst::DispatchType::Chained +-P Catalyst::DispatchType::Default +-P Catalyst::DispatchType::Index +-P Catalyst::DispatchType::Path +-P Catalyst::Dispatcher +-P Catalyst::Model +-P Catalyst::Request +-P Catalyst::Response +-P Catalyst::Stats +-P Catalyst::Test +-P Catalyst::View +-P HTML::HeadParser diff --git a/Makefile.PL b/Makefile.PL index dd932f0..1f76be6 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -26,9 +26,8 @@ my %META = ( 'namespace::clean' => '0.23', 'MooseX::Emulate::Class::Accessor::Fast' => '0.00903', 'Class::Load' => '0.12', - 'Moose' => '1.03', + 'Moose' => '2.1400', 'MooseX::MethodAttributes::Role::AttrContainer::Inheritable' => '0.24', - 'MooseX::Role::WithOverloading' => '0.09', 'Carp' => '1.25', 'Class::C3::Adopt::NEXT' => '0.07', 'CGI::Simple::Cookie' => '1.109', @@ -162,11 +161,6 @@ my $tests = 't/*.t t/aggregate/*.t'; my %MM_ARGS = ( test => { TESTS => $tests }, EXE_FILES => [ glob 'script/*.pl' ], - PREREQ_PM => { - (eval { require Moose; Moose->VERSION('2.1300') } ? () : ( - 'MooseX::Role::WithOverloading' => '0.09' - )), - }, ); ## BOILERPLATE ############################################################### diff --git a/lib/Catalyst/Exception/Basic.pm b/lib/Catalyst/Exception/Basic.pm index 253b6a8..3ac78e1 100644 --- a/lib/Catalyst/Exception/Basic.pm +++ b/lib/Catalyst/Exception/Basic.pm @@ -1,8 +1,6 @@ package Catalyst::Exception::Basic; use Moose::Role; -use if !eval { require Moose; Moose->VERSION('2.1300') }, - 'MooseX::Role::WithOverloading'; use Carp; use namespace::clean -except => 'meta'; diff --git a/lib/Catalyst/Exception/Interface.pm b/lib/Catalyst/Exception/Interface.pm index 73e4cc0..5f0dbd1 100644 --- a/lib/Catalyst/Exception/Interface.pm +++ b/lib/Catalyst/Exception/Interface.pm @@ -1,8 +1,6 @@ package Catalyst::Exception::Interface; use Moose::Role; -use if !eval { require Moose; Moose->VERSION('2.1300') }, - 'MooseX::Role::WithOverloading'; use namespace::clean -except => 'meta'; use overload @@ -40,9 +38,6 @@ It ensures that all exceptions follow the expected interface, and adds overloading for stringification when composed onto a class. -Note that if you compose this role onto another role, that role -must use L. - =head1 REQUIRED METHODS =head2 as_string diff --git a/lib/Catalyst/Stats.pm b/lib/Catalyst/Stats.pm index 1987205..7f6058e 100644 --- a/lib/Catalyst/Stats.pm +++ b/lib/Catalyst/Stats.pm @@ -95,26 +95,35 @@ sub elapsed { sub report { my $self = shift; - my $column_width = Catalyst::Utils::term_width() - 9 - 13; - my $t = Text::SimpleTable->new( [ $column_width, 'Action' ], [ 9, 'Time' ] ); + my $t; my @results; - $self->traverse( - sub { - my $action = shift; - my $stat = $action->getNodeValue; - my @r = ( $action->getDepth, - ($stat->{action} || "") . - ($stat->{action} && $stat->{comment} ? " " : "") . ($stat->{comment} ? '- ' . $stat->{comment} : ""), - $stat->{elapsed}, - $stat->{action} ? 1 : 0, - ); - # Trim down any times >= 10 to avoid ugly Text::Simple line wrapping - my $elapsed = substr(sprintf("%f", $stat->{elapsed}), 0, 8) . "s"; - $t->row( ( q{ } x $r[0] ) . $r[1], - defined $r[2] ? $elapsed : '??'); - push(@results, \@r); - } - ); + + if (!wantarray) { + $t = Text::SimpleTable->new( + [ Catalyst::Utils::term_width() - 9 - 13, 'Action' ], + [ 9, 'Time' ], + ); + } + + $self->traverse(sub { + my $action = shift; + my $stat = $action->getNodeValue; + my @r = ( $action->getDepth, + ($stat->{action} || "") . + ($stat->{action} && $stat->{comment} ? " " : "") . ($stat->{comment} ? '- ' . $stat->{comment} : ""), + $stat->{elapsed}, + $stat->{action} ? 1 : 0, + ); + # Trim down any times >= 10 to avoid ugly Text::Simple line wrapping + my $elapsed = substr(sprintf("%f", $stat->{elapsed}), 0, 8) . "s"; + if ($t) { + $t->row( ( q{ } x $r[0] ) . $r[1], + defined $r[2] ? $elapsed : '??'); + } + else { + push @results, \@r; + } + }); return wantarray ? @results : $t->draw; } diff --git a/lib/Catalyst/Utils.pm b/lib/Catalyst/Utils.pm index 30ca196..5fae307 100644 --- a/lib/Catalyst/Utils.pm +++ b/lib/Catalyst/Utils.pm @@ -394,6 +394,7 @@ this =cut my $_term_width; +my $_use_term_size_any; sub term_width { my $force_reset = shift; @@ -402,29 +403,36 @@ sub term_width { return $_term_width if $_term_width; + if (!defined $_use_term_size_any) { + eval { + require Term::Size::Any; + Term::Size::Any->import(); + $_use_term_size_any = 1; + 1; + } or do { + if ( $@ =~ m[Can't locate Term/Size/Any\.pm] ) { + warn "Term::Size::Any is not installed, can't autodetect terminal column width\n"; + } + else { + warn "There was an error trying to detect your terminal size: $@\n"; + } + $_use_term_size_any = 0; + }; + } + my $width; - eval ' - use Term::Size::Any; - ($width) = Term::Size::Any::chars; - 1; - ' or do { - if($@ =~m[Can't locate Term/Size/Any.pm]) { - warn "Term::Size::Any is not installed, can't autodetect terminal column width\n"; - } else { - warn "There was an error trying to detect your terminal size: $@\n"; - } - }; - unless ($width) { - warn 'Trouble trying to detect your terminal size, looking at $ENV{COLUMNS}'."\n"; - $width = $ENV{COLUMNS} - if exists($ENV{COLUMNS}) - && $ENV{COLUMNS} =~ m/^\d+$/; + if ($_use_term_size_any) { + ($width) = Term::Size::Any::chars(); + } + + if (!$width && $ENV{COLUMNS} && $ENV{COLUMNS} =~ /\A\d+\z/) { + $width = $ENV{COLUMNS}; + } + if (!$width || $width < 80) { + $width = 80; } - do { - warn "Cannot determine desired terminal width, using default of 80 columns\n"; - $width = 80 } unless ($width && $width >= 80); return $_term_width = $width; } diff --git a/t/custom_exception_class_simple.t b/t/custom_exception_class_simple.t index 27e4516..084ea11 100644 --- a/t/custom_exception_class_simple.t +++ b/t/custom_exception_class_simple.t @@ -1,3 +1,4 @@ +# HARNESS-NO-PRELOAD use strict; use warnings; use FindBin qw/$Bin/; diff --git a/t/unit_stats.t b/t/unit_stats.t index 5aced0a..3fc08d0 100644 --- a/t/unit_stats.t +++ b/t/unit_stats.t @@ -1,3 +1,4 @@ +# HARNESS-NO-PRELOAD use strict; use warnings;