Module fails - but nothing is logged
am 09.02.2008 16:31:06 von brett leeSo I've been running my shiny new perl module for a couple weeks now without any issues. I call the module (Nav::Ad) four times (header, footer, left, right) from each of my "Registry" scripts. The Registry scripts parse a html file and decide whether to execute the module or just print out the HTML like so:
my $COLUMN1 = "$ENV{DOCUMENT_ROOT}/column1.shtml";
if (open (FILE, $COLUMN1)) {
while (
if ( $_ =~ m/printAd.cgi/ ) {
Nav::Ad::printAd( 'Type=column', 'Logo=y', 'Num=7', 'Sep=y');
} else {
print;
}
}
close FILE;
};
I'm in the process of changing the scripts so that it no longer opens a file for each of these. As it stands now, a new module that contains the text in each of the four files has been created. For example, the HTML in column 1 is stored in "$column1", and then:
@Column1 = split $/, $column1
sub printcolumn1 {
foreach (@Column1) {
if ( $_ =~ m/printAd.cgi/ ) {
Nav::Ad::printAd( 'Type=column', 'Logo=y', 'Num=7', 'Sep=y');
} else {
print;
}
};
}
My problem is that this works fine for several requests, but then it fails. And when it fails, ALL four (left,right,top,bottom) of the arrays that have calls to "printAd" fail. Never just one, always all four. The rest of the HTML in the arrays is displayed.
In lieu of the expected HTML, the "SCRIPT_NAME" of the Registry script is displayed (e.g. /cgi-bin/script.cgi ).
That's all I can find anywhere to help me. Am running Apache in debug, nothing in the logs.
Again, "script.cgi" is a Registry script, and Nav::Ad:: doesn't change between FILE-based and Module-based. Nav::Ad seems to work perfectly when parsing an actual file, but when the file is placed into a string in a module it fails after some small number of requests and leaves me clueless as to why.
Insight into this would REALLY be appreciated. Thanks.
____________________________________________________________ ________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ