Merge pull request #170 from perl-catalyst/haarg/no-dev-circ-deps
Graham Knop [Sun, 26 Jul 2020 15:52:31 +0000 (17:52 +0200)]
Eliminate circular dependencies in develop prereqs

.travis.yml
.yath.rc [new file with mode: 0644]
Makefile.PL
lib/Catalyst/Exception/Basic.pm
lib/Catalyst/Exception/Interface.pm
lib/Catalyst/Stats.pm
lib/Catalyst/Utils.pm
t/custom_exception_class_simple.t
t/unit_stats.t

index 275b17c..841d936 100644 (file)
@@ -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 (file)
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
index dd932f0..1f76be6 100644 (file)
@@ -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 ###############################################################
index 253b6a8..3ac78e1 100644 (file)
@@ -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';
 
index 73e4cc0..5f0dbd1 100644 (file)
@@ -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<MooseX::Role::WithOverloading>.
-
 =head1 REQUIRED METHODS
 
 =head2 as_string
index 1987205..7f6058e 100644 (file)
@@ -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;
 }
 
index 30ca196..5fae307 100644 (file)
@@ -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;
 }
 
index 27e4516..084ea11 100644 (file)
@@ -1,3 +1,4 @@
+# HARNESS-NO-PRELOAD
 use strict;
 use warnings;
 use FindBin qw/$Bin/;
index 5aced0a..3fc08d0 100644 (file)
@@ -1,3 +1,4 @@
+# HARNESS-NO-PRELOAD
 use strict;
 use warnings;