From: Robert Buels Date: Mon, 4 Oct 2010 22:28:49 +0000 (-0700) Subject: fix cgi_dir path logic. should use the 'root' config var, and sometimes 'root' is... X-Git-Tag: 0.031~6 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Controller-WrapCGI.git;a=commitdiff_plain;h=d501f45e86dabe1c138f0c145f955607e7f2a488 fix cgi_dir path logic. should use the 'root' config var, and sometimes 'root' is an absolute path, sometimes not, so needs to handle that too. --- diff --git a/lib/Catalyst/Controller/CGIBin.pm b/lib/Catalyst/Controller/CGIBin.pm index f05db5b..20755aa 100644 --- a/lib/Catalyst/Controller/CGIBin.pm +++ b/lib/Catalyst/Controller/CGIBin.pm @@ -104,9 +104,14 @@ has cgi_file_pattern => (is => 'rw', default => sub { ['*'] }); sub register_actions { my ($self, $app) = @_; - my $cgi_bin = File::Spec->file_name_is_absolute($self->cgi_dir) ? - $self->cgi_dir - : $app->path_to('root', $self->cgi_dir); + my $cgi_bin; + if( File::Spec->file_name_is_absolute($self->cgi_dir) ) { + $cgi_bin = $self->cgi_dir; + } elsif( File::Spec->file_name_is_absolute( $app->config->{root} ) ) { + $cgi_bin = File::Spec->catdir( $app->config->{root}, $self->cgi_dir ); + } else { + $cgi_bin = $app->path_to( $app->config->{root}, $self->cgi_dir); + } my $namespace = $self->action_namespace($app);