I am new to x10 and am having weird problems with server side html and perl.
In my index.shtml file, I use the following
updater.pl (see below) is a perl script I wrote many years ago
The weird thing is that print statements only seem to work near the end of the file. But print statements at the beginning of the file either don't print anything, or sometimes cause an error to be returned.
I have tried simple things like
and it doesn't print or returns an error. I have also tried changing the server side include line
and get equally unpredictable but different results. Some changes cause errors, others work in certain places but not others, others do nothing.
Any ideas?
Current code that works magically, but weirdly chooses to only print only late lines but not early ones.
In my index.shtml file, I use the following
Code:
<!--#include virtual="cgi-bin/updater.pl"-->
The weird thing is that print statements only seem to work near the end of the file. But print statements at the beginning of the file either don't print anything, or sometimes cause an error to be returned.
I have tried simple things like
Code:
#!/usr/bin/perl -w
print "hello world\n";
Code:
<!--#exec cmd="cgi-bin/updater.pl"-->
Any ideas?
Current code that works magically, but weirdly chooses to only print only late lines but not early ones.
Code:
#!/usr/bin/perl -w
$featurememe = -e "m.up";
$featureecon = -e "e.up";
$featurepict = -e "p.up";
$featureword = -e "w.up";
open(MEMES, "../memesblog.html");
while(($memeln = <MEMES>) && !$memesdate)
{
next unless $memeln =~ /\"date-header\".+, (.+, .+)\</;
$memesdate = $1;
}
open(PICTURES, "../photoblog/index.html");
while(($photoln = <PICTURES>) && !$photodate)
{
next unless $photoln =~ /\"date-header\".+, (.+, .+)\</;
$photodate = $1;
}
while(<MEMES>)
{
next unless /\"post-title\">/;
$ln1 = <MEMES>;
$ln2 = <MEMES>;
chop($ln2);
chop($ln2);
$latestmeme = "<b>Latest in Memes ($memesdate): <a target=\"_top\" href=\"memesblog.html\">". $ln2."</a></b><br>\n";
close(MEMES);
}
close(MEMES);
while(<PICTURES>)
{
next unless /\"post-title\">/;
$ln1 = <PICTURES>;
$ln2 = <PICTURES>;
chop($ln2);
chop($ln2);
$latestpict = "<b>Latest in Photos ($photodate): <a target=\"_top\" href=\"photoblog/index.html\">". $ln2."</a></b><br>\n";
close(PICTURES);
}
close(PICTURES);
print STDOUT "but this does not works!";
print "but this does not works!";
print "but this does not works!";
print "but this does not works!";
print "but this does not works!";
print "but this does not works!";
print $latestmeme if $featurememe;
print "\n" if !$featurememe;
print $latestpict if $featurepict;
print "\n" if !$featurepict;
print $latestmeme if $featurememe;
print "\n" if !$featurememe;
print $latestpict if $featurepict;
print "\n" if !$featurepict;
print "anything down here works!";
print STDOUT "anything down here works!";
print "anything down here works!";