I think a better solution would be to make PerlRun use real object-oriented
thinking (method handlers), something like this:

    sub handler ($$) {
        my($class, $r) = @_;
        my $pr = $class->new($r);
        ...
    }

My personal philosophy is that any given class's name should only be written
exactly once, in the "package Apache::PerlRun;" statement.  Everything else
should be __PACKAGE__ (or $class to facilitate object-orientation).


You may want to look at Apache::RegistryNG, it derives from PerlRun too.


[EMAIL PROTECTED] (Yasushi Nakajima) wrote:
>Hello All
>
>I have made a module derived from PerlRun. It overrides only readscript()
>method in PerlRun. First I wrote as follows (essencial part only)
>
>    package Apache::PerlRunFake;
>    use Apache::PerlRun;
>    @ISA = qw(Apache::PerlRun);
>    sub readscript {
>       ...
>    }
>    *handler = \&Apache::PerlRun::handler;
>
>But Apache::PerlRun::handler() inclueds following code.
>
>    my $pr = Apache::PerlRun->new($r);
>
>It must be Apache::PerlRunFake->new() in Apache::PerlRunFake. I'm
>obliged to copy the whole codes of handler() in PerlRun.pm to
>PerlRunFake.pm and modify the above-mentioned part. This will cause a
>version problem between Apache::PerlRun::handler() and
>Apache::PerlRunFake::handler() in the future.
>
>If handler() in Apache::PerlRun is written as follows,
>
>    sub handler { # only entry
>        my $r = shift;
>        my $pr = Apache::PerlRun->new($r);
>        $pr->handler_body;
>    }
>    sub handler_body { # contents are here
>        my $pr = shift;
>        ...
>    }
>
>I can write Apache::PerlRunFake as follows,
>
>    package Apache::PerlRunFake;
>    use Apache::PerlRun;
>    @ISA = qw(Apache::PerlRun);
>    sub readscript {
>       ...
>    }
>    sub handler {
>        my $r = shift;
>        my $pr = Apache::PerlRunFake->new($r);
>        $pr->handler_body;
>    }
>
>Then version problem will not occur.
>
>
>Sey Nakajima <[EMAIL PROTECTED]>
>Kyoto, Japan
>

  -------------------                            -------------------
  Ken Williams                             Last Bastion of Euclidity
  [EMAIL PROTECTED]                            The Math Forum

Reply via email to