[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: very old bug report about internal_redirect



:-> "Geoffrey" == Geoffrey Young <geoff@modperlcookbook.org> writes:

    > Pierfrancesco Caci wrote:
    >> Hello,
    >> in Debian there is a very old bug report about internal_redirect, the
    >> full text of which you can read at the following url, along with the
    >> necessary to reproduce it:
    >> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=130883&repeatmerged=no
    >> The submitter also posted a similar request on this mailing list
    >> (http://www.geocrawler.com/archives/3/182/2002/1/50/7687949/)
    >> but I have not been able to locate a reply.
    >> I have been able to verify that the "bug" is still present with these
    >> versions:
    >> apache    1.3.29
    >> mod_perl  1.29
    >> perl      5.8.1
    >> What is not clear to me is if this is indeed a bug, a "feature", or
    >> just a programming error on the side of the original complainant.

    > I remember this but never had the time to track it down.

    > the first thing I'd do would be to put each package/class in it's own
    > .pm file and PerlModule each one separately.  if the problem persists
    > I'll look into it.

Ok, first I've tried splitting "Redir" in it's own .pm file, and the
bug is still there.


Splitting Impl1 and Impl2 to their own files doesn't work either.

This is the configuration so far:

<Location /0>
  Order allow,deny
  Allow from all
  SetHandler perl-script
  PerlHandler Common
</Location>

<Location /1>
  Order allow,deny
  Allow from all
  SetHandler perl-script
  PerlHandler Common::Impl1
</Location>

<Location /2>
  Order allow,deny
  Allow from all
  SetHandler perl-script
  PerlHandler Common::Impl2
</Location>

<Location /R>
  Order allow,deny
  Allow from all
  SetHandler perl-script
  PerlHandler Redir
</Location>

PerlRequire startup.pl
PerlRequire redir.pl
PerlRequire impl1.pl
PerlRequire impl2.pl


Now, I've tried to make a different setup with separate PerlModule's
like this:

  PerlModule bug130883::Common
<Location /0>
  Order allow,deny
  Allow from all
  SetHandler perl-script
  PerlHandler bug130883::Common
</Location>

  PerlModule bug130883::Impl1
<Location /1>
  Order allow,deny
  Allow from all
  SetHandler perl-script
  PerlHandler bug130883::Common::Impl1
</Location>

  PerlModule bug130883::Impl2
<Location /2>
  Order allow,deny
  Allow from all
  SetHandler perl-script
  PerlHandler bug130883::Common::Impl2
</Location>

  PerlModule bug130883::Redir
<Location /R>
  Order allow,deny
  Allow from all
  SetHandler perl-script
  PerlHandler bug130883::Redir
</Location>


and in /usr/local/lib/site_perl I have

$ ls bug130883/
Common.pm  Impl1.pm  Impl2.pm  Redir.pm

I had to modify the original scripts so as each one has it's "handler"
subroutine:

Common.pm:
# Common
package bug130883::Common;

use Apache::Constants qw(:common);

sub handler($$)
  {
    my $self = shift;
    my $req = shift;
    $req->content_type('text/plain');
    $req->send_http_header();
    $req->print($self->doit());
    return OK;
  }

sub doit
  {
    return "COMMON";
  }

1;
---------------
Impl1.pm:
# Common::Impl1
package bug130883::Common::Impl1;

use Apache::Constants qw(:common);

sub handler($$)
  {
    my $self = shift;
    my $req = shift;
    $req->content_type('text/plain');
    $req->send_http_header();
    $req->print($self->doit());
    return OK;
  }

@ISA=qw(Common);

sub doit
  {
    return "IMPL1\n";
  }

1;
---------------
Impl2.pm:
# Common::Impl2;
package bug130883::Common::Impl2;

@ISA=qw(Common);

use Apache::Constants qw(:common);

sub handler($$)
  {
    my $self = shift;
    my $req = shift;
    $req->content_type('text/plain');
    $req->send_http_header();
    $req->print($self->doit());
    return OK;
  }



sub doit
  {
    return "IMPL2\n";
  }

1;
---------------
Redir.pm:
# Redir
package bug130883::Redir;

use Apache::Constants qw(:common);

sub handler
  {
    my $req = shift;
    $req->internal_redirect("/1");
    return OK;
  }

1;

---------------

With this setup, the error message changes:

Now I have:

[Sun Nov  9 20:17:26 2003] [error] Can't call method "content_type" on an undefined value at /usr/local/lib/site_perl/bug130883/Impl1.pm line 10.

when I try to access /R

It may well be an error on my side here, as this is quickly drifting
away of my scarce knowledge of perl modules.

Any other hints ?

Pf



-- 

-------------------------------------------------------------------------------
 Pierfrancesco Caci | ik5pvx | mailto:p.caci@tin.it  -  http://gusp.dyndns.org
  Firenze - Italia  | Office for the Complication of Otherwise Simple Affairs 
     Linux penny 2.6.0-test9 #1 Fri Oct 31 22:51:12 CET 2003 i686 GNU/Linux



Reply to: