From: Sebastian Riedel Date: Thu, 14 Apr 2005 12:52:44 +0000 (+0000) Subject: fixed absolute forward in root and cleaned tables X-Git-Tag: 5.7099_04~1544 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=cd677e12b127597abb93b76560c8cb23a47d5da6 fixed absolute forward in root and cleaned tables --- diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index b9cdcb4..08037d2 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -5,7 +5,6 @@ use base 'Catalyst::Base'; use UNIVERSAL::require; use Catalyst::Log; use Text::ASCIITable; -use Text::ASCIITable::Wrap 'wrap'; __PACKAGE__->mk_classdata($_) for qw/dispatcher engine log/; @@ -192,7 +191,7 @@ sub import { my $t = Text::ASCIITable->new( { hide_HeadRow => 1, hide_HeadLine => 1 } ); $t->setCols('Class'); $t->setColWidth( 'Class', 75, 1 ); - $t->addRow( wrap( $_, 75 ) ) for @plugins; + $t->addRow($_) for @plugins; $caller->log->debug( 'Loaded plugins', $t->draw ) if ( @plugins && $caller->debug ); diff --git a/lib/Catalyst/Dispatcher.pm b/lib/Catalyst/Dispatcher.pm index 9287bdb..b65c22a 100644 --- a/lib/Catalyst/Dispatcher.pm +++ b/lib/Catalyst/Dispatcher.pm @@ -4,7 +4,6 @@ use strict; use base 'Class::Data::Inheritable'; use Memoize; use Text::ASCIITable; -use Text::ASCIITable::Wrap 'wrap'; use Tree::Simple; use Tree::Simple::Visitor::FindByPath; @@ -115,14 +114,15 @@ sub forward { my $caller = caller(0); my $namespace = '/'; if ( $command =~ /^\// ) { - $command =~ /^\/(.*)\/(\w+)$/; + $command =~ /^(.*)\/(\w+)$/; $namespace = $1 || '/'; + $namespace = s/^\/// if $namespace ne '/'; $command = $2; } else { $namespace = _class2prefix($caller) || '/' } my $results = $c->get_action( $command, $namespace ); unless ( @{$results} ) { - my $class = $command; + my $class = $command || ''; if ( $class =~ /[^\w\:]/ ) { my $error = qq/Couldn't forward to "$class"/; $c->error($error); @@ -135,7 +135,7 @@ sub forward { $results = [ [ [ $class, $code ] ] ]; } else { - my $error = qq/Couldn't forward to "$class->$method"/; + my $error = qq/Couldn't forward to "$class"/; $c->error($error); $c->log->debug($error) if $c->debug; @@ -346,8 +346,7 @@ sub setup_actions { my $uid = $parent->getUID; for my $action ( keys %{ $actions->{private}->{$uid} } ) { my ( $class, $code ) = @{ $actions->{private}->{$uid}->{$action} }; - $privates->addRow( wrap( "$prefix$action", 36 ), - wrap( $class, 37 ) ); + $privates->addRow( "$prefix$action", $class, 37 ); } $walker->( $walker, $_, $prefix ) for $parent->getAllChildren; }; @@ -362,7 +361,7 @@ sub setup_actions { my ( $class, $code ) = @{ $actions->{plain}->{$plain} }; my $reverse = $self->actions->{reverse}->{$code}; $reverse = $reverse ? "/$reverse" : $code; - $publics->addRow( wrap( "/$plain", 36 ), wrap( $reverse, 37 ) ); + $publics->addRow( "/$plain", $reverse ); } $self->log->debug( 'Loaded public actions', $publics->draw ) if ( @{ $publics->{tbl_rows} } && $self->debug ); @@ -374,7 +373,7 @@ sub setup_actions { my ( $class, $code ) = @{ $actions->{regex}->{$regex} }; my $reverse = $self->actions->{reverse}->{$code}; $reverse = $reverse ? "/$reverse" : $code; - $regexes->addRow( wrap( $regex, 36 ), wrap( $reverse, 37 ) ); + $regexes->addRow( $regex, $reverse ); } $self->log->debug( 'Loaded regex actions', $regexes->draw ) if ( @{ $regexes->{tbl_rows} } && $self->debug ); diff --git a/lib/Catalyst/Engine.pm b/lib/Catalyst/Engine.pm index 9b7d58a..641cc6d 100644 --- a/lib/Catalyst/Engine.pm +++ b/lib/Catalyst/Engine.pm @@ -9,7 +9,6 @@ use HTML::Entities; use HTTP::Headers; use Time::HiRes qw/gettimeofday tv_interval/; use Text::ASCIITable; -use Text::ASCIITable::Wrap 'wrap'; use Catalyst::Request; use Catalyst::Request::Upload; use Catalyst::Response; @@ -354,9 +353,7 @@ sub handler { $t->setColWidth( 'Action', 64, 1 ); $t->setColWidth( 'Time', 9, 1 ); - for my $stat (@stats) { - $t->addRow( wrap( $stat->[0], 64 ), wrap( $stat->[1], 9 ) ); - } + for my $stat (@stats) { $t->addRow( $stat->[0], $stat->[1] ) } $class->log->info( "Request took $elapsed" . "s ($av/s)", $t->draw ); } @@ -425,7 +422,7 @@ sub prepare { $t->setColWidth( 'Value', 36, 1 ); for my $key ( keys %{ $c->req->params } ) { my $value = $c->req->params->{$key} || ''; - $t->addRow( wrap( $key, 37 ), wrap( $value, 36 ) ); + $t->addRow( $key, $value ); } $c->log->debug( 'Parameters are', $t->draw ); } @@ -616,7 +613,7 @@ sub setup_components { my $t = Text::ASCIITable->new( { hide_HeadRow => 1, hide_HeadLine => 1 } ); $t->setCols('Class'); $t->setColWidth( 'Class', 75, 1 ); - $t->addRow( wrap( $_, 75 ) ) for keys %{ $self->components }; + $t->addRow($_) for keys %{ $self->components }; $self->log->debug( 'Loaded components', $t->draw ) if ( @{ $t->{tbl_rows} } && $self->debug ); $self->setup_actions( [ $self, @comps ] );