X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=lib%2FApache%2FMVC.pm;h=696ab84847a75987f1ce785728f1ae1eecce673c;hb=8bee7ab27f76f2b3e8a65113ded4d439ec4949fe;hp=384b497d28154b8a98c48f67141f3c2339df71e7;hpb=2af3091e4954c080708cb08eb3c72d52416f9ca1;p=maypole.git diff --git a/lib/Apache/MVC.pm b/lib/Apache/MVC.pm index 384b497..696ab84 100644 --- a/lib/Apache/MVC.pm +++ b/lib/Apache/MVC.pm @@ -108,8 +108,9 @@ sub get_request { sub warn { my ($self,@args) = @_; my ($package, $line) = (caller)[0,2]; + my $ar = $self->parent ? $self->parent->{ar} : $self->{ar}; if ( $args[0] and ref $self ) { - $self->{ar}->warn("[$package line $line] ", @args) ; + $ar->warn("[$package line $line] ", @args) ; } else { print "warn called by ", caller, " with ", @_, "\n"; } @@ -184,8 +185,7 @@ can only be combined with status. =cut -sub redirect_request -{ +sub redirect_request { my $r = shift; my $redirect_url = $_[0]; my $status = $MODPERL2 ? eval 'Apache2::Const::REDIRECT;' : @@ -198,7 +198,11 @@ sub redirect_request my $path = $args{path} || $r->path; my $host = $args{domain} || $r->ar->hostname; my $protocol = $args{protocol} || $r->get_protocol; - $redirect_url = "${protocol}://${host}/${path}"; + + $redirect_url = URI->new; + $redirect_url->scheme($protocol); + $redirect_url->host($host); + $redirect_url->path($path); } $status = $args{status} if ($args{status}); } @@ -208,6 +212,7 @@ sub redirect_request return OK; } + =item get_protocol =cut