You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Grant <em...@gmail.com> on 2006/12/08 19:12:43 UTC

Fixing a mod_perl module

Hello, I'm on the Interchange mailing list (icdevgroup.org) and we've
found a problem with our Interchange::Link mod_perl module for
apache2.  I don't know perl myself, and I was wondering if anyone here
might be able to help fix it.

The problem is that the Interchange tag:

[bounce href="http://www.domain.com" status="301 moved"]

uses the default 302 code when Interchange::Link is used.  It uses the
specified 301 without Interchange::Link.  The problem has been
isolated to this portion of code from Interchange::Link :

if($set_status =~ /^30[21]/) {
#warn "Doing redirect\n";
  $r->content_type($set_content);
  close (SOCK)                                or die "close: $!\n";
  return Apache2::Const::REDIRECT;
}

Please let me know if you can help.

- Grant

Re: Fixing a mod_perl module

Posted by Grant <em...@gmail.com>.
> > When I change:
> >
> > return Apache2::Const::REDIRECT;
> >
> > to:
> >
> > return Apache2::Const::HTTP_MOVED_PERMANENTLY;
> >
> > I get:
> >
> > Bareword "Apache2::Const::HTTP_MOVED_PERMANENTLY" not allowed while
> > "strict subs" in use
>
> You need something like:
> use Apache2::Const -compile => qw(OK DECLINED HTTP_MOVED_PERMANENTLY..);

It's working.  Thank you very much.

- Grant


> > I'm using mod_perl-2.0.2 and apache-2.0.58.  Any ideas?
> >
> > - Grant

Re: Fixing a mod_perl module

Posted by Clinton Gormley <cl...@traveljury.com>.
> When I change:
> 
> return Apache2::Const::REDIRECT;
> 
> to:
> 
> return Apache2::Const::HTTP_MOVED_PERMANENTLY;
> 
> I get:
> 
> Bareword "Apache2::Const::HTTP_MOVED_PERMANENTLY" not allowed while
> "strict subs" in use

You need something like:
use Apache2::Const -compile => qw(OK DECLINED HTTP_MOVED_PERMANENTLY..);

> I'm using mod_perl-2.0.2 and apache-2.0.58.  Any ideas?
> 
> - Grant

________________________________________________________________________

Clinton Gormley clinton@traveljury.com

www.TravelJury.com - For travellers, By travellers




Re: Fixing a mod_perl module

Posted by Grant <em...@gmail.com>.
> > Hello, I'm on the Interchange mailing list (icdevgroup.org) and we've
> > found a problem with our Interchange::Link mod_perl module for
> > apache2.  I don't know perl myself, and I was wondering if anyone here
> > might be able to help fix it.
> >
> > The problem is that the Interchange tag:
> >
> > [bounce href="http://www.domain.com" status="301 moved"]
> >
> > uses the default 302 code when Interchange::Link is used.  It uses the
> > specified 301 without Interchange::Link.  The problem has been
> > isolated to this portion of code from Interchange::Link :
> >
> > if($set_status =~ /^30[21]/) {
> > #warn "Doing redirect\n";
> >  $r->content_type($set_content);
> >  close (SOCK)                                or die "close: $!\n";
> >  return Apache2::Const::REDIRECT;
> > }
>
> Apache2::Const::REDIRECT is 302 and is equivalent to
> Apache2::Const::HTTP_MOVED_TEMPORARILY.  if you want 301 you will want
> to use Apache2::Const::HTTP_MOVED_PERMANENTLY.

When I change:

return Apache2::Const::REDIRECT;

to:

return Apache2::Const::HTTP_MOVED_PERMANENTLY;

I get:

Bareword "Apache2::Const::HTTP_MOVED_PERMANENTLY" not allowed while
"strict subs" in use

I'm using mod_perl-2.0.2 and apache-2.0.58.  Any ideas?

- Grant

Re: Fixing a mod_perl module

Posted by Geoffrey Young <ge...@modperlcookbook.org>.
Grant wrote:
> Hello, I'm on the Interchange mailing list (icdevgroup.org) and we've
> found a problem with our Interchange::Link mod_perl module for
> apache2.  I don't know perl myself, and I was wondering if anyone here
> might be able to help fix it.
> 
> The problem is that the Interchange tag:
> 
> [bounce href="http://www.domain.com" status="301 moved"]
> 
> uses the default 302 code when Interchange::Link is used.  It uses the
> specified 301 without Interchange::Link.  The problem has been
> isolated to this portion of code from Interchange::Link :
> 
> if($set_status =~ /^30[21]/) {
> #warn "Doing redirect\n";
>  $r->content_type($set_content);
>  close (SOCK)                                or die "close: $!\n";
>  return Apache2::Const::REDIRECT;
> }

Apache2::Const::REDIRECT is 302 and is equivalent to
Apache2::Const::HTTP_MOVED_TEMPORARILY.  if you want 301 you will want
to use Apache2::Const::HTTP_MOVED_PERMANENTLY.

HTH

--Geoff