-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dan Richman wrote:
> Got a server running Apache2/mod_perl2 and Mason.  Everything works 
> fine, with one big exception.
> 
> %ARGS seems to be "holding on" to past values.  So if I hit 
> /foo/bar/?param1=hello&param2=world, it seems to "remember" the query 
> string and if I issue a totally separate request (even on a different 
> browser), it "remembers" old values.
> 
> Very, very weird.  I've checked apache logs and the request is processed 
> fine.  It's obviously something with Mason.
"Obviously?!"

> Reminds me of the old days of mod_perl if you didn't "use strict" -- it
> would cause variables to persist.
(yet another "funny" statement)

Attached you'll find a test case which should help you decide if it's really
Mason's flaw. Please remember to enable maintainer mode when running it.

> Any help is appreciated!!!
'HTH.
- --
Marius Feraru
-----BEGIN PGP SIGNATURE-----

iD8DBQFG/ar/tZHp/AYZiNkRAhr2AJ0dAXP9Y6T9fbZwmPQRiphdTDc4FgCg9Oum
h6iEdTa+APeMivl7huWUz2Q=
=nIHC
-----END PGP SIGNATURE-----
#
# kludged from 08-ah.t
#

use strict;
use warnings;
use File::Spec;
use HTML::Mason::Tests;
use Module::Build;
use Test::More qw(no_plan);

my $test_data = eval { Module::Build->current->notes('test_data') };

# Skip test if no mod_perl
eval { require mod_perl2 };
if ($@) {
    eval { require mod_perl };
}
my $mpver;
{
    no warnings 'once';
    $mpver = ( $mod_perl2::VERSION || $mod_perl::VERSION );
}
my $apreq_module
    = $mpver && $mpver >= 2 ? 'Apache2::Request' : 'Apache::Request';

unless ( $test_data
    && $test_data->{is_maintainer}
    && exists $test_data->{apache_dir}
    && $test_data->{apache_dir}
    && -d $test_data->{apache_dir} )
{
    plan skip_all => '$test_data->{is_maintainer} is not true or '
        . '$test_data->{apache_dir} is not a directory';
}

use lib 'lib', File::Spec->catdir( 't', 'lib' );

require File::Spec->catfile( 't', 'live_server_lib.pl' );

use Apache::test qw(skip_test have_httpd have_module);

plan skip_all => 'have_httpd evaluates false.'
    unless have_httpd();

local $| = 1;

# needed for Apache::test->fetch to work
local $ENV{PORT} = $test_data->{port};

kill_httpd(1);
test_load_apache();

print STDERR "\n";

write_comp( 'echo', << 'EOF' );
<%once>
  use Data::Dumper ();
</%once>
<% Data::Dumper->new([ \%ARGS ])->Terse(1)->Indent(0)->Sortkeys(1)->Dump %>
EOF

params_tests('mod_perl') if have_module($apreq_module);
params_tests('CGI')      if have_module('CGI');
cleanup_data_dir();
exit 0;

sub params_tests {
    my ($handler) = @_;

    cleanup_data_dir();
    start_httpd( $handler . '_no_handler' );

    my $path = '/comps/echo';
    my ( $foo, $bar ) = ( 10, 20 );
    while ( $foo-- && $bar-- ) {
        my ( $to_fetch, $req_type )
            = $foo % 2 ? ( "$path?foo=$foo&bar=$bar", 'GET' )
            : $foo % 4 ? (
            {   uri     => $path,
                method  => 'POST',
                content => "foo=$foo&bar=$bar"
            },
            'POST'
            )
            : (
            {   uri     => "$path?foo=$foo",
                method  => 'POST',
                content => "bar=$bar"
            },
            'POST-mixed'
            );
        my $response = Apache::test->fetch($to_fetch);
        my $success  = HTML::Mason::Tests->tests_class->check_output(
            actual => $response->content,
            expect => qq[{'bar' => '$bar','foo' => '$foo'}]
        );
        ok( $success, "$handler, $req_type" );
    }
    kill_httpd(1);
}
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Mason-users mailing list
Mason-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mason-users

Reply via email to