in reply to Where can I buy an $r with which to test Apache2::Cookie?

I've never played with mod_perl in my life ... but my reading of the docs you cite is that if you use Apache2::RequestUtil then it adds a a new method for Apache2::RequestRec ... but you still have to specify some args (namely a connection)

(your first example code doesn't use Apache2::RequestUtil, your second example doesn't pass any args to Apache2::RequestRec->new() and you don't specify what kind of error you get)

Then again, i could be totally wrong.

You might also want to google unit test mod_perl code ... that turned up several promising looking links, many right here on perlmonks.

Replies are listed 'Best First'.
Re^2: Where can I buy an $r with which to test Apache2::Cookie?
by frostman (Beadle) on Feb 11, 2008 at 05:50 UTC

    Thanks for the reply. Are you sure Apache2::RequestUtil adds that method? Is there some secret way in which you need to load it for that to happen?

    I did try that, because I believe that's what the docs say, but as far as I could tell the docs are wrong.

    Sorry for the obscurantist test comment last time, here's a better one that actually passes:

    use strict; use warnings; use Test::More tests => 1; use Apache2::Cookie 2.08; use Apache2::RequestRec 2.0; use Apache2::RequestUtil 2.0; eval { my $r = Apache2::RequestRec->new(); }; like( $@, qr/Can't locate object method "new" via package "Apache2::RequestR +ec"/ );