Home > Archive > PERL Programming > April 2004 > error message cobalt server - script perl
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
error message cobalt server - script perl
|
|
| tech-informatique 2004-04-05, 4:31 am |
|
help,
I wrote this code to make a little search engine on my site :
#!/usr/bin/perl
# Lire les parametres en entree
$tagnosearch = '<!--NOSEEK//-->';
$url = "rep de base";
read(STDIN, $cache, $ENV{'CONTENT_LENGTH'});
@tabrequetes = split(/&/,$cache);
foreach $tabrequete(@tabrequetes){
($mot, $valeur) = split(/=/,$tabrequete);
$valeur =~ s/\+/ /g;
$FORM{$mot}=$valeur;
}
$basepath = '/home/sites/xxx/web/rep1/rep2/rep3';
@path = ('ssrep1','ssrep2','ssrep3',
'ssrep4','ssrep5','ssrep6',
'ssrep7');
@tabfich = ('*.html','*.php','*.htm')
;
@motsrecherche = split(/\s+/,$FORM{'motsrecherche'});
foreach $path(@path){
$absolutepath='';
$absolutepath = $basepath+$path;
chdir($absolutepath);
foreach $tabfich(@tabfich){
$ls = `ls $tabfich`;
@TABPAGES = split(/\s+/,$ls);
foreach $TABPAGE(@TABPAGES){
open(TABPAGE,"$TABPAGE");
if (<TABPAGE> ne $tagnosearch){
@lignes = <TABPAGE>;
close(TABPAGE);
$chaine = join('.', @lignes);
$chaine =~ s/\n//g;
foreach $motrecherche (@motsrecherche) {
if ($chaine=~ /$motrecherche/i) {
$INCLURE{$TABPAGE}='oui';
}
else{
$INCLURE{$TABPAGE}='non';
}
if ($chaine=~ /<title>(.*)<\title>/i) {
$TITRE{$TABPAGE} = "$1";
}
else {
$TITRE{$TABPAGE} = "$TABPAGE";
}
}
}
else{
close(TABPAGE);
}
}
foreach $resultat (%INCLURE) {
if ($INCLURE{$resultat} eq 'oui') {
print "<a href=\"$url$resultat\">$TITRE{$resultat}</a>\n";
}
}
}
When I execute this script on my form, I receive this message :
Internal Server Error
The server encountered an internal error or misconfiguration and was unable
to complete your request.
thank you in advance for your answers.
| |
| Jürgen Exner 2004-04-05, 10:31 am |
| tech-informatique wrote:
[...]
> When I execute this script on my form, I receive this message :
>
> Internal Server Error
> The server encountered an internal error or misconfiguration and was
> unable to complete your request.
Please see the FAQ "perldoc -q 500" which addressed exactly this problem.
jue
| |
| Dave Cross 2004-04-05, 11:37 am |
| On Mon, 05 Apr 2004 10:00:24 +0200, tech-informatique wrote:
> When I execute this script on my form, I receive this message :
>
> Internal Server Error
> The server encountered an internal error or misconfiguration and was unable
> to complete your request.
>
> thank you in advance for your answers.
What does the web server error log say?
Did you try checking for syntax errors with "perl -c"?
Does your editor not check for matching brackets?
You have one two few closing braces.
Dave...
| |
| Dave Cross 2004-04-05, 11:37 am |
| On Mon, 05 Apr 2004 15:13:27 +0100, Dave Cross wrote:
> You have one two few closing braces.
Er... I mean "one _too_ few".
Dave...
[ hugely embarrassed ]
| |
| Jim W. 2004-04-05, 1:35 pm |
| Dave Cross wrote:
> On Mon, 05 Apr 2004 15:13:27 +0100, Dave Cross wrote:
>
>
>
>
> Er... I mean "one _too_ few".
>
> Dave...
> [ hugely embarrassed ]
We knew what you meant. :-) Thanks!
| |
|
| Perl reports to me that you're missing a bracket or brace. Run this
from command line and let Perl tell you what's wrong.
-jc
tech-informatique wrote:
> help,
>
> I wrote this code to make a little search engine on my site :
>
> #!/usr/bin/perl
>
> # Lire les parametres en entree
>
> $tagnosearch = '<!--NOSEEK//-->';
> $url = "rep de base";
> read(STDIN, $cache, $ENV{'CONTENT_LENGTH'});
> @tabrequetes = split(/&/,$cache);
>
> foreach $tabrequete(@tabrequetes){
> ($mot, $valeur) = split(/=/,$tabrequete);
> $valeur =~ s/\+/ /g;
> $FORM{$mot}=$valeur;
> }
> $basepath = '/home/sites/xxx/web/rep1/rep2/rep3';
> @path = ('ssrep1','ssrep2','ssrep3',
> 'ssrep4','ssrep5','ssrep6',
> 'ssrep7');
>
> @tabfich = ('*.html','*.php','*.htm')
> ;
> @motsrecherche = split(/\s+/,$FORM{'motsrecherche'});
>
> foreach $path(@path){
> $absolutepath='';
> $absolutepath = $basepath+$path;
> chdir($absolutepath);
>
> foreach $tabfich(@tabfich){
>
> $ls = `ls $tabfich`;
> @TABPAGES = split(/\s+/,$ls);
> foreach $TABPAGE(@TABPAGES){
>
> open(TABPAGE,"$TABPAGE");
>
> if (<TABPAGE> ne $tagnosearch){
>
> @lignes = <TABPAGE>;
> close(TABPAGE);
> $chaine = join('.', @lignes);
> $chaine =~ s/\n//g;
>
> foreach $motrecherche (@motsrecherche) {
>
> if ($chaine=~ /$motrecherche/i) {
> $INCLURE{$TABPAGE}='oui';
> }
> else{
>
> $INCLURE{$TABPAGE}='non';
> }
>
> if ($chaine=~ /<title>(.*)<\title>/i) {
> $TITRE{$TABPAGE} = "$1";
> }
> else {
> $TITRE{$TABPAGE} = "$TABPAGE";
> }
> }
>
> }
> else{
> close(TABPAGE);
>
> }
>
> }
>
> foreach $resultat (%INCLURE) {
> if ($INCLURE{$resultat} eq 'oui') {
> print "<a href=\"$url$resultat\">$TITRE{$resultat}</a>\n";
> }
> }
>
>
> }
>
> When I execute this script on my form, I receive this message :
>
> Internal Server Error
> The server encountered an internal error or misconfiguration and was unable
> to complete your request.
>
> thank you in advance for your answers.
>
>
|
|
|
|
|