"Fossies" - the Fresh Open Source Software Archive

Member "mod_perl-2.0.11/t/response/TestModperl/method.pm" (5 Oct 2019, 1012 Bytes) of package /linux/www/apache_httpd_modules/mod_perl-2.0.11.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "method.pm": 2.0.8_vs_2.0.9.

    1 # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*-
    2 package TestModperl::method;
    3 
    4 use strict;
    5 use warnings FATAL => 'all';
    6 
    7 use Apache::Test;
    8 use Apache::TestUtil;
    9 use Apache::TestRequest;
   10 
   11 use Apache2::Const -compile => 'OK';
   12 
   13 sub new {
   14     my $class = shift;
   15 
   16     bless {
   17         perl_version => $],
   18     }, $class;
   19 }
   20 
   21 sub handler : method {
   22     my ($self, $r) = @_;
   23 
   24     my $tests = 3;
   25 
   26     my $is_obj = ref($self);
   27 
   28     if ($is_obj) {
   29         $tests += 1;
   30     }
   31 
   32     plan $r, tests => $tests;
   33 
   34     ok t_cmp(scalar @_, 2,
   35              '@_ == 2');
   36 
   37     my $class = ref($self) || $self;
   38 
   39     ok t_cmp($class, $class,
   40              'handler class');
   41 
   42     ok t_cmp(
   43         $r->uri,
   44         '/' . Apache::TestRequest::module2path($class),
   45         '$r->uri eq $location');
   46 
   47     if ($is_obj) {
   48         ok t_cmp($self->{perl_version}, $],
   49                  'object handler data');
   50     }
   51 
   52     Apache2::Const::OK;
   53 }
   54 
   55 1;
   56 __END__