Gossamer Forum
Home : General : Perl Programming :

Java in a perl generated code

Quote Reply
Java in a perl generated code
I had this perl code that generated .html automatically everyday users visited my website. the java script included in that generated .html doesnt work at all. I even tested this java in other html and it does run. is there any special header i need to include in my perl script so that java will run. ? pls reply

Quote Reply
Re: Java in a perl generated code In reply to
What is the code you have?
You shouldn't have to do anything....it should run as normal.



Paul Wilson.
Installations:
http://www.wiredon.net/gt/
Quote Reply
Re: Java in a perl generated code In reply to
also please understand the enormity of the difference between Java and JavaScript. they have absolutely nothing to do with one another apart from their name and the fact that they are highly object oriented.

-g


s/(\d{2})/chr($1)/ge + print if $_ = '8284703280698276687967';
Quote Reply
Re: Java in a perl generated code In reply to
I too have just experienced, for the first time, a problem executing java script within perl generated html.

On adding the script (which runs perfectly in a simple html document) between <java script> tags, to my dbman code I receive the error message:
-----------
Error Message : Error loading required libraries.
Check that they exist, permissions are set correctly and that they compile.
Reason: /0;s ");
}
count/: nested *?+ in regexp at /usr/home/domain/usr/local/etc/httpd/cgi-bin/dbman/diary.pl line 246.
--------------------------------------------------
The line in question is part of the java script, not the perl script.
Is perl somehow trying to execute this?
I am not a perl or java programmer, so help with this would be much appreciated.




David Olley
Anglo & Foreign International Limited,
http://www.afil.co.uk
Quote Reply
Re: Java in a perl generated code In reply to
Seeing the code would help.

Paul
Installations:http://wiredon.net/gt/
Support: http://wiredon.net/forum/

Quote Reply
Re: Java in a perl generated code In reply to
The code can be seen at http://www.afil.co.uk/diary.pl.txt

The code runs without the java script, but not with it included.

Thanks

David Olley
Anglo & Foreign International Limited,
http://www.afil.co.uk
Quote Reply
Re: Java in a perl generated code In reply to
Around the html and javascript you will see

print qq| and to end.. |;

Replace it with.....

print qq~ and to end ~;



Paul
Installations:http://wiredon.net/gt/
Support: http://wiredon.net/forum/

Quote Reply
Re: Java in a perl generated code In reply to
Thank you Paul. That fixed it. The dbman script now runs correctly. Unfortunately, java returns an error message:
Expected ')', quoting a line number. I have checked for balanced paretheses, and all is well.

The strange thing is that the java script on its own works fine, but not within the perl script. I have cut and pasted the working script into the .pl file, but still get the java runtime error returned.


David Olley
Anglo & Foreign International Limited,
http://www.afil.co.uk
Quote Reply
Re: Java in a perl generated code In reply to
it'd help if you didn't put the javscript in the perl file..

i saw this line..

document.write("<a href=\"" + linkdays[c][2] + "\">");

perl outputs that as

document.write("<a href="" + linkdays[c][2] + "">");

which is a syntax error in javascript..

change that to

document.write("<a href=\\"" + linkdays[c][2] + "\\">");

there are probably more.. but i saw that one and i didn't want to look anymore

Jerry Su
http://www.jsu07.com
Quote Reply
Re: Java in a perl generated code In reply to
I agree with jerrysu...One suggestion I have is to use .js files...

Regards,

Eliot Lee
Quote Reply
Re: Java in a perl generated code In reply to
Thank you Jerry

The correction that you pointed out was all that was necessary. Now the page displays the java perfectly.
I have promised myself that I will put aside some time to study both perl and java. Messing around with code that I don't fully understand is bound to end in tears. Most of the time I seem to get away with it, though. I am too old to pretend to keep up with young programmers, and I do not do this for a living (I would starve).
It probably makes you experts cringe!

While I am at it, thanks also to Eliot. I will look into using js files instead. All I have to do is learn how to do that. I may have some time before breakfast. Now the dbman application is looking the way it should, and I am quite pleased with it.

David Olley
Anglo & Foreign International Limited,
http://www.afil.co.uk
Quote Reply
Re: Java in a perl generated code In reply to
Again, as CGlemmons mentioned...java script and java are two totally different languages. Please don't confuse them.

Regards,

Eliot Lee