Subject: | @MATCH isn't cleared, causes problems with mod_perl |
Hi,
As you may know, mod_perl is stateful, and a variable's content is remembered from one execution to the next.
When executing the following code in mod_perl, if I execute two searches, one after the other, the second search returns the contents of both searches.
my $title = "Terminator"; # Change this on second search
my $imdb = IMDB::Movie->new($title);
my @matches = @{$imdb->matches};
foreach my $match (@matches) {
print $match->{title};
}
I fixed this by adding the following line to Movies.pm:
@MATCH = ();
I added it just below "$site ||= 'www';" in the 'new' function in version 0.12.
Hope this all made sense...
Thanks,
Damian Hole
--
Distribution: IMDB-Movie-0.12
OS: Gentoo Linux
perl -v: This is perl, v5.8.2 built for i686-linux
uname -a: Linux black.home 2.4.25_pre6-gss #1 SMP Tue Jan 27 08:47:50 EST 2004 i686 Pentium II (Deschutes) GenuineIntel GNU/Linux
mod_perl version: 1.99.09
apache version: 2.0.48