I just copied this script from CGI::Ajax manual at cpan.org page
use strict;
use CGI; # or any other CGI:: form handler/decoder
use CGI::Ajax;
my $cgi =3D new CGI;
my $pjx =3D new CGI::Ajax( 'exported_func' =3D> \&perl_func );
print $pjx->build_html( $cgi, \&Show_HTML);
sub perl_func {
my $input =3D shift;
# do something with $input
my $output =3D $input . " was the input!";
return( $output );
}
sub Show_HTML {
my $html =3D <
Enter something:
onkeyup=3D"exported_func( ['val1'], ['resultdiv'] );">
EOHTML
return $html;
}
And I get the error:
Can't find string terminator "EOHTML" anywhere before EOF at ./ajax.pl line
37.
What's wrong?
--=20
Pau Marc Mu=F1oz Torres
Laboratori de Biologia Computacional
Institut de Biotecnologia i Biomedicina Vicent
Villar
Universitat Autonoma de Barcelona
E-08193 Bellaterra (Barcelona)
Re: Can"t find string terminator "EOHTML" anywhere before EOF
am 04.04.2008 16:39:24 von Jenda Krynicky
From: "Pau Marc Munoz Torres"
> I just copied this script from CGI::Ajax manual at cpan.org page
>
> use strict;
> use CGI; # or any other CGI:: form handler/decoder
> use CGI::Ajax;
>
> my $cgi = new CGI;
> my $pjx = new CGI::Ajax( 'exported_func' => \&perl_func );
>
> print $pjx->build_html( $cgi, \&Show_HTML);
>
> sub perl_func {
> my $input = shift;
> # do something with $input
> my $output = $input . " was the input!";
> return( $output );
> }
>
> sub Show_HTML {
> my $html = <
>
>
> Enter something:
>
> onkeyup="exported_func( ['val1'], ['resultdiv'] );">
>
>
>
>
> EOHTML
Most likely you have some whitespace before or after the EOHTML.
Remove it.
Jenda
===== Jenda@Krynicky.cz === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery
--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/
Re: Can"t find string terminator "EOHTML" anywhere before EOF
am 04.04.2008 16:40:34 von Rob Dixon
Pau Marc Munoz Torres wrote:
> Hi
>
> I just copied this script from CGI::Ajax manual at cpan.org page
>
> use strict;
> use CGI; # or any other CGI:: form handler/decoder
> use CGI::Ajax;
>
> my $cgi = new CGI;
> my $pjx = new CGI::Ajax( 'exported_func' => \&perl_func );
>
> print $pjx->build_html( $cgi, \&Show_HTML);
>
> sub perl_func {
> my $input = shift;
> # do something with $input
> my $output = $input . " was the input!";
> return( $output );
> }
>
> sub Show_HTML {
> my $html = <
>
>
> Enter something:
>
> onkeyup="exported_func( ['val1'], ['resultdiv'] );">
>
>
>
>
> EOHTML
> return $html;
> }
>
> And I get the error:
>
> Can't find string terminator "EOHTML" anywhere before EOF at ./ajax.pl line
> 37.
>
> What's wrong?
The here-document terminator EOHTML must be on its own on the line, i.e.
there can't be any whitespace before or after it or it won't be found.
Rob
--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/
Re: Can"t find string terminator "EOHTML" anywhere before EOF