X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FUtils.pm;h=1bccecba7ada144b97fa0d5a216598843458b8c2;hb=473078ffb70c9a5585a6b190fc973f5e9000c11b;hp=a02b762bb2d23790a6a291269612a297c7505cfa;hpb=dfcb05ee2d4e9481368622f6924e162de323b23b;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Utils.pm b/lib/Catalyst/Utils.pm index a02b762..1bccecb 100644 --- a/lib/Catalyst/Utils.pm +++ b/lib/Catalyst/Utils.pm @@ -10,7 +10,6 @@ use Cwd; use Class::Load 'is_class_loaded'; use String::RewritePrefix; use Class::Load (); - use namespace::clean; =head1 NAME @@ -384,11 +383,21 @@ that 'env' now lists COLUMNS.) As last resort, default value of 80 chars will be used. +Calling C with a true value will cause it to be recalculated; you +can use this to cause it to get recalculated when your terminal is resized like +this + + $SIG{WINCH} = sub { Catalyst::Utils::term_width(1) }; + =cut my $_term_width; sub term_width { + my $force_reset = shift; + + undef $_term_width if $force_reset; + return $_term_width if $_term_width; my $width; @@ -493,6 +502,8 @@ sub apply_registered_middleware { return $new_psgi; } + + =head1 PSGI Helpers Utility functions to make it easier to work with PSGI applications under Catalyst @@ -512,7 +523,7 @@ Localize C<$env> under the current controller path prefix: my $env = $c->Catalyst::Utils::env_at_path_prefix; } -Assuming you have a requst like GET /user/name: +Assuming you have a request like GET /user/name: In the example case C<$env> will have PATH_INFO of '/name' instead of '/user/name' and SCRIPT_NAME will now be '/user'. @@ -555,7 +566,7 @@ Assuming you have a request like GET /user/name: In the example case C<$env> will have PATH_INFO of '/' instead of '/user/name' and SCRIPT_NAME will now be '/user/name'. -Alternatively, assuming you have a requst like GET /user/name/foo: +Alternatively, assuming you have a request like GET /user/name/foo: In this example case C<$env> will have PATH_INFO of '/foo' instead of '/user/name/foo' and SCRIPT_NAME will now be '/user/name'. @@ -600,7 +611,7 @@ Localize C<$env> under the current request URI: my $env = $c->Catalyst::Utils::env_at_request_uri } -Assuming you have a requst like GET /user/name/hello: +Assuming you have a request like GET /user/name/hello: In the example case C<$env> will have PATH_INFO of '/' instead of '/user/name' and SCRIPT_NAME will now be '/user/name/hello'.