Hi, I have a simple index.epl page which I want to read through the files within a directory and extract a comment line which contains a description for the file. However, opening the files is no problem - if I remove the while read loop the code executes, albeit uselessly. Otherwise reading appears to block. I've also tried reading single files, which do the same. Any ideas anyone?
Page code:
---
<HTML>
<HEAD>
<meta name="description" content="Index">
<TITLE>Report Index</TITLE>
</HEAD>
<BODY>
[-
sub GetName {
my ($ReportName)=@_;
my $ReportDesc="";
open(REPORT,$ReportName) or die "Cannot open report file $ReportName:
$!\n";
while(<REPORT>) {
# eg <!-- Report="Test Report" --!>
if (/<!-- Report/) {
(undef,$ReportDesc,undef)=split('\"');
last;
}
}
close(REPORT);
return $ReportDesc;
}
# Main section
opendir(REPORTDIR, ".") or die "Cannot open report directory: $!";
@Reports=grep /\.epl/, readdir REPORTDIR;
closedir REPORTDIR;
$Dir=$ENV{'SCRIPT_FILENAME'}; # get full path to this file
$Dir=~s/\w+\.\w+$//; # rip out this filename to leave
directory path
foreach $Rep (grep !/index.epl/,@Reports) {
push(@Category,$Dir . $Rep); # save for later use
}
-]
[$ foreach $line (@Category) $]
[+ sprintf("<BR>%s", GetName($line)) +]
[$ endforeach $]
</BODY>
</HTML>
---
<<attachment: winmail.dat>>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
