I'm trying to port a preexisting CGI app to mod_perl2 and could use some
help.

Here goes a test case that should illustrate my problem:

The code pasted below loads the page properly the first time it's accessed.
However, upon multiple reloads in firefox, the headers either disappear
altogether or the page is downloaded in the download manager.  I assume this
is because the wrong $r object is being accessed by the request?  In any
case, I'm at a loss and would really appreciate some input.  Thanks in
advance.

---------------------------
---------------------------
File: tester.cgi
=============
#!/usr/bin/perl


use strict;
use lib qw(.....);

use testme::testmod;

my $r = shift;

my $object = testme::testmod->instance($r);
$object->printme();
1;


=============
File: testme/testmod.pm
=============

package testme::testmod;

use Apache2::RequestUtil;
use strict;

use base qw /Class::Singleton/;

sub printme{

    my ( $self, $args ) = @_;

    my $r = Apache2::RequestUtil->request;

    $self->{r}->content_type('text/html');

    print "A Page of Rendered HTML\n";
}

sub _new_instance{

    my ( $class, $r ) = @_;

    my $self = {};

    bless $self, $class;

    $self->{r} = $r;

    return ( $self );

}

1;

Reply via email to