perl.javascript http://www.nntp.perl.org/group/perl.javascript/ ... Copyright 1998-2017 perl.org Thu, 30 Mar 2017 04:30:18 +0000 ask@perl.org Announce: JSP v1.0 by Salvador Ortiz Garcia I&#39;m happy to announce the first release (1.00) of the JSP Perl module, <br/>an open source bridge between Perl and Mozilla&#39;s SpiderMonkey JavaScript <br/>engines.<br/><br/>JSP is a datatype reflection engine and an object life cycle synchronizer.<br/>JSP allows you to write programs using both languages at the same time.<br/><br/>Features:<br/><br/> * Objects and other values pass freely between interpreters. They<br/> are encapsulated in specialized classes, giving them correct<br/> semantics on their non-native interpreter. Values and objects and<br/> are &quot;alive&quot;.<br/> * All Perl classes are exportable to JavaScript.<br/><br/> // Use DBI from javascript<br/> Sys.install(&#39;DBI&#39;, &#39;DBI&#39;);<br/> var dbh = DBI.connect(...);<br/> dbh.prepare(sqlstement);<br/><br/> * Easy to build on supported javascript engines.<br/> * Builds against SpiderMonkey 1.7.0 up to (unreleased) 1.8.5 (Gecko<br/> 1.9.3).<br/> * Exceptions pass freely between interpreters. A language can<br/> handle, in a native way, exceptions thrown from the other<br/> language. In JavaScript you use /throw, try and catch/. In Perl<br/> you use /die, eval and $@/. You can /cath/ a perl&#39;s /die/ and also<br/> after an /eval, $@/ will be set to the error /throw/n.<br/> * Perl can access and manipulate javascript&#39;s /this/.<br/> * Full support for utf8 even when SpiderMonkey wasn&#39;t compiled with<br/> support for it.<br/> * A command line *jsp* javascript interpreter included for<br/> standalone javascript execution.<br/> * Big test battery. Almost 1000 tests.<br/> * Extensive reference documentation.<br/><br/>Requirements:<br/><br/> Perl 5.8 or higher<br/> SpiderMonkey 1.7 or higher<br/><br/>Get it from your nearest CPAN site at: http://search.cpan.org/dist/JSP/ <br/>or visit us at http://jsp.msg.mx<br/><br/>The JSP project is looking for both developers and users.<br/><br/>I&#39;d appreciate your comments and feedback.<br/><br/>Thank you,<br/>Salvador Ortiz<br/> http://www.nntp.perl.org/group/perl.javascript/2010/06/msg73.html Wed, 09 Jun 2010 14:33:17 +0000 Re: Access from perl to a JavaScript function result by Sergey Andreev Basically you can`t do this.<br/>Or try to use<br/>http://search.cpan.org/~claesjac/JavaScript-1.11/lib/JavaScript.pm<br/>Before you need cut Javascript from HTML, and maybe cleanup it, for better<br/>usage.<br/><br/><br/>2009/2/23 Amel Kapetanovic &lt;a.kapetanovic@hispeed.ch&gt;<br/><br/>&gt; Hi,<br/>&gt;<br/>&gt; I am trying to access from perl to HTML documents (LWP), and I want to<br/>&gt; get the result of some JavaScript functions, which are in the HTML page,<br/>&gt; simply like<br/>&gt;<br/>&gt; document.write(&#39;hello&#39;);<br/>&gt;<br/>&gt; Could someone please help me?<br/>&gt;<br/>&gt; Thanks,<br/>&gt; Amel<br/>&gt;<br/>&gt;<br/>&gt;<br/><br/><br/>-- <br/>Sergey Andreev http://www.nntp.perl.org/group/perl.javascript/2009/02/msg72.html Tue, 24 Feb 2009 00:29:59 +0000 Access from perl to a JavaScript function result by Amel Kapetanovic Hi,<br/><br/>I am trying to access from perl to HTML documents (LWP), and I want to<br/>get the result of some JavaScript functions, which are in the HTML page,<br/>simply like<br/><br/> document.write(&#39;hello&#39;);<br/><br/>Could someone please help me?<br/><br/>Thanks,<br/>Amel<br/><br/><br/> http://www.nntp.perl.org/group/perl.javascript/2009/02/msg71.html Mon, 23 Feb 2009 11:51:59 +0000 Re: Problems with JavaScript 1.04 by Claes Jakobsson In order to make installation of JavaScript.pm a lot easier I&#39;m <br/>planning of bundling a suitable SpiderMonkey 1.7 or later and <br/>integrate that into the build process like DBD::SQLite does. It will <br/>still be possible to build against your own SpiderMonkey if you want <br/>that.<br/><br/>At the same time I will also drop support for pre-1.7 SpiderMonkey <br/>since they cause me headache. These are the plans for 1.1 so far.<br/><br/>/Claes<br/><br/><br/>On 18 nov 2007, at 18.06, Jesse Thompson wrote:<br/><br/>&gt; To back up Claes&#39; point here, I had the smoothest install experience <br/>&gt; when I<br/>&gt; built the JavaScript.pm package against a fresh download of the <br/>&gt; newest copy<br/>&gt; of spidermonkey, at that time 1.6.<br/> http://www.nntp.perl.org/group/perl.javascript/2007/11/msg70.html Sun, 18 Nov 2007 09:12:42 +0000 Re: Problems with JavaScript 1.04 by Jesse Thompson To back up Claes&#39; point here, I had the smoothest install experience when I<br/>built the JavaScript.pm package against a fresh download of the newest copy<br/>of spidermonkey, at that time 1.6.<br/><br/>On Nov 18, 2007 8:23 AM, Claes Jakobsson &lt;claes@surfar.nu&gt; wrote:<br/><br/>&gt; Hi,<br/>&gt;<br/>&gt; On 18 nov 2007, at 03.06, Gary Bruce wrote:<br/>&gt;<br/>&gt; &gt; I&#39;m having problems using JavaScript 1.04. I downloaded, unpacked<br/>&gt; &gt; and made<br/>&gt; &gt; the tar file from the CPAN site.<br/>&gt; &gt;<br/>&gt; &gt; The make and installation was somewhat problematic. The module would<br/>&gt; &gt; not make using the CPAN module. The version downloaded by CPAN was<br/>&gt; &gt; 1.03 not<br/>&gt; &gt; 1.04.<br/>&gt; &gt;<br/>&gt; &gt; After some investigation into this list I set the JS_INC and JS_LIB<br/>&gt; &gt; environment variables as directed. I was able to get a clean &quot;perl<br/>&gt; &gt; Makefile.PL&quot; and &quot;make&quot;. &quot;make test&quot; failed 30 out of 32 tests, but<br/>&gt; &gt; the<br/>&gt; &gt; &quot;make install&quot; seemed to do OK.<br/>&gt; &gt;<br/>&gt; &gt; I cut and pasted the &quot;99 bottles of beer&quot; sample program from the<br/>&gt; &gt; man page.<br/>&gt; &gt; Upon running it as &quot;perl javatest.pl&quot; I get the following error:<br/>&gt; &gt;<br/>&gt; &gt; /libexec/ld-elf.so.1: /usr/local/lib/libnspr4.so.1: Undefined symbol<br/>&gt; &gt; &quot;pthread_condattr_init&quot;<br/>&gt; &gt;<br/>&gt; &gt; I&#39;m running on FreeBSD 6.2 on an i386 32 bit platform.<br/>&gt; &gt;<br/>&gt; &gt; Anyone have any ideas?<br/>&gt; &gt;<br/>&gt; &gt; Thanks,<br/>&gt; &gt; Gary<br/>&gt;<br/>&gt; This looks like a problem with the SpiderMonkey and NSPR libraries you<br/>&gt; have installed on your machine and not a problem with JavaScript.pm.<br/>&gt;<br/>&gt; What spidermonkey libs are you building against?<br/>&gt;<br/>&gt; /Claes<br/>&gt; http://www.nntp.perl.org/group/perl.javascript/2007/11/msg69.html Sun, 18 Nov 2007 09:06:29 +0000 Re: Problems with JavaScript 1.04 by Claes Jakobsson Hi,<br/><br/>On 18 nov 2007, at 03.06, Gary Bruce wrote:<br/><br/>&gt; I&#39;m having problems using JavaScript 1.04. I downloaded, unpacked <br/>&gt; and made<br/>&gt; the tar file from the CPAN site.<br/>&gt;<br/>&gt; The make and installation was somewhat problematic. The module would<br/>&gt; not make using the CPAN module. The version downloaded by CPAN was <br/>&gt; 1.03 not<br/>&gt; 1.04.<br/>&gt;<br/>&gt; After some investigation into this list I set the JS_INC and JS_LIB<br/>&gt; environment variables as directed. I was able to get a clean &quot;perl<br/>&gt; Makefile.PL&quot; and &quot;make&quot;. &quot;make test&quot; failed 30 out of 32 tests, but <br/>&gt; the<br/>&gt; &quot;make install&quot; seemed to do OK.<br/>&gt;<br/>&gt; I cut and pasted the &quot;99 bottles of beer&quot; sample program from the <br/>&gt; man page.<br/>&gt; Upon running it as &quot;perl javatest.pl&quot; I get the following error:<br/>&gt;<br/>&gt; /libexec/ld-elf.so.1: /usr/local/lib/libnspr4.so.1: Undefined symbol<br/>&gt; &quot;pthread_condattr_init&quot;<br/>&gt;<br/>&gt; I&#39;m running on FreeBSD 6.2 on an i386 32 bit platform.<br/>&gt;<br/>&gt; Anyone have any ideas?<br/>&gt;<br/>&gt; Thanks,<br/>&gt; Gary<br/><br/>This looks like a problem with the SpiderMonkey and NSPR libraries you <br/>have installed on your machine and not a problem with JavaScript.pm.<br/><br/>What spidermonkey libs are you building against?<br/><br/>/Claes<br/> http://www.nntp.perl.org/group/perl.javascript/2007/11/msg68.html Sun, 18 Nov 2007 08:24:06 +0000 Problems with JavaScript 1.04 by Gary Bruce I&#39;m having problems using JavaScript 1.04. I downloaded, unpacked and made<br/>the tar file from the CPAN site.<br/><br/>The make and installation was somewhat problematic. The module would<br/>not make using the CPAN module. The version downloaded by CPAN was 1.03 not<br/>1.04.<br/><br/>After some investigation into this list I set the JS_INC and JS_LIB<br/>environment variables as directed. I was able to get a clean &quot;perl<br/>Makefile.PL&quot; and &quot;make&quot;. &quot;make test&quot; failed 30 out of 32 tests, but the<br/>&quot;make install&quot; seemed to do OK.<br/><br/>I cut and pasted the &quot;99 bottles of beer&quot; sample program from the man page.<br/>Upon running it as &quot;perl javatest.pl&quot; I get the following error:<br/><br/>/libexec/ld-elf.so.1: /usr/local/lib/libnspr4.so.1: Undefined symbol<br/>&quot;pthread_condattr_init&quot;<br/><br/>I&#39;m running on FreeBSD 6.2 on an i386 32 bit platform.<br/><br/>Anyone have any ideas?<br/><br/>Thanks,<br/>Gary http://www.nntp.perl.org/group/perl.javascript/2007/11/msg67.html Sun, 18 Nov 2007 05:44:42 +0000 JS and HEX Validation by Grzegorz Mi�kiewicz Hi to all,<br/><br/>I&#39;m trying to validate is string is hex:<br/><br/>function validate_mac (mac) {<br/> var wzor = ^0[xX]([0-9a-fA-F]+)$;<br/> var wynik = mac.match(wzor);<br/> if(wynik == null) return false;<br/> return true;<br/>}<br/><br/>and use this function in this:<br/><br/>function validate_form_komputery ( form )<br/>{<br/> var msg = &#39;&#39;;<br/> if((form.ip1.value==&#39;&#39;) || (form.ip2.value==&#39;&#39;) || (form.ip3.value==&#39;&#39;) || <br/>(form.ip4.value==&#39;&#39;)) msg = &#39;* Podany adres IP jest nieprawid&sup3;owy\n&#39;;<br/> if((form.mac1.value==&#39;&#39;) || (form.mac2.value==&#39;&#39;) || (form.mac3.value==&#39;&#39;) <br/>|| (form.mac4.value==&#39;&#39;) || (form.mac5.value==&#39;&#39;) || (form.mac6.value==&#39;&#39;)) <br/>msg += &#39;* Pope&sup3;ni&sup3;e&para; b&sup3;&plusmn;d przy adresie MAC\n&#39;;<br/><br/> if(form.nazwa.value==&#39;&#39;) msg += &#39;* Nazwa hosta jest nieprawid&sup3;owa\n&#39;;<br/> if(validate_mac(form.mac1.value)==false) msg += &#39;* Podany adres mac nie <br/>jest prawid&sup3;owy&#39;;<br/> if(msg!==&#39;&#39;) { alert (a.value+&#39;\n&#39;+msg); return false; }<br/>}<br/><br/>and it not work at all, when i comment line:<br/> if(validate_mac(form.mac1.value)==false) msg += &#39;* Podany adres mac nie <br/>jest prawid&sup3;owy&#39;;<br/>rest of code work.<br/><br/>Where i have made a mistake ??<br/><br/>Best Regards,<br/>Gregory Miskiewicz <br/><br/><br/> http://www.nntp.perl.org/group/perl.javascript/2007/10/msg66.html Sat, 20 Oct 2007 02:00:18 +0000 Re: JS context serialization? by Jesse Thompson Ok. Re-reading my original post on &quot;JS context serialization&quot; I<br/>believe it may have been too rambling. Let me try to be more concise.<br/><br/>In a web browser, Javascript runs interactively. When you first reach<br/>a page, javascript starts up and js files get loaded, functions get<br/>defined, etc. You create an environment.<br/><br/>Next, the user interacts with that environment. They click a button,<br/>they type in some text. The environment records what they do and it<br/>reacts to the user. The environment slowly changes over time.<br/><br/>In theory, using JavaScript.pm we should be able to do this server<br/>side too. We should be able to re-use a majority of our client side<br/>javascript code and pretend the server is a very slow part of the<br/>client. This is faboo for handicapped web browsers like Konquerer. But<br/>there is one major hurdle.<br/><br/>When the client accesses a server side page, JavaScript.pm starts up.<br/>Js files get loaded, functions get defined. We have a new environment,<br/>just like in client side. Except.... Once we pass control back to the<br/>client we are in trouble. When the client presses a button or enters<br/>some text it emits a brand new page request to the server, and there<br/>is no way we can still have the &quot;environment&quot; we created the first<br/>time around ready to handle the user&#39;s request. The environment cannot<br/>survive from one page load to the next. It cannot be stateful.<br/><br/>What we need is a way to &quot;serialize&quot; an environment. That is just a<br/>fancy way of saying we freeze dry the entire Javascript universe we<br/>created into a string so it can be stored into a database for future<br/>retrieval. Then, we &quot;unserialize&quot; or thaw out the data on the next<br/>page request from the same user.<br/><br/>Does Javascript.pm have a way to serialize and unserialize an entire<br/>context, for this and similar uses?<br/><br/>Thanks. :)<br/><br/>- - Jesse Thompson<br/>http://www.webformix.com/<br/> http://www.nntp.perl.org/group/perl.javascript/2007/07/msg65.html Sun, 01 Jul 2007 14:51:19 +0000 JS context serialization? by Jesse Thompson Say, would anyone know if it would be possible or easy to serialize a<br/>JavaScript runtime environment or context into a string, to save state<br/>as to all the data in that environment? I don&#39;t fully understand how<br/>the &quot;compile&quot; option works so I can&#39;t say if that is comparable.<br/><br/>What I am thinking is, my project would like to be able to run scripts<br/>in the browser when the browser is compatible with the JS<br/>requirements, and run them on the server otherwise. Doing this rises a<br/>ton of technical challenges that I am addressing, but among them is<br/>the fact that the JS on client is stateful.<br/><br/>When you click something to interact with it, the JS handles the<br/>request, and the state of the web page and of all the JS data remains<br/>intact awaiting your next request.<br/><br/>If you try emulating this server side however, the server first serves<br/>you the page (and emulates whatever JS initialization there is) and<br/>then sends you the page state at that point. If I could serialize the<br/>JS context at this point and store it, then after the user clicks to<br/>interact with something I could retrieve the serial and restore it as<br/>a context in order to continue servicing the request. A restored<br/>context would remember all of the JS information, and in my workflow<br/>the page state is stored as a dom or e4x object so that is saved as<br/>well.<br/><br/>Is that something that &quot;compile&quot; already does by chance, or if not is<br/>there any other functionality that could accomplish it?<br/><br/>Thanks for your consideration. :)<br/><br/>- - Jesse Thompson<br/>Webformix<br/> http://www.nntp.perl.org/group/perl.javascript/2007/04/msg64.html Tue, 10 Apr 2007 12:34:15 +0000 Re: Perl exceptions from bound JS constructors do not propogate by Claes Jakobsson Hi Jesse.<br/><br/>On 6 apr 2007, at 10.35, Jesse Thompson wrote:<br/><br/>&gt; Am I approaching this the wrong way, or is this perhaps something <br/>&gt; to report<br/>&gt; in rt?<br/>&gt;<br/>&gt; It looks like when I bind a class and throw an error (such as a die()<br/>&gt; statement or a failed DB connect) from within a static or object <br/>&gt; method, it<br/>&gt; bubbles beautifully through JS as an exception.<br/>&gt;<br/>&gt; However when I bind a class and register some perl sub as a <br/>&gt; *constructor*,<br/>&gt; any dies or errors from there seem to make the constructor abort <br/>&gt; silently<br/>&gt; instead.<br/><br/>Yes, this seems to be a bug. I think the problem lies within this <br/>piece of code from PJS_construct_perl_object (in JavaScript.xs)<br/><br/> if (SvROK(pcls-&gt;cons)) {<br/> SV *rsv;<br/> SV *pkg = newSVpv(pcls-&gt;pkg, 0);<br/> perl_call_sv_with_jsvals_rsv(cx, obj,<br/> pcls-&gt;cons, pkg,<br/> argc, argv, &amp;rsv);<br/><br/> SvREFCNT_inc(rsv);<br/><br/> JS_SetPrivate(cx, obj, (void *) rsv);<br/> }<br/><br/> return JS_TRUE;<br/><br/>perl_call_sv_with_jsvals_rsv returns JS_FALSE if it throws an <br/>exception so we should also return JS_FALSE.<br/><br/>Please report this as an bug in RT and I&#39;ll fix it in the next release.<br/><br/>Thanks,<br/>Claes<br/> http://www.nntp.perl.org/group/perl.javascript/2007/04/msg63.html Tue, 10 Apr 2007 00:41:37 +0000 Perl exceptions from bound JS constructors do not propogate by Jesse Thompson Am I approaching this the wrong way, or is this perhaps something to report<br/>in rt?<br/><br/>It looks like when I bind a class and throw an error (such as a die()<br/>statement or a failed DB connect) from within a static or object method, it<br/>bubbles beautifully through JS as an exception.<br/><br/>However when I bind a class and register some perl sub as a *constructor*,<br/>any dies or errors from there seem to make the constructor abort silently<br/>instead.<br/><br/>Example: in the code attached below, the perl diagnostic displays a blessed<br/>object. when you uncomment &quot;test point 2&quot; you get a well documented error<br/>message. When you uncomment &quot;Test point #1&quot; however, the message goes<br/>unreported and you get a blank (uncontructed) object instead of a blessed<br/>hash.<br/><br/>Thank you for your consideration. :)<br/><br/>- - Jesse Thompson<br/>Webformix, Bend OR<br/><br/><br/><br/>use JavaScript;<br/>use Data::Dumper;<br/><br/>my $rt = JavaScript::Runtime-&gt;new();<br/>my $cx = $rt-&gt;create_context();<br/><br/>$cx-&gt;bind_function(write =&gt; sub { print @_; });<br/><br/>$cx-&gt;bind_class(<br/> name =&gt; &#39;JSDB&#39;,<br/> package =&gt; &#39;JSDB&#39;,<br/> constructor =&gt; &quot;JSDB::new&quot;,<br/> fs =&gt; { test =&gt; \&amp;JSDB::test, },<br/>);<br/>$cx-&gt;set_error_handler( sub { die(Dumper(\@_)); } );<br/><br/>$ret = $cx-&gt;eval(q[<br/><br/>var dbh = new JSDB;<br/>dbh.test();<br/><br/>]);<br/><br/>print &quot;js_ret = ($ret), \$@ = ($@)\n&quot;;<br/>die(Dumper($ret));<br/><br/>exit;<br/><br/>package JSDB;<br/><br/>sub new<br/>{<br/> my $class = shift;<br/> my $self = {};<br/><br/># die(&quot;Test point #1&quot;);<br/><br/> bless $self, $class;<br/> return($self);<br/>}<br/><br/>sub test<br/>{<br/> my $self = shift;<br/><br/># die(&quot;Test point #2&quot;);<br/>} http://www.nntp.perl.org/group/perl.javascript/2007/04/msg62.html Fri, 06 Apr 2007 01:35:54 +0000 bind_function (1.03) by Martyn Smith I have a weird problem, I&#39;m binding a function like so ... <br/> <br/>$cx-&gt;bind_function(connect =&gt; sub { <br/> my ($param1, $param2) = @_; <br/> <br/> # ... <br/> <br/>}); <br/> <br/> <br/>If I call the function like this ... <br/> <br/>connect(function () {}, &#39;string&#39;); <br/> <br/>it&#39;s fine, everything works as I expect. <br/> <br/>If I call it like this however ... <br/> <br/>connect(&#39;string&#39;, function () {}); <br/> <br/>$param1 comes through as undef, and the function comes through fine. <br/> <br/> <br/>Anyone have any ideas ? <br/> <br/>-- <br/>Martyn <br/> http://www.nntp.perl.org/group/perl.javascript/2007/03/msg61.html Tue, 27 Mar 2007 18:26:39 +0000 bind_class by Jesse Thompson Hello!<br/><br/>Bravo on continuing development Claes, the E4x support looks smashing. I<br/>haven&#39;t used E4x yet in practice but I understand the theory and I am quite<br/>excited!<br/><br/><br/>What I am researching right now however is database support. I do not expect<br/>you to build that into JavaScript.pm of course. All I would like is some way<br/>to access perl&#39;s DBI cpan module from Javascript.<br/><br/>I run into problems trying to bind_class DBI and it&#39;s ilk (such as the<br/>DBI::db object returned by &amp;DBI::connect). First of all, I am required to<br/>enumerate the methods I wish to have access too. PERL is sort of designed so<br/>that I cannot know what methods an object might have, so this is<br/>troublesome. Is there a possibility to, on request, allow pass through<br/>access to an object&#39;s methods? Maybe working sort of like PERL&#39;s own<br/>AUTOLOAD mechanism? DBI::db is espescially difficult. I can&#39;t bind as a<br/>method &quot;DBI::db::do&quot; because it&#39;s not a code reference. I expect it&#39;s an<br/>inherited method.. from heaven knows where. :P<br/><br/>I&#39;m also a trifle confused by the &quot;constructor&quot; requirement in bind_class.<br/>Factory built objects like the DBI::db&#39;s do not require JavaScript<br/>accessable constructors.<br/><br/>While we&#39;re on the subject though, &quot;DBI::db&quot; is not a customer facing object<br/>at all! Should we not look for a way to support using that object in<br/>JavaScript without knowing for sure what sort of object it is? Tomorrow&#39;s<br/>DBI implementation could change it&#39;s name and it&#39;s not our business hard<br/>coding that.<br/><br/>So, I would like to thank you for building an awesome Perl module, and I<br/>appreciate the difficulty of these challenges you face. I am hoping for no<br/>more than discussion of issues like these if possible.<br/><br/>Thanks!<br/><br/>- - Jesse Thompson<br/>http://www.webformix.com/ http://www.nntp.perl.org/group/perl.javascript/2007/03/msg60.html Sun, 25 Mar 2007 02:43:46 +0000 Re: Build problems on Debian Sid by Stig Brautaset Hi Martyn,<br/><br/>Where did you install SpiderMonkey? If you installed it into /usr/ <br/>local/lib (the default?) you may need to add that directory to /etc/ <br/>ld.so.conf and re-run /sbin/ldconfig .<br/><br/>Hope that helps,<br/><br/>Stig<br/><br/><br/>On 8 Mar 2007, at 20:36, Martyn Smith wrote:<br/><br/>&gt; So I managed to get it to build, and the tests ran and passed.<br/>&gt;<br/>&gt; But now I have the problem of having installed it (I used dh-make-perl<br/>&gt; still), and it obviously isn&#39;t using my compiled version of the<br/>&gt; SpiderMonkey lib<br/>&gt;<br/>&gt; Any ideas on what I need to change to make that happen ?<br/>&gt;<br/>&gt; --<br/>&gt; Martyn<br/>&gt;<br/>&gt;<br/>&gt;<br/>&gt; On Tue, 2007-03-06 at 22:05 +0100, Claes Jakobsson wrote:<br/>&gt;&gt; Hi,<br/>&gt;&gt;<br/>&gt;&gt; There seems to be something wrong currently with the build process<br/>&gt;&gt; when linking aginst Debian supplied spidermonkey. Others have<br/>&gt;&gt; reported the same problem.<br/>&gt;&gt;<br/>&gt;&gt; The easiest way to solve it right now is that you download and build<br/>&gt;&gt; your own SpiderMonkey and link aginst that.<br/>&gt;&gt;<br/>&gt;&gt; When running Makefile.PL, make sure your environment variable JS_INC<br/>&gt;&gt; is set to the paths where your SpiderMonkey includes are (use : to<br/>&gt;&gt; separate directories) and JS_LIB to point to the path where the<br/>&gt;&gt; libjs.so is.<br/>&gt;&gt;<br/>&gt;&gt; /Claes<br/>&gt;&gt;<br/>&gt;&gt; On 6 mar 2007, at 21.46, Martyn Smith wrote:<br/>&gt;&gt;<br/>&gt;&gt;&gt; I tried using dh-make-perl to build a new version of JavaScript<br/>&gt;&gt;&gt; (Debian<br/>&gt;&gt;&gt; Sid only has 0.55 :( )<br/>&gt;&gt;&gt;<br/>&gt;&gt;&gt; I&#39;m having the tests fail with messages like ...<br/>&gt;&gt;&gt;<br/>&gt;&gt;&gt; t/00-init.........................NOK 1# Tried to use<br/>&gt;&gt;&gt; &#39;JavaScript&#39;.<br/>&gt;&gt;&gt; # Error: Can&#39;t load &#39;/home/martyn/src/debian/JavaScript-1.03/<br/>&gt;&gt;&gt; blib/arch/auto/JavaScript/JavaScript.so&#39; for module JavaScript: /<br/>&gt;&gt;&gt; home/martyn/src/debian/JavaScript-1.03/blib/arch/auto/JavaScript/<br/>&gt;&gt;&gt; JavaScript.so: undefined symbol: js_InternalInvoke at /usr/lib/perl/<br/>&gt;&gt;&gt; 5.8/DynaLoader.pm line 225.<br/>&gt;&gt;&gt; # at (eval 3) line 2<br/>&gt;&gt;&gt; # Compilation failed in require at (eval 3) line 2.<br/>&gt;&gt;&gt; # BEGIN failed--compilation aborted at t/00-init.t line 5.<br/>&gt;&gt;&gt; # Looks like you failed 1 test of 1.<br/>&gt;&gt;&gt; t/00-init.........................dubious<br/>&gt;&gt;&gt; Test returned status 1 (wstat 256, 0x100)<br/>&gt;&gt;&gt; DIED. FAILED test 1<br/>&gt;&gt;&gt; Failed 1/1 tests, 0.00% okay<br/>&gt;&gt;&gt;<br/>&gt;&gt;&gt;<br/>&gt;&gt;&gt;<br/>&gt;&gt;&gt;<br/>&gt;&gt;&gt; I have installed libmozjs-dev and libmozjs0d, I&#39;m not quite sure<br/>&gt;&gt;&gt; what to try next :(<br/>&gt;&gt;&gt;<br/>&gt;&gt;&gt; Any ideas?<br/>&gt;&gt;&gt;<br/>&gt;&gt;&gt; Thanks,<br/>&gt;&gt;&gt;<br/>&gt;&gt;&gt; Martyn<br/>&gt;&gt;&gt;<br/>&gt;&gt;<br/><br/> http://www.nntp.perl.org/group/perl.javascript/2007/03/msg59.html Thu, 08 Mar 2007 15:57:03 +0000 Re: Build problems on Debian Sid by Martyn Smith So I managed to get it to build, and the tests ran and passed. <br/> <br/>But now I have the problem of having installed it (I used dh-make-perl <br/>still), and it obviously isn&#39;t using my compiled version of the <br/>SpiderMonkey lib <br/> <br/>Any ideas on what I need to change to make that happen ? <br/> <br/>-- <br/>Martyn <br/> <br/> <br/> <br/>On Tue, 2007-03-06 at 22:05 +0100, Claes Jakobsson wrote: <br/>&gt; Hi, <br/>&gt; <br/>&gt; There seems to be something wrong currently with the build process <br/>&gt; when linking aginst Debian supplied spidermonkey. Others have <br/>&gt; reported the same problem. <br/>&gt; <br/>&gt; The easiest way to solve it right now is that you download and build <br/>&gt; your own SpiderMonkey and link aginst that. <br/>&gt; <br/>&gt; When running Makefile.PL, make sure your environment variable JS_INC <br/>&gt; is set to the paths where your SpiderMonkey includes are (use : to <br/>&gt; separate directories) and JS_LIB to point to the path where the <br/>&gt; libjs.so is. <br/>&gt; <br/>&gt; /Claes <br/>&gt; <br/>&gt; On 6 mar 2007, at 21.46, Martyn Smith wrote: <br/>&gt; <br/>&gt; &gt; I tried using dh-make-perl to build a new version of JavaScript <br/>&gt; &gt; (Debian <br/>&gt; &gt; Sid only has 0.55 :( ) <br/>&gt; &gt; <br/>&gt; &gt; I&#39;m having the tests fail with messages like ... <br/>&gt; &gt; <br/>&gt; &gt; t/00-init.........................NOK 1# Tried to use <br/>&gt; &gt; &#39;JavaScript&#39;. <br/>&gt; &gt; # Error: Can&#39;t load &#39;/home/martyn/src/debian/JavaScript-1.03/ <br/>&gt; &gt; blib/arch/auto/JavaScript/JavaScript.so&#39; for module JavaScript: / <br/>&gt; &gt; home/martyn/src/debian/JavaScript-1.03/blib/arch/auto/JavaScript/ <br/>&gt; &gt; JavaScript.so: undefined symbol: js_InternalInvoke at /usr/lib/perl/ <br/>&gt; &gt; 5.8/DynaLoader.pm line 225. <br/>&gt; &gt; # at (eval 3) line 2 <br/>&gt; &gt; # Compilation failed in require at (eval 3) line 2. <br/>&gt; &gt; # BEGIN failed--compilation aborted at t/00-init.t line 5. <br/>&gt; &gt; # Looks like you failed 1 test of 1. <br/>&gt; &gt; t/00-init.........................dubious <br/>&gt; &gt; Test returned status 1 (wstat 256, 0x100) <br/>&gt; &gt; DIED. FAILED test 1 <br/>&gt; &gt; Failed 1/1 tests, 0.00% okay <br/>&gt; &gt; <br/>&gt; &gt; <br/>&gt; &gt; <br/>&gt; &gt; <br/>&gt; &gt; I have installed libmozjs-dev and libmozjs0d, I&#39;m not quite sure <br/>&gt; &gt; what to try next :( <br/>&gt; &gt; <br/>&gt; &gt; Any ideas? <br/>&gt; &gt; <br/>&gt; &gt; Thanks, <br/>&gt; &gt; <br/>&gt; &gt; Martyn <br/>&gt; &gt; <br/>&gt; http://www.nntp.perl.org/group/perl.javascript/2007/03/msg58.html Thu, 08 Mar 2007 12:37:10 +0000 Re: Build problems on Debian Sid by Martyn Smith Right, I&#39;ll give that a whirl when I get a chance ... thanks for the <br/>quick response :) <br/> <br/>-- <br/>Martyn <br/> <br/> <br/>On Tue, 2007-03-06 at 22:05 +0100, Claes Jakobsson wrote: <br/>&gt; Hi, <br/>&gt; <br/>&gt; There seems to be something wrong currently with the build process <br/>&gt; when linking aginst Debian supplied spidermonkey. Others have <br/>&gt; reported the same problem. <br/>&gt; <br/>&gt; The easiest way to solve it right now is that you download and build <br/>&gt; your own SpiderMonkey and link aginst that. <br/>&gt; <br/>&gt; When running Makefile.PL, make sure your environment variable JS_INC <br/>&gt; is set to the paths where your SpiderMonkey includes are (use : to <br/>&gt; separate directories) and JS_LIB to point to the path where the <br/>&gt; libjs.so is. <br/>&gt; <br/>&gt; /Claes <br/>&gt; <br/>&gt; On 6 mar 2007, at 21.46, Martyn Smith wrote: <br/>&gt; <br/>&gt; &gt; I tried using dh-make-perl to build a new version of JavaScript <br/>&gt; &gt; (Debian <br/>&gt; &gt; Sid only has 0.55 :( ) <br/>&gt; &gt; <br/>&gt; &gt; I&#39;m having the tests fail with messages like ... <br/>&gt; &gt; <br/>&gt; &gt; t/00-init.........................NOK 1# Tried to use <br/>&gt; &gt; &#39;JavaScript&#39;. <br/>&gt; &gt; # Error: Can&#39;t load &#39;/home/martyn/src/debian/JavaScript-1.03/ <br/>&gt; &gt; blib/arch/auto/JavaScript/JavaScript.so&#39; for module JavaScript: / <br/>&gt; &gt; home/martyn/src/debian/JavaScript-1.03/blib/arch/auto/JavaScript/ <br/>&gt; &gt; JavaScript.so: undefined symbol: js_InternalInvoke at /usr/lib/perl/ <br/>&gt; &gt; 5.8/DynaLoader.pm line 225. <br/>&gt; &gt; # at (eval 3) line 2 <br/>&gt; &gt; # Compilation failed in require at (eval 3) line 2. <br/>&gt; &gt; # BEGIN failed--compilation aborted at t/00-init.t line 5. <br/>&gt; &gt; # Looks like you failed 1 test of 1. <br/>&gt; &gt; t/00-init.........................dubious <br/>&gt; &gt; Test returned status 1 (wstat 256, 0x100) <br/>&gt; &gt; DIED. FAILED test 1 <br/>&gt; &gt; Failed 1/1 tests, 0.00% okay <br/>&gt; &gt; <br/>&gt; &gt; <br/>&gt; &gt; <br/>&gt; &gt; <br/>&gt; &gt; I have installed libmozjs-dev and libmozjs0d, I&#39;m not quite sure <br/>&gt; &gt; what to try next :( <br/>&gt; &gt; <br/>&gt; &gt; Any ideas? <br/>&gt; &gt; <br/>&gt; &gt; Thanks, <br/>&gt; &gt; <br/>&gt; &gt; Martyn <br/>&gt; &gt; <br/>&gt; http://www.nntp.perl.org/group/perl.javascript/2007/03/msg57.html Tue, 06 Mar 2007 13:09:26 +0000 Re: Build problems on Debian Sid by Claes Jakobsson Hi,<br/><br/>There seems to be something wrong currently with the build process <br/>when linking aginst Debian supplied spidermonkey. Others have <br/>reported the same problem.<br/><br/>The easiest way to solve it right now is that you download and build <br/>your own SpiderMonkey and link aginst that.<br/><br/>When running Makefile.PL, make sure your environment variable JS_INC <br/>is set to the paths where your SpiderMonkey includes are (use : to <br/>separate directories) and JS_LIB to point to the path where the <br/>libjs.so is.<br/><br/>/Claes<br/><br/>On 6 mar 2007, at 21.46, Martyn Smith wrote:<br/><br/>&gt; I tried using dh-make-perl to build a new version of JavaScript <br/>&gt; (Debian<br/>&gt; Sid only has 0.55 :( )<br/>&gt;<br/>&gt; I&#39;m having the tests fail with messages like ...<br/>&gt;<br/>&gt; t/00-init.........................NOK 1# Tried to use <br/>&gt; &#39;JavaScript&#39;.<br/>&gt; # Error: Can&#39;t load &#39;/home/martyn/src/debian/JavaScript-1.03/ <br/>&gt; blib/arch/auto/JavaScript/JavaScript.so&#39; for module JavaScript: / <br/>&gt; home/martyn/src/debian/JavaScript-1.03/blib/arch/auto/JavaScript/ <br/>&gt; JavaScript.so: undefined symbol: js_InternalInvoke at /usr/lib/perl/ <br/>&gt; 5.8/DynaLoader.pm line 225.<br/>&gt; # at (eval 3) line 2<br/>&gt; # Compilation failed in require at (eval 3) line 2.<br/>&gt; # BEGIN failed--compilation aborted at t/00-init.t line 5.<br/>&gt; # Looks like you failed 1 test of 1.<br/>&gt; t/00-init.........................dubious<br/>&gt; Test returned status 1 (wstat 256, 0x100)<br/>&gt; DIED. FAILED test 1<br/>&gt; Failed 1/1 tests, 0.00% okay<br/>&gt;<br/>&gt;<br/>&gt;<br/>&gt;<br/>&gt; I have installed libmozjs-dev and libmozjs0d, I&#39;m not quite sure <br/>&gt; what to try next :(<br/>&gt;<br/>&gt; Any ideas?<br/>&gt;<br/>&gt; Thanks,<br/>&gt;<br/>&gt; Martyn<br/>&gt;<br/> http://www.nntp.perl.org/group/perl.javascript/2007/03/msg56.html Tue, 06 Mar 2007 13:06:21 +0000 Build problems on Debian Sid by Martyn Smith I tried using dh-make-perl to build a new version of JavaScript (Debian <br/>Sid only has 0.55 :( ) <br/> <br/>I&#39;m having the tests fail with messages like ... <br/> <br/>t/00-init.........................NOK 1# Tried to use &#39;JavaScript&#39;. <br/># Error: Can&#39;t load &#39;/home/martyn/src/debian/JavaScript-1.03/blib/arch/auto/JavaScript/JavaScript.so&#39; for module JavaScript: /home/martyn/src/debian/JavaScript-1.03/blib/arch/auto/JavaScript/JavaScript.so: undefined symbol: js_InternalInvoke at /usr/lib/perl/5.8/DynaLoader.pm line 225. <br/># at (eval 3) line 2 <br/># Compilation failed in require at (eval 3) line 2. <br/># BEGIN failed--compilation aborted at t/00-init.t line 5. <br/># Looks like you failed 1 test of 1. <br/>t/00-init.........................dubious <br/> Test returned status 1 (wstat 256, 0x100) <br/>DIED. FAILED test 1 <br/> Failed 1/1 tests, 0.00% okay <br/> <br/> <br/> <br/> <br/>I have installed libmozjs-dev and libmozjs0d, I&#39;m not quite sure what to try next :( <br/> <br/>Any ideas? <br/> <br/>Thanks, <br/> <br/>Martyn <br/> http://www.nntp.perl.org/group/perl.javascript/2007/03/msg55.html Tue, 06 Mar 2007 12:47:03 +0000 Event exchange between javascript and perl in CGI by RMADHWAN Hi All,<br/><br/>I am trying to achieve following.<br/>I have a CGI-perl script, which creates a drop-down combo-box.<br/>I wish to capture value change event in my CGI-perl script.<br/><br/>I know, I can get onChange event in JavaScript, but how do I pass the<br/>selected item of combo-box to my CGI-perl script?<br/><br/>Regards,<br/>Rakesh<br/><br/> http://www.nntp.perl.org/group/perl.javascript/2007/02/msg54.html Tue, 27 Feb 2007 15:02:47 +0000 [POLL] Dropping support for old SpiderMonkeys by Claes Jakobsson Hi,<br/><br/>as JavaScript.pm development is moving again I&#39;m considering dropping <br/>support for older SpideyMonkey and focusing on 1.7 and later (the one <br/>used in FF 2.0).<br/><br/>Instead on having to download and install SM manually I was planning <br/>on putting up a source release of the SM 1.7 engine on my server and <br/>add the possibility for Makefile.PL to download and install it. <br/>Alternatively I can bundle the source with JavaScript.pm. You will <br/>still however have the possibility to build against your own SM src. <br/>This way we can better control availability of utf8, threading and <br/>e4x (and future stuff too).<br/><br/>Does this sound like a good idea?<br/><br/>Thanks<br/>/Claes<br/> http://www.nntp.perl.org/group/perl.javascript/2007/02/msg53.html Thu, 22 Feb 2007 03:40:59 +0000 Re: JS closures lose context by Andy Armstrong On 4 Nov 2006, at 20:40, Andy Armstrong wrote:<br/>&gt; It looks as if the context that should be captured (closed over) by <br/>&gt; the returned JS function is being lost. Is this expected behaviour?<br/><br/>Oh and the &#39;return 1&#39; in js_next was just me playing to find out <br/>exactly what was being lost - but it doesn&#39;t affect the observed <br/>behaviour.<br/><br/>-- <br/>Andy Armstrong, hexten.net<br/><br/> http://www.nntp.perl.org/group/perl.javascript/2006/11/msg52.html Sat, 04 Nov 2006 12:46:55 +0000 JS closures lose context by Andy Armstrong Given this code:<br/><br/>----------------------------------------------------<br/><br/>#!/usr/bin/perl -w<br/><br/>use strict;<br/><br/>$| = 1;<br/><br/>use JavaScript;<br/>my $rt = JavaScript::Runtime-&gt;new();<br/>my $cx = $rt-&gt;create_context();<br/><br/>sub get_js {<br/> my $next = 1;<br/><br/> # Make a perl function<br/> $cx-&gt;bind_function(perl_next =&gt; sub {<br/> return $next++;<br/> });<br/><br/> $cx-&gt;eval(q{<br/> function makeClosure() {<br/> var next = 1;<br/> var js_next = function() {<br/> return 1;<br/> return next++;<br/> }<br/><br/> return function() {<br/> return perl_next() * js_next();<br/> }<br/> }<br/> });<br/><br/> return $cx-&gt;call(&#39;makeClosure&#39;);<br/>}<br/><br/>my $clos = get_js();<br/><br/>print &quot;$clos\n&quot;;<br/><br/>for (1..10) {<br/> print $clos-&gt;(), &quot;\n&quot;;<br/>}<br/><br/>----------------------------------------------------<br/><br/>The call to $clos-&gt;() returns undef. If the returned JS function is <br/>modified to<br/><br/> return function() {<br/> return perl_next() * next++;<br/> }<br/><br/>each call returns nan. If modified to<br/><br/> return function() {<br/> return perl_next();<br/> }<br/><br/>it correctly returns 1..10.<br/><br/>It looks as if the context that should be captured (closed over) by <br/>the returned JS function is being lost. Is this expected behaviour?<br/><br/>-- <br/>Andy Armstrong, hexten.net<br/><br/><br/> http://www.nntp.perl.org/group/perl.javascript/2006/11/msg51.html Sat, 04 Nov 2006 12:41:31 +0000 Re: Could someone help me on CGI-PERL-JAVASCRIPT table sorting problem ? by ramesh.kandula Hello,<br/>The sortable libraries given at the following link are working when I load <br/>a simple html file containing a table display:<br/>http://www.workingwith.me.uk/articles/scripting/standardista_table_sorting<br/><br/>But the same does not work when am using from a .cgi script. (Please look <br/>at below mail for my task description).<br/>I suspect the addEvent() (given at the end of the file: <br/>standardista-table-sorting.js) function is not triggered and hence my html <br/>table is not getting the headers clickable.<br/><br/>Does someone have any solution for this?<br/><br/>Regards<br/>Ramesh<br/><br/><br/><br/><br/>Ramesh Kandula/Intl/Skyworks <br/>06/08/2006 07:05 PM<br/><br/>To<br/>perl-javascript@perl.org<br/>cc<br/><br/>Subject<br/>Could someone help me on CGI-PERL-JAVASCRIPT problem ?<br/><br/><br/><br/><br/><br/>Hi,<br/><br/>I have following task:<br/>1. An html page with a table of data displayed according to default <br/>sorting based on a column data.<br/>2. I should have a collection of html form buttons, one for each above <br/>table columns, displayed on the top of this page. The user would click on <br/>any of these column buttons. <br/>3. Once any of the buttons is clicked, this same html page should be <br/>displayed back but with results sorted as per the chosen column through <br/>the button.<br/><br/>I have following questions in this regard:<br/>Q1. I want to know how do I catch the button click response from the user <br/>and then call a JavaScript handler using JavaScript.pm module functions?<br/>Q2. If we use JavaScript.pm module within .cgi files, how do we convert <br/>the Perl data structures into JavaScript?<br/>Q3. Do we still need to install WDDX module or not?<br/><br/>Important. All the above would happen from an initial cgi script and the <br/>button click response also should execute from the same cgi script if <br/>possible. This is because, I have lot of Perl Hash data structures to <br/>store the table data displayed on the html page. I need to use the same <br/>data structures for sorting and displaying this data.<br/><br/>If anyone has answers to these questions, please reply immediately.<br/>Thanks in advance .<br/><br/>Regards<br/>Ramesh http://www.nntp.perl.org/group/perl.javascript/2006/06/msg50.html Tue, 13 Jun 2006 04:50:33 +0000 Re: Could someone help me on CGI-PERL-JAVASCRIPT problem ? by Larry Holcombe Ramesh, <br/> <br/>Take a look at http://www.kryogenix.org/code/browser/sorttable/. This is <br/>a javascript only solution to your question. This saves calls to the <br/>server and is very fast. <br/> <br/>Larry <br/> <br/> <br/> <br/>ramesh.kandula@skyworksinc.com wrote: <br/>&gt; Hi, <br/>&gt; <br/>&gt; I have following task: <br/>&gt; 1. An html page with a table of data displayed according to default <br/>&gt; sorting based on a column data. <br/>&gt; 2. I should have a collection of html form buttons, one for each above <br/>&gt; table columns, displayed on the top of this page. The user would click on <br/>&gt; any of these column buttons. <br/>&gt; 3. Once any of the buttons is clicked, this same html page should be <br/>&gt; displayed back but with results sorted as per the chosen column through <br/>&gt; the button. <br/>&gt; <br/>&gt; I have following questions in this regard: <br/>&gt; Q1. I want to know how do I catch the button click response from the user <br/>&gt; and then call a JavaScript handler using JavaScript.pm module functions? <br/>&gt; Q2. If we use JavaScript.pm module within .cgi files, how do we convert <br/>&gt; the Perl data structures into JavaScript? <br/>&gt; Q3. Do we still need to install WDDX module or not? <br/>&gt; <br/>&gt; Important. All the above would happen from an initial cgi script and the <br/>&gt; button click response also should execute from the same cgi script if <br/>&gt; possible. This is because, I have lot of Perl Hash data structures to <br/>&gt; store the table data displayed on the html page. I need to use the same <br/>&gt; data structures for sorting and displaying this data. <br/>&gt; <br/>&gt; If anyone has answers to these questions, please reply immediately. <br/>&gt; Thanks in advance . <br/>&gt; <br/>&gt; Regards <br/>&gt; Ramesh <br/>&gt; <br/> <br/> <br/> <br/>This electronic message transmission contains information from Lewan &amp; Associates, which may be confidential or privileged. This information is intended for the use of the individual or entity named above. If you are not the intended recipient, be aware that any disclosure, copying, distribution, or use of the contents of this information is prohibited. If you have received this electronic transmission in error, please notify us immediately by telephone at 303-759-5440 or by electronic mail at webmaster@lewan.com. <br/> <br/> <br/> http://www.nntp.perl.org/group/perl.javascript/2006/06/msg49.html Thu, 08 Jun 2006 06:42:20 +0000 Could someone help me on CGI-PERL-JAVASCRIPT problem ? by ramesh.kandula Hi,<br/><br/>I have following task:<br/>1. An html page with a table of data displayed according to default <br/>sorting based on a column data.<br/>2. I should have a collection of html form buttons, one for each above <br/>table columns, displayed on the top of this page. The user would click on <br/>any of these column buttons. <br/>3. Once any of the buttons is clicked, this same html page should be <br/>displayed back but with results sorted as per the chosen column through <br/>the button.<br/><br/>I have following questions in this regard:<br/>Q1. I want to know how do I catch the button click response from the user <br/>and then call a JavaScript handler using JavaScript.pm module functions?<br/>Q2. If we use JavaScript.pm module within .cgi files, how do we convert <br/>the Perl data structures into JavaScript?<br/>Q3. Do we still need to install WDDX module or not?<br/><br/>Important. All the above would happen from an initial cgi script and the <br/>button click response also should execute from the same cgi script if <br/>possible. This is because, I have lot of Perl Hash data structures to <br/>store the table data displayed on the html page. I need to use the same <br/>data structures for sorting and displaying this data.<br/><br/>If anyone has answers to these questions, please reply immediately.<br/>Thanks in advance .<br/><br/>Regards<br/>Ramesh http://www.nntp.perl.org/group/perl.javascript/2006/06/msg48.html Thu, 08 Jun 2006 06:35:29 +0000 How can I get the value of a form input whose name is in a Javascript variable? by Neelay Hi all,<br/>I have a Javascript variable, containing the name of an input-<br/>input_name = &quot;document.myform.ip&quot;<br/>How can I get the value of the input &quot;ip&quot; using the variable input_name<br/>in Javascript?<br/>Any help will be highly appreciated.<br/><br/>Thanks,<br/>Neelay.<br/><br/> http://www.nntp.perl.org/group/perl.javascript/2006/06/msg47.html Thu, 08 Jun 2006 00:53:11 +0000 How to assign value of a javascript variable to a perl variable by Reshma I&#39;m new to CGI and javascript.<br/><br/>I have a javascript variable which has a value assigned.<br/><br/>my var = getHTML();<br/><br/>I want to use this value in perl script.<br/><br/>$input_string = &quot;var&quot;; - is this possible?<br/><br/>I know a way we can do - using form and submit action to pass the<br/>javascript variable to the perl script. Is there a way I can avoid<br/>using a click of button as an intermediate step. Passing the value as a<br/>query string has a restriction of 1024 characters. I have content which<br/>could be 3000 characters or more.<br/><br/> http://www.nntp.perl.org/group/perl.javascript/2006/03/msg46.html Wed, 29 Mar 2006 12:51:44 +0000 problem with executing a CGI Perl script from a browser by Neelay Hi,<br/>I have a Perl script, which copies two files from a CD and untars the<br/>first file-<br/>print &quot;Content-type: text/html\n\n&quot;;<br/>print &lt;&lt;HTML_BLOCK;<br/>&lt;head&gt;<br/>&lt;/head&gt;<br/>&lt;body&gt;<br/>HTML_BLOCK<br/>$cmd = &quot;cp $cddir/$file1 $installdir&quot;;<br/>$op = system($cmd);<br/>print &quot;\nCopying file 1...&quot;;<br/>$cmd = &quot;cp $cddir/$file2 $installdir&quot;;<br/>$op = system($cmd);<br/>print &quot;\nCopying file 2...&quot;;<br/>$cmd = &quot;tar -zxf $installdir/$file1&quot;;<br/>$op = system($cmd);<br/>print &quot;Untaring file 1...&quot;;<br/>.....<br/>Now size of files file1 and file2 are around 50 megs, so it takes<br/>sometime for them to be copied from the cd to the install folder. The<br/>script executes fine when I run it from the command line - both files<br/>are copied and first file is untarred.<br/>However, when I execute the script from a browser such as Firefox, the<br/>execution stops after the first file is copied and the only output I<br/>observer in the browser is-<br/>Copying file 1...<br/>When I exeute the script again from the browser by refreshing the page,<br/>the second file is copied and the browser stops again. The browser<br/>output looks like this-<br/>Copying file 1...<br/>Copying file 2...<br/>When I refresh the browser for the second time, file 1 is untarred and<br/>the script execution proceeds.<br/>Copying file 1...<br/>Copying file 2...<br/>Untaring file 1...<br/>Any ideas on why the browser is acting in such a weird way? It seems<br/>that the child process created by the system() call takes over the<br/>browser.<br/>Any help will be highly appreciated.<br/>Thanks.<br/><br/>-Neelay.<br/><br/> http://www.nntp.perl.org/group/perl.javascript/2005/11/msg45.html Wed, 23 Nov 2005 00:09:53 +0000 Re: [cygwin-perl] has anyone had success with JavaScript-0.55? by Christian Montanari On Thu, Nov 17, 2005 at 10:03:35AM +0000, Christian Montanari wrote:<br/>&gt; I am trying to read javascript: urls with LWP (under cygwin).<br/>&gt; <br/>&gt; Then imported the JavaScript-0.55 perl package,<br/>&gt; but after an slightly modified compilation...<br/>&gt; I succeded to build (but badly) the JavaScript.dll with js from ftp://ftp.mozilla.org/???/js.<br/>&gt; I had to fiddle with a few settings in js-1.5 but made js.exe to work.<br/>&gt; <br/>&gt; However, arriving to the perl package I failed miserably with this:<br/>&gt; <br/>&gt; &quot;....Can&#39;t load &#39;/usr/src/JavaScript-0.55/blib/arch/auto/JavaScript/JavaScript.dll&#39; for module JavaScript: Bad address at /usr/lib/perl5/5.8/cygwin/DynaLoader.pm line 230...&quot;<br/><br/>however,<br/><br/>make test<br/><br/>is ok when I link JavaScript.dll staticaly with something like /usr/local/lib/libjs.a.<br/><br/>as opposed to...<br/><br/>LD_RUN_PATH=&quot;&quot; ld2 -s -L/usr/local/lib JavaScript.o -o blib/arch/auto/JavaScript/JavaScript.dll /usr/lib/perl5/5.8/cygwin/CORE/libperl.dll.a -ljs<br/><br/><br/>which will not.<br/><br/>So it comes to how to properly create a js.dll in cygwin environment? is ld2 the right way?<br/><br/><br/><br/>&gt; Are there better ways to implement javascript modules under LWP (a la cygwin)?<br/>&gt; <br/>&gt; How to use gdb with a perl session, and trap the cause of dynamic loader failure?<br/><br/>thanks for any answers,<br/><br/>Christian.<br/><br/> ========================================<br/> Dr. Christian Montanari,<br/> SHARP TELECOMMUNICATIONS OF EUROPE Ltd.,<br/> Azure House,<br/> Bagshot Road,<br/> Bracknell,<br/> Berks, RG12 7QY, UK.<br/> Tel: +44 (0) 1344 301883<br/> Fax: +44 (0) 1344 300293<br/> ========================================<br/><br/> http://www.nntp.perl.org/group/perl.javascript/2005/11/msg44.html Thu, 17 Nov 2005 05:35:16 +0000 has anyone had success with JavaScript-0.55? by Christian Montanari Hi,<br/><br/>I am trying to read javascript: urls with LWP (under cygwin).<br/><br/>Then imported the JavaScript-0.55 perl package,<br/>but after an slightly modified compilation...<br/>I succeded to build (but badly) the JavaScript.dll with js from ftp://ftp.mozilla.org/???/js.<br/>I had to fiddle with a few settings in js-1.5 but made js.exe to work.<br/><br/>However, arriving to the perl package I failed miserably with this:<br/><br/>&quot;....Can&#39;t load &#39;/usr/src/JavaScript-0.55/blib/arch/auto/JavaScript/JavaScript.dll&#39; for module JavaScript: Bad address at /usr/lib/perl5/5.8/cygwin/DynaLoader.pm line 230...&quot;<br/><br/>Then I cropped down to bare minimum the JavaScript.pm and JavaScript.xs, but still ended with failure:<br/><br/>&quot;....Can&#39;t load &#39;/usr/src/JavaScript-0.55/blib/arch/auto/JavaScript/JavaScript.dll&#39; for module JavaScript: No such file or directory at /usr/lib/perl5/5.8/cygwin/DynaLoader.pm line 230....&quot;<br/><br/><br/>Has anyone had better experience with those packages and give me some tips on how to carry the installation?<br/><br/>Are there better ways to implement javascript modules under LWP (a la cygwin)?<br/><br/>How to use gdb with a perl session, and trap the cause of dynamic loader failure?<br/><br/><br/>Thanks for any answers,<br/><br/>Christian.<br/>-- <br/>========================================<br/>Dr. Christian Montanari,<br/>SHARP TELECOMMUNICATIONS OF EUROPE Ltd.,<br/>Azure House,<br/>Bagshot Road,<br/>Bracknell,<br/>Berks, RG12 7QY, UK.<br/>Tel: +44 (0) 1344 301883<br/>Fax: +44 (0) 1344 300293<br/>========================================<br/><br/> http://www.nntp.perl.org/group/perl.javascript/2005/11/msg43.html Thu, 17 Nov 2005 02:42:46 +0000 external Javascript in Perl by Neelay Hi,<br/>I have an external Javascript file in /var/www/html folder called<br/>head.js.<br/>When I create an html file, say exp.html, and include head.js in its<br/>&lt;head&gt; section, the result is as desired. However, when I write a Perl<br/>script in /var/www/cgi-bin, say exp.pl and try to include the head.js<br/>file, the Javascript output is not obtained on the page. Following line<br/>includes the Javascript file in Perl-<br/>print &quot;&lt;script src=\&quot;..\/html\/head.js\&quot; language=\&quot;javascript\&quot;<br/>type=\&quot;text\/javascript\&quot;&gt;\n&quot;;<br/>I also tried without the backslash (to escape the /) and also tried<br/>placing the head.js file in the cgi-bin directory-<br/> print &quot;&lt;script src=\&quot;head.js\&quot; language=\&quot;javascript\&quot;<br/>type=\&quot;text\/javascript\&quot;&gt;\n&quot;;<br/><br/>Any ideas on what the problem could be?<br/>Thanks.<br/><br/>-Neelay.<br/><br/> http://www.nntp.perl.org/group/perl.javascript/2005/11/msg42.html Mon, 14 Nov 2005 13:19:32 +0000 [PATCH] Fix compilation on Gentoo Linux by Ingo Blechschmidt Hi,<br/><br/>here&#39;s a (one-word :)) patch to fix compilation of<br/>JavaScript.xs on Gentoo Linux.<br/><br/>FYI, the include files of the JS engine are installed<br/>into one of two places on Gentoo Linux:<br/><br/> - /usr/lib/MozillaFirefox/include/js<br/> (If Firefox is compiled from source)<br/><br/> - /usr/include/js<br/> (If Firefox is not compiled from source, but<br/> dev-lang/spidermonkey is installed)<br/><br/><br/>--Ingo<br/><br/>--- Makefile.PL.orig 2005-07-19 21:20:24.983114160 +0200<br/>+++ Makefile.PL 2005-07-19 21:20:54.981553704 +0200<br/>@@ -14,7 +14,7 @@<br/> <br/> if(-f &quot;/etc/gentoo-release&quot;) {<br/> # Gentoo puts libjs in a slightly hidden spot.<br/>- $inc = &#39;-I/usr/lib/MozillaFirefox/include/js/ -I/usr/lib/MozillaFirefox/&#39;;<br/>+ $inc = &#39;-I/usr/lib/MozillaFirefox/include/js/ -I/usr/lib/MozillaFirefox/ -I/usr/include/js/&#39;;<br/> }<br/> <br/> #test for debian type include files...<br/><br/>-- <br/>Linux, the choice of a GNU | self-reference, n. - See self-reference <br/>generation on a dual AMD | <br/>Athlon! |<br/> http://www.nntp.perl.org/group/perl.javascript/2005/07/msg41.html Tue, 19 Jul 2005 17:29:59 +0000 CGI & javascript newbee question by hien chau Hi,<br/><br/>I have my form with a text field as follows:<br/><br/> &lt;input name=&quot;STATIC_TEXT&quot; type=&quot;text&quot;&gt;<br/><br/>and button that calls a javascript function to create<br/>this text field.<br/><br/> &lt;input name=&quot;DYNAMIC_TEXT&quot; type=&quot;text&quot;&gt;<br/><br/>Both text fields have some text on them.<br/><br/><br/>on my CGI action, I have some codes like this.<br/><br/>my $page = CGI-&gt;new;<br/>my $static_text = $page-&gt;param(&quot;STATIC_TEXT&quot;);<br/>my $dynamic_text = $page-&gt;param(&quot;DYNAMIC_TEXT&quot;);<br/><br/>The result is $static_text has expected text, but<br/>$dynamic_text is empty. Could anybody give some<br/>advices on this.<br/><br/>Thanks, Hien<br/><br/><br/><br/><br/> <br/>__________________________________ <br/>Yahoo! Mail <br/>Stay connected, organized, and protected. Take the tour: <br/>http://tour.mail.yahoo.com/mailtour.html <br/><br/> http://www.nntp.perl.org/group/perl.javascript/2005/06/msg40.html Wed, 08 Jun 2005 11:41:01 +0000 problem with methods on a bound class by Dan Thomas Hi, <br/> <br/>I&#39;ve been fiddling around with JavaScript.pm, which is very cool, I have to <br/>say, I&#39;ve bound a class, and sucessfully bound an object, and i can read <br/>from the object&#39;s properties, and execute it&#39;s getter/setter functions, but <br/>for some reason i cannot get the object&#39;s methods to work.. <br/> <br/>here&#39;s a cleaned up version of what i&#39;ve been testing with: <br/> <br/>$js-&gt;bind_class( <br/>name=&gt;&#39;Foo&#39;, <br/>methods=&gt;{ <br/>test =&gt; \&amp;Foo::test <br/>}, <br/>properties=&gt;{ <br/>testy =&gt;{ <br/>flags =&gt; JS_PROP_READONLY | JS_PROP_ACCESSOR, <br/>getter =&gt; \&amp;Foo::test_getter, <br/>} <br/>} <br/>); <br/>my $obj = new Foo(); <br/>$js-&gt;bind_object(&#39;obj&#39;, $obj) <br/> <br/>(where package Foo has a &#39;test&#39; method) <br/> <br/>... <br/> <br/>now in js: &#39;obj.testy&#39; (the property) works fine, but &#39;obj.test()&#39; (method) <br/>just doesn&#39;t.. there seems to be no indication that it&#39;s successfully bound <br/>(everything just says it&#39;s not defined).. getters and setters work, but <br/>methods just don&#39;t seem to.. <br/> <br/>Any clues as to what&#39;s going on? <br/> <br/>Dan http://www.nntp.perl.org/group/perl.javascript/2005/04/msg39.html Sat, 30 Apr 2005 21:43:50 +0000 Re: How to tell remote that javascript is running? by Paul Hamingson Carl,<br/>I don&#39;t believe that it is an explicit communication that tells the <br/>server that javascript is running, but rather the fact that the initial <br/>page has some javascript that alters what the next request would be. The <br/>most common thing would involve setting or altering a cookie, or using a <br/>document.write call to alter some aspect of a form to be submitted - or <br/>displayed.<br/><br/>You can use something to capture the entire conversation (like Ethereal <br/>- http://www.ethereal.com/) while you use a regular browser to walk <br/>through the steps if you&#39;re up for the task of walking through all the <br/>ins and outs of tcp/ip packets, or you can use a combination of view <br/>source along with the livehtttpheaders <br/>(http://livehttpheaders.mozdev.org/) extension for Firefox/Mozilla.<br/><br/>The Webdeveloper extension for Firefox (http://webdeveloper.mozdev.org/) <br/>also has some good tools for hypertext transfer protocol detectives. But <br/>&quot;View Source&quot; is the simplest place to start.<br/><br/>Hope I&#39;m not stating too much of the obvious, but your question and code <br/>example were pretty general.<br/><br/>Peace,<br/>Paul<br/><br/><br/><br/>Carl A. Schreiber wrote:<br/><br/>&gt;Hi,<br/>&gt;<br/>&gt;I want to download some html-pages that send something different if javascript <br/>&gt;is not running. So <br/>&gt; use LWP::Simple;<br/>&gt; ..<br/>&gt; $got = get( $url );<br/>&gt;does not work, because LWP::Simple does not tell the sever that javascript is <br/>&gt;running.<br/>&gt;<br/>&gt;Is there a solution? Right now I don&#39;t need to run the javascript code I just <br/>&gt;want to act as it were possible.<br/>&gt;<br/>&gt;Thanks in advance,<br/>&gt;carl<br/>&gt;<br/>&gt; <br/>&gt;<br/><br/>-- <br/>&quot;If you wish to be happy yourself, you must<br/>resign yourself to seeing others also happy.&quot;<br/>-- Bertrand Russell<br/><br/> http://www.nntp.perl.org/group/perl.javascript/2005/04/msg38.html Fri, 01 Apr 2005 08:54:46 +0000 How to tell remote that javascript is running? by Carl A. Schreiber Hi,<br/><br/>I want to download some html-pages that send something different if javascript <br/>is not running. So <br/> use LWP::Simple;<br/> ..<br/> $got = get( $url );<br/>does not work, because LWP::Simple does not tell the sever that javascript is <br/>running.<br/><br/>Is there a solution? Right now I don&#39;t need to run the javascript code I just <br/>want to act as it were possible.<br/><br/>Thanks in advance,<br/>carl<br/> http://www.nntp.perl.org/group/perl.javascript/2005/03/msg37.html Thu, 31 Mar 2005 03:40:28 +0000 Javascript nested objects and their properties by Andy <br/>----- Original Message ----- <br/>From: &quot;Andy&quot; &lt;a@xygot.com&gt;<br/>To: &lt;perl-javascript-subscribe@perl.org&gt;<br/>Cc: &lt;claes@contiller.se&gt;<br/>Sent: Monday, February 21, 2005 10:28 PM<br/>Subject: nested objects and their properties<br/><br/><br/>&gt; Hi,<br/>&gt;<br/>&gt; I am using your module to read within perl some parameters set within the <br/>&gt; JavaScript.<br/>&gt;<br/>&gt; As documented I can first of all bind to an object within perl like this:<br/>&gt;<br/>&gt; my $doc = new Document();<br/>&gt; $context-&gt;bind_object(&#39;document&#39;, $doc);<br/>&gt;<br/>&gt; and then set the property within JS:<br/>&gt;<br/>&gt; document.value = &quot;some test string&quot;;<br/>&gt;<br/>&gt; and then get at the value of the property when back within perl:<br/>&gt;<br/>&gt; $string = $doc-&gt;{&#39;value&#39;};<br/>&gt;<br/>&gt; It all works fine. But is there an easy way to work with nested objects? <br/>&gt; I.e. if my JS has an object called document.myform.parameter1 with a <br/>&gt; property called value, how do I bind to that so that I can read within <br/>&gt; perl the value set by JS like this:<br/>&gt; document.myform.parameter1.value = &quot;test string2&quot;;<br/>&gt;<br/>&gt;<br/>&gt; Thanks for the help,<br/>&gt;<br/>&gt; andy<br/>&gt;<br/>&gt;<br/>&gt; <br/><br/> http://www.nntp.perl.org/group/perl.javascript/2005/02/msg36.html Wed, 23 Feb 2005 17:27:19 +0000 Re: JavaScript installation on Windows by haipeng32 Gnana Ramdev kotamraju wrote:<br/><br/>&gt; Hi<br/>&gt; I have donwloaded the Javascript-0.52 and the js library files. <br/>&gt; I could compile the js/src projects and it created js32.dll and jsshell.exe.<br/>&gt; Now I am trying to make the JavaScript.pm on my windows 2000 environment.<br/>&gt; I am using ActiState Perl 5.6.<br/>&gt; I am getting the following errors while using the command &quot;nmake&quot;<br/><br/>&gt; cl -c -nologo -O1 -MD -DNDEBUG -DWIN32 -D_CONSOLE -DNO_STRICT<br/>-DHAVE_DE<br/>&gt; S_FCRYPT -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DPERL_MSVCRT_READFIX<br/>-O1 -<br/>&gt; MD -DNDEBUG -DVERSION=&quot;0.52&quot; -DXS_VERSION=&quot;0.52&quot; -ID:PerllibCORE -DX<br/>&gt; P_WIN JavaScript.c<br/>&gt; JavaScript.c<br/>&gt; D:PerllibCOREmalloc.h(106) : error C2059: syntax error : &#39;(&#39;<br/>&gt; D:PerllibCOREmalloc.h(107) : error C2059: syntax error : &#39;(&#39;<br/>&gt; D:PerllibCOREmalloc.h(108) : error C2059: syntax error : &#39;(&#39;<br/>&gt; JavaScript.xs(278) : warning C4090: &#39;function&#39; : different &#39;const&#39; qualifiers<br/>&gt; JavaScript.xs(278) : warning C4024: &#39;strcpy&#39; : different types for formal<br/>and ac<br/>&gt; tual parameter 1<br/>&gt; JavaScript.xs(402) : warning C4090: &#39;function&#39; : different &#39;const&#39; qualifiers<br/>&gt; JavaScript.xs(402) : warning C4024: &#39;PCB_GetClass&#39; : different types for<br/>formal<br/>&gt; and actual parameter 2<br/>&gt; JavaScript.xs(490) : warning C4090: &#39;function&#39; : different &#39;const&#39; qualifiers<br/>&gt; JavaScript.xs(490) : warning C4024: &#39;PCB_GetClass&#39; : different types for<br/>formal<br/>&gt; and actual parameter 2<br/>&gt; JavaScript.xs(540) : warning C4090: &#39;function&#39; : different &#39;const&#39; qualifiers<br/>&gt; JavaScript.xs(540) : warning C4024: &#39;PCB_GetClass&#39; : different types for<br/>formal<br/>&gt; and actual parameter 2<br/>&gt; JavaScript.xs(1013) : warning C4133: &#39;function&#39; : incompatible types - from<br/>&#39;str<br/>&gt; uct _PerlIO *&#39; to &#39;struct _iobuf *&#39;<br/>&gt; JavaScript.xs(1260) : warning C4133: &#39;function&#39; : incompatible types - from<br/>&#39;str<br/>&gt; uct _PerlIO *&#39; to &#39;struct _iobuf *&#39;<br/>&gt; JavaScript.xs(1319) : warning C4133: &#39;function&#39; : incompatible types - from<br/>&#39;str<br/>&gt; uct _PerlIO *&#39; to &#39;struct _iobuf *&#39;<br/>&gt; NMAKE : fatal error U1077: &#39;cl&#39; : return code &#39;0x2&#39;<br/>&gt; Stop.<br/><br/>&gt; Please let me know how to resolve this. <br/>&gt; Thanks<br/>&gt; Gnana<br/><br/><br/>&gt; __________________________________<br/>&gt; Do you Yahoo!?<br/>&gt; Free Pop-Up Blocker - Get it now<br/>&gt; http://companion.yahoo.com/<br/><br/><br/> http://www.nntp.perl.org/group/perl.javascript/2004/10/msg35.html Mon, 25 Oct 2004 05:47:33 +0000 Converting a JS variable into a Perl one by rfreddy Hi.<br/>I have a function in JS like this: function(arg) and I&#39;m using<br/>JavaScript.pm. I want to assign arg&#39;s values to a Perl variable<br/>($var=arg), this is possible?<br/><br/>Thanks.<br/><br/>Freddy A. Rojas P.<br/><br/> http://www.nntp.perl.org/group/perl.javascript/2004/09/msg34.html Thu, 09 Sep 2004 07:04:03 +0000