There is no spoon.
Seriously though, JavaScript is parsed, not executed (similar to perl, but not). You have to provide a link to an actual file containing JavaScript commands that your browser's JavaScript parsing engine can understand and properly parse. Passing it a Perl script will do nothing, except cause the internal browser JavaScript parser to silently abort with an error (unless you have a browser with a JavaScript debugging console). The browser's internal JavaScript parsing engine doesn't understand how to properly parse perl constructs (thankfully), and leaves it alone.
Also, even if that could work, your perl script is redundant, since you're already passing a Content-Type when your webserver sends the .html page to the client, and you then parse a perl script which passes it again, right in the middle of existing content.
In short, use the Perl interpretor to interpret perl, and the JavaScript interpretor to interpret JavaScript.
How about using this instead, less code, easier to maintain:
#!/usr/bin/perl use strict; # ALWAYS use strict use CGI qw(p br); my $cgi = CGI->new(); print $cgi->header(); print $cgi->start_html(-title=>'Welcome'), "\n"; print p('Acesta este pagina de index si mai jos se afla legatura facuta la test.pl'); print p('Acesta este continutul fisierului'), br(); print $cgi->end_html();
You could also do this all in one print statement, if you wish:
#!/usr/bin/perl use strict; # ALWAYS use strict use CGI qw(p br); my $cgi = CGI->new(); print $cgi->header(), $cgi->start_html(-title=>'Welcome'), "\n", p('Acesta este pagina de index si mai jos se afla legatura facuta la test.pl'), p('Acesta este continutul fisierului'), br(). $cgi->end_html();
TMTOWTDI
In reply to Re: Problem to include a perl file
by hacker
in thread Problem to includ a perl file
by webstudioro
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |