Apache-Test

 view release on metacpan or  search on metacpan

lib/Apache/TestMB.pm  view on Meta::CPAN

  my $build = $build_pkg->new(
      module_name => 'My::Module',
  );
  $build->create_build_script;

This is identical to how C<Module::Build> is used. Not all target
systems may have C<Apache::Test> (and therefore C<Apache::TestMB>
installed, so we test for it to be installed, first. But otherwise,
its use can be exactly the same. Consult the
L<Module::Build|Module::Build> documentation for more information on
how to use it; L<Module::Build::Cookbook|Module::Build::Cookbook> may
be especially useful for those looking to migrate from
C<ExtUtils::MakeMaker>.

=head1 INTERFACE

=head2 Build

With the above script, users can build your module in the usual
C<Module::Build> way:

t/cgi-bin/cookies.pl.PL  view on Meta::CPAN

#!perl -wT

use strict;

use CGI;
use CGI::Cookie;

my %cookies = CGI::Cookie->fetch;
my $name = 'ApacheTest';
my $c = ! exists $cookies{$name}
    ? CGI::Cookie->new(-name=>$name, -value=>time)
    : '';

print "Set-Cookie: $c\n" if $c;
print "Content-Type: text/plain\n\n";
print ($c ? 'new' : 'exists'), "\n";

t/cookies.t  view on Meta::CPAN

# this test tests how a cookie jar can be passed (needs lwp)

use strict;
use warnings FATAL => 'all';

use Apache::Test;
use Apache::TestRequest;
use Apache::TestUtil;

plan tests => 2, need [qw(CGI CGI::Cookie)],
                      need_cgi, need_lwp, need need_module('mod_alias.c');

Apache::TestRequest::user_agent( cookie_jar => {} );

my $url = '/cgi-bin/cookies.pl';

ok t_cmp GET_BODY($url), 'new', "new cookie";
ok t_cmp GET_BODY($url), 'exists', "existing cookie";



( run in 0.464 second using v1.01-cache-2.11-cpan-4e96b696675 )