Syntactic Confectionery Delight | |
PerlMonks |
Re: Perl/Tk and Javascriptby PodMaster (Abbot) |
on Aug 05, 2002 at 09:43 UTC ( [id://187613]=note: print w/replies, xml ) | Need Help?? |
Yes, but why don't you just use a regular browser to interpret the javascript chunk? Win32::OLE may be involved ;)
1. Sure, but have you checked CPAN? 2. Impossible. Well, not really. You'll be able to "simulate" JavaScript in Perl, but would you want to? A lot of the stuff would be relatively easy to do, but what dom will you choose and all that other stuff? 3. Dunno about rhino, but you'd XS it. 4. dunno how NJS works, but if you're going to be using whatever JS interpreter, write an XS interface to it. After I wrote what I have so far, I clicked on my link above, and I came up with JavaScript.pm - Execute JavaScript from within Perl JavaScript.pm is an interface to the SpiderMonkey JS engine. It lets you execute JS code, call JS functions, bind Perl classes to JS, import Perl functions to JS, precompile and exeute scripts among many other things. It does conversion between Perl and JS datatypes. So just use that, or do what that guy did. You still of course have to write a subclass of Tk::HTML if that's how you're intending to use it. update: Seeing as apparently you have not checked cpan, or ran accross JavaScript, I suggest you take a gander at How to RTFM. Because I practically worship that guide, I always check CPAN first, and so should you. update: Also, I checked al the ppm repositories available to me, and have not found JavaScript on them, so i'm going to build a ppm of it, and slap it up on my ppm repository (win32 only). update: I'm having some problems building JavaScript, so it might take a while (damn, I can't do anything in under 5 minutes, rrr ;) The problems I have are the same as described here update: I have resolved the errors, and put the PPM up there. Enjoy (if u can ;). update: Since I bothered to compile this beast, I had to plug some of my javascript into it, check this out: JavaScript.pm rox! JavaScript.pm rox! JavaScript.pm rox! JavaScript.pm rox! JavaScript.pm rox! JavaScript.pm rox! JavaScript.pm rox! JavaScript.pm rox! JavaScript.pm rox! JavaScript.pm rox! http://a.b.c/d/f?a=b;c=%5B%20%21%20%23%20%25%20%25%5D#hello world! HASH(0x1ab5180) Scheme: http Authority: a.b.c Path: /d/f Query: a=b;c=%5B%20%21%20%23%20%25%20%25%5D Fragment: hello world! a=b;c=[ ! # % %] 0)a=b 1)c=[ ! # % %] 0 : http://a.b.c/d/f?a=b;c=%5B%20%21%20%23%20%25%20%25%5D#hello world! 1 : http 2 : //a.b.c 3 : a.b.c 4 : /d/f 5 : ?a=b;c=%5B%20%21%20%23%20%25%20%25%5D 6 : a=b;c=%5B%20%21%20%23%20%25%20%25%5D 7 : #hello world! 8 : hello world!
____________________________________________________
In Section
Seekers of Perl Wisdom
|
|