X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FDispatchType%2FRegex.pm;h=4b1beae7322870b2ce6342df954290d3b9b9280a;hb=ca5d34dfc295012a749a8454d2b213580e03d55c;hp=11a9cbf2f378dab5d4576aed915202929246159f;hpb=f91554831ad9972ba44453f69a6b633fd3dfa710;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/DispatchType/Regex.pm b/lib/Catalyst/DispatchType/Regex.pm index 11a9cbf..4b1beae 100644 --- a/lib/Catalyst/DispatchType/Regex.pm +++ b/lib/Catalyst/DispatchType/Regex.pm @@ -47,8 +47,12 @@ Output a table of all regex actions, and their private equivalent. sub list { my ( $self, $c ) = @_; - my $column_width = Catalyst::Utils::term_width() - 35 - 9; - my $re = Text::SimpleTable->new( [ 35, 'Regex' ], [ $column_width, 'Private' ] ); + my $avail_width = Catalyst::Utils::term_width() - 9; + my $col1_width = ($avail_width * .50) < 35 ? 35 : int($avail_width * .50); + my $col2_width = $avail_width - $col1_width; + my $re = Text::SimpleTable->new( + [ $col1_width, 'Regex' ], [ $col2_width, 'Private' ] + ); for my $regex ( @{ $self->_compiled } ) { my $action = $regex->{action}; $re->row( $regex->{path}, "/$action" ); @@ -147,6 +151,7 @@ sub uri_for_action { my $re = "$orig"; $re =~ s/^\^//; $re =~ s/\$$//; + $re =~ s/\\([^\\])/$1/g; my $final = '/'; my @captures = @$captures; while (my ($front, $rest) = split(/\(/, $re, 2)) {