Unify/simplify redirects handings by: &My::Web::http_moved
authorshort <>
Sun, 18 Sep 2005 20:18:10 +0000 (20:18 +0000)
committershort <>
Sun, 18 Sep 2005 20:18:10 +0000 (20:18 +0000)
Index.pm
project/Rel.pm

index e620822..288f7de 100644 (file)
--- a/Index.pm
+++ b/Index.pm
@@ -24,22 +24,15 @@ use strict;
 use warnings;
 
 use My::Web;
-use Apache2::Const qw(HTTP_MOVED_TEMPORARILY);
+use Apache2::Const qw(HTTP_MOVED_PERMANENTLY);
 
 
 our $HTML_TEST=0;
 
 sub handler
 {
-my $W=My::Web->init(
-               "header_only"=>1,
-               );
-
-
-$W->{"r"}->status(HTTP_MOVED_TEMPORARILY);
-$W->{"r"}->headers_out()->{"Location"}=path_web "./project/","abs"=>1;
-
-
-exit 0;
+my $W=My::Web->init();
+My::Web->http_moved("./project/",HTTP_MOVED_PERMANENTLY);
+die "NOTREACHED";
 }
 1;
index ae0d5f3..5832868 100755 (executable)
@@ -24,7 +24,7 @@ use strict;
 use warnings;
 
 use My::Web;
-use Apache2::Const qw(HTTP_MOVED_TEMPORARILY);
+use Apache2::Const qw(HTTP_MOVED_PERMANENTLY);
 Wrequire 'project::Lib';
 
 
@@ -33,7 +33,6 @@ our $HTML_TEST=0;
 sub handler
 {
 my $W=My::Web->init(
-               "header_only"=>1,
                "args_check"=>{
                                "rel"=>'^(?:prev|next)$',
                                "project"=>'^\w+$',
@@ -66,10 +65,7 @@ for (0..$#projects) {
        last if $target;
        }
 
-$W->{"r"}->status(HTTP_MOVED_TEMPORARILY);
-$W->{"r"}->headers_out()->{"Location"}=path_web "./".($target && "$target/"),"abs"=>1;
-
-
-exit 0;
+My::Web->http_moved("./".(!$target ? "" : "$target/"),HTTP_MOVED_PERMANENTLY);
+die "NOTREACHED";
 }
 1;