r18270 - in /trunk/libjavascript-perl: Changes JavaScript.xs MANIFEST META.yml Makefile.PL PJS_Context.h PJS_Exceptions.c PJS_Exceptions.h debian/changelog lib/JavaScript.pm lib/JavaScript/Context.pm t/17-error-handler.t

gregoa-guest at users.alioth.debian.org gregoa-guest at users.alioth.debian.org
Wed Apr 2 17:32:19 UTC 2008


Author: gregoa-guest
Date: Wed Apr  2 17:32:18 2008
New Revision: 18270

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=18270
Log:
New upstream release.

Removed:
    trunk/libjavascript-perl/t/17-error-handler.t
Modified:
    trunk/libjavascript-perl/Changes
    trunk/libjavascript-perl/JavaScript.xs
    trunk/libjavascript-perl/MANIFEST
    trunk/libjavascript-perl/META.yml
    trunk/libjavascript-perl/Makefile.PL
    trunk/libjavascript-perl/PJS_Context.h
    trunk/libjavascript-perl/PJS_Exceptions.c
    trunk/libjavascript-perl/PJS_Exceptions.h
    trunk/libjavascript-perl/debian/changelog
    trunk/libjavascript-perl/lib/JavaScript.pm
    trunk/libjavascript-perl/lib/JavaScript/Context.pm

Modified: trunk/libjavascript-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libjavascript-perl/Changes?rev=18270&op=diff
==============================================================================
--- trunk/libjavascript-perl/Changes (original)
+++ trunk/libjavascript-perl/Changes Wed Apr  2 17:32:18 2008
@@ -1,5 +1,13 @@
 Revision history for Perl extension JavaScript.
 
+1.05 Tue Apr 1 2008
+    - Drop support for error handlers
+    - This module now requires SpiderMonkey 1.7 or later.
+    - Makefile.PL now compiles a small test to see if libs and headers can be found
+    - Makefile.PL now discovers install locations on CentOS5 (Gavin Carr)
+    - Drop support for Perl 5.6.x and earlier because we need some API symbols not available there 
+      and they don't support unicode properly either. [rt.cpan.org #31114]
+      
 1.04 Sat Nov 17 2007
     - Skip exception tests on engines less than 1.7 since these seem to be broken.
     - Free memory allocated by JS_smprintf when converting from utf8 strings (spotted by Ash Berlin)

Modified: trunk/libjavascript-perl/JavaScript.xs
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libjavascript-perl/JavaScript.xs?rev=18270&op=diff
==============================================================================
--- trunk/libjavascript-perl/JavaScript.xs (original)
+++ trunk/libjavascript-perl/JavaScript.xs Wed Apr  2 17:32:18 2008
@@ -118,28 +118,6 @@
         RETVAL = 0;
     OUTPUT:
         RETVAL
-
-void
-jsc_set_error_handler(cx, handler)
-    PJS_Context *cx;
-    SV *handler;
-    CODE:
-        if (!SvOK(handler)) {
-            /* Remove handler */
-            if (cx->error_handler != NULL) {
-                SvREFCNT_dec(cx->error_handler);
-            }
-
-            cx->error_handler = NULL;
-            JS_SetErrorReporter(PJS_GetJSContext(cx), NULL);
-        }
-        else if (SvROK(handler) && SvTYPE(SvRV(handler)) == SVt_PVCV) {
-            if (cx->error_handler != NULL) {
-                SvREFCNT_dec(cx->error_handler);
-            }
-            cx->error_handler = SvREFCNT_inc(handler);
-            JS_SetErrorReporter(PJS_GetJSContext(cx), PJS_error_handler);
-        }
 
 void
 jsc_set_branch_handler(cx, handler)

Modified: trunk/libjavascript-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libjavascript-perl/MANIFEST?rev=18270&op=diff
==============================================================================
--- trunk/libjavascript-perl/MANIFEST (original)
+++ trunk/libjavascript-perl/MANIFEST Wed Apr  2 17:32:18 2008
@@ -52,7 +52,6 @@
 t/14-roundtrip-function.t
 t/15-function.t
 t/16-object.t
-t/17-error-handler.t
 t/18-interrupt-handler.t
 t/19-engine-version.t
 t/20-bind-class.t

Modified: trunk/libjavascript-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libjavascript-perl/META.yml?rev=18270&op=diff
==============================================================================
--- trunk/libjavascript-perl/META.yml (original)
+++ trunk/libjavascript-perl/META.yml Wed Apr  2 17:32:18 2008
@@ -1,15 +1,15 @@
 --- #YAML:1.0
 name:                JavaScript
-version:             1.04
+version:             1.05
 abstract:            Perl extension for executing embedded JavaScript
 license:             perl
-generated_by:        ExtUtils::MakeMaker version 6.36
+author:              
+    - Claes Jakobsson <claesjac at cpan.org>
+generated_by:        ExtUtils::MakeMaker version 6.44
 distribution_type:   module
 requires:     
     Test::Exception:               0
     Test::More:                    0
 meta-spec:
-    url:     http://module-build.sourceforge.net/META-spec-v1.2.html
-    version: 1.2
-author:
-    - Claes Jakobsson <claesjac at cpan.org>
+    url:     http://module-build.sourceforge.net/META-spec-v1.3.html
+    version: 1.3

Modified: trunk/libjavascript-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libjavascript-perl/Makefile.PL?rev=18270&op=diff
==============================================================================
--- trunk/libjavascript-perl/Makefile.PL (original)
+++ trunk/libjavascript-perl/Makefile.PL Wed Apr  2 17:32:18 2008
@@ -1,8 +1,12 @@
-use ExtUtils::MakeMaker;
+use 5.008;
 
 use strict;
 use warnings;
 
+use ExtUtils::MakeMaker;
+use File::Temp qw(:POSIX);
+use Config;
+
 # CCFLAGS
 my @ccflags;
 
@@ -12,7 +16,7 @@
 my @defines;
 
 my $path_separator = ":";
-if($^O eq 'MSWin32') {
+if($^O eq "MSWin32") {
     push @defines,  "XP_PC";
     $path_separator = ";";
 } else {
@@ -20,7 +24,7 @@
 }
 
 # Name of lib to link
-my $lib = 'js';
+my $lib = "js";
 
 # Directories with include files
 my @incs;
@@ -32,7 +36,7 @@
 my @extra_headers;
 
 # Directory to prefix #include with
-my $inc_dir = '';
+my $inc_dir = "";
 
 #test for debian type libsmjs
 #this could probably be done better, but I'm not sure how to
@@ -46,7 +50,7 @@
 if (-f "/usr/include/smjs/jsapi.h") {
     push @incs, "/usr/include/smjs/";
     push @defines, "INCLUDES_IN_SMJS";
-    $inc_dir = 'smjs/';
+    $inc_dir = "smjs/";
 }
 elsif(-f "/usr/local/include/smjs/jsapi.h") {
     push @incs, "/usr/local/include/smjs/";
@@ -55,7 +59,7 @@
 elsif(-f "/usr/include/mozjs/jsapi.h") {
     push @incs, "/usr/include/mozjs/";
     push @defines, "INCLUDES_IN_MOZJS";
-    $inc_dir = 'mozjs/';
+    $inc_dir = "mozjs/";
 }
 elsif(-f "/usr/local/include/mozjs/jsapi.h") {
     push @incs, "/usr/local/include/mozjs/";
@@ -65,6 +69,10 @@
 # Debian puts nspr headers in /usr/include/nspr
 if (-f "/usr/include/nspr/pratom.h") {
     push @incs, "/usr/include/nspr/";
+}
+# RHEL5/CentOS5 use /usr/include/nspr4 for nspr headers
+elsif (-f "/usr/include/nspr4/pratom.h") {
+    push @incs, "/usr/include/nspr4/";
 }
 
 # test for gentoo
@@ -84,12 +92,12 @@
 # Override with $ENV{JS_LIB} and $ENV{JS_INC}
 if (exists $ENV{JS_LIB}) {
     @libs = get_paths($ENV{JS_LIB});
-    $lib = 'js';
+    $lib = "js";
 }
 if (exists $ENV{JS_INC}) {
     @incs = get_paths($ENV{JS_INC});
-    @defines = grep { $_ ne 'INCLUDES_IN_SMJS' } @defines;
-    $inc_dir = '';
+    @defines = grep { $_ ne "INCLUDES_IN_SMJS" } @defines;
+    $inc_dir = "";
 }
 
 my $libs = join(" ", map { "-L$_" } @libs);
@@ -100,7 +108,7 @@
 }
 else {
     my $enable_threadsafe = prompt("Is your SpiderMonkey compiled with JS_THREADSAFE (most things will fail if you answer wrong)? [y/N]");
-    push @defines, "JS_THREADSAFE" if $enable_threadsafe eq 'y';
+    push @defines, "JS_THREADSAFE" if $enable_threadsafe eq "y";
 }
 
 # Check if we need to enable JS_C_STRINGS_ARE_UTF8?
@@ -109,7 +117,7 @@
 }
 else {
     my $enable_utf8 = prompt("Is your SpiderMonkey compiled with support for unicode (t/23-unicode.t will fail if you answer wrong) ? [y/N]", "N");
-    push @defines, "JS_C_STRINGS_ARE_UTF8" if $enable_utf8 eq 'y';
+    push @defines, "JS_C_STRINGS_ARE_UTF8" if $enable_utf8 eq "y";
 }
 
 # Check if we want E4X support
@@ -121,7 +129,7 @@
 }
 else {
     my $enable_e4x = prompt("Do you want support for E4X (requires SpiderMonkey > 1.5) ? [y/N]", "N");
-    if ($enable_e4x eq 'y') {
+    if ($enable_e4x eq "y") {
         push @extra_headers, "jsxml";
         push @defines, "JS_ENABLE_E4X";     
     }
@@ -144,23 +152,53 @@
 
 close $header;
 
+# Try a small compile to determine if we can find libs and headers
+open my $test_script, ">test_js.c" || die $!;
+print $test_script <<'END_OF_SOURCE';
+#include <stdio.h>
+#include "JavaScript_Env.h"
+
+int main(int argc, char **argv) {
+    printf("%s", JS_GetImplementationVersion());
+}
+END_OF_SOURCE
+close $test_script;
+my $exe = tmpnam();
+system($Config{cc}, $libs, @ccflags, "-l${lib}", "-o", $exe, (map { "-I$_" } @incs), "test_js.c");
+if ($?) {
+    print "Failed compiling test_js.c. ABORTING\n";
+    exit 1;
+}
+unlink("test_js.c");
+
+# Get js version and require 1.7 or later
+my ($engine, $version, $date) = split/\s+/, qx($exe);
+my ($v2) = $version =~ /^(\d+\.\d+)/;
+if ($v2 < 1.7) {
+    if (prompt("I require SpiderMonkey version 1.7 or later but found ${version}. Try anyways? [y/N]", "N") ne "y") {
+        exit 1;
+    }
+}
+
+# Dispose temp stuff
+unlink($exe);
+
 # Write makefile
-
-WriteMakefile('NAME'            => 'JavaScript',
-              'VERSION_FROM'    => 'lib/JavaScript.pm', # finds $VERSION
-              'PREREQ_PM'       => {
-                                    'Test::More' => 0,
-                                    'Test::Exception' => 0,
-                                }, # e.g., Module::Name => 1.1
-              ($] >= 5.005 ?    ## Add these new keywords supported since 5.005
-               (ABSTRACT_FROM   => 'lib/JavaScript.pm', # retrieve abstract from module
-                AUTHOR          => 'Claes Jakobsson <claesjac at cpan.org>') : ()),
-              'CCFLAGS'         => join(" ", @ccflags),
-              'LIBS'            => ["$libs -l${lib}"], # e.g., '-lm'
-              'INC'             => join(" ", map { "-I$_" } @incs),
-              'LICENSE'         => 'perl',
-              'OBJECT'          => q/$(O_FILES)/, 
-          );
+WriteMakefile(
+    NAME            => "JavaScript",
+    VERSION_FROM    => "lib/JavaScript.pm",
+    PREREQ_PM       => {
+        "Test::More"      => 0,
+        "Test::Exception" => 0,
+    },
+    ABSTRACT_FROM   => "lib/JavaScript.pm", # retrieve abstract from module
+    AUTHOR          => "Claes Jakobsson <claesjac\@cpan.org>",
+    CCFLAGS         => join(" ", @ccflags),
+    LIBS            => ["$libs -l${lib}"], # e.g., "-lm"
+    INC             => join(" ", map { "-I$_" } @incs),
+    LICENSE         => "perl",
+    OBJECT          => q/$(O_FILES)/, 
+);
 
 sub get_paths {
     my $paths = shift;

Modified: trunk/libjavascript-perl/PJS_Context.h
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libjavascript-perl/PJS_Context.h?rev=18270&op=diff
==============================================================================
--- trunk/libjavascript-perl/PJS_Context.h (original)
+++ trunk/libjavascript-perl/PJS_Context.h Wed Apr  2 17:32:18 2008
@@ -33,9 +33,6 @@
 
     PJS_Context *next;      /* Pointer to the next created context */
     PJS_Runtime *rt;
-
-    /* Set to a SVt_PVCV if we have an error handler */
-    SV *error_handler;
 
     /* Set to a SVt_PVCV if we have an branch handler */
     SV *branch_handler;
@@ -73,9 +70,6 @@
 
 PJS_EXTERN JSBool
 PJS_branch_handler(JSContext *, JSScript *);
-
-PJS_EXTERN void
-PJS_error_handler(JSContext *, const char *, JSErrorReport *);
 
 /*! @functiongroup Querying contexts */
 

Modified: trunk/libjavascript-perl/PJS_Exceptions.c
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libjavascript-perl/PJS_Exceptions.c?rev=18270&op=diff
==============================================================================
--- trunk/libjavascript-perl/PJS_Exceptions.c (original)
+++ trunk/libjavascript-perl/PJS_Exceptions.c Wed Apr  2 17:32:18 2008
@@ -29,28 +29,3 @@
         }
     }
 }
-
-/* Called by context when we encounter an error */
-void PJS_error_handler(JSContext *cx, const char *message, JSErrorReport *report) {
-    dSP;
-    PJS_Context *context;
-    
-    context = PJS_GET_CONTEXT(cx);
-
-    if (context != NULL && context->error_handler) {
-        ENTER ;
-        SAVETMPS ;
-        PUSHMARK(SP) ;
-        XPUSHs(newSVpv(message, strlen(message)));
-        XPUSHs(newSVpv(report->filename, strlen(report->filename)));
-        XPUSHs(newSViv(report->lineno));
-        if (report->linebuf) {
-            XPUSHs(newSVpv(report->linebuf, strlen(report->linebuf)));
-        }
-        else {
-            XPUSHs(&PL_sv_undef);
-        }
-        PUTBACK;
-        perl_call_sv(SvRV(context->error_handler), G_DISCARD | G_VOID | G_EVAL);
-    }
-}

Modified: trunk/libjavascript-perl/PJS_Exceptions.h
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libjavascript-perl/PJS_Exceptions.h?rev=18270&op=diff
==============================================================================
--- trunk/libjavascript-perl/PJS_Exceptions.h (original)
+++ trunk/libjavascript-perl/PJS_Exceptions.h Wed Apr  2 17:32:18 2008
@@ -19,9 +19,6 @@
 PJS_EXTERN void
 PJS_report_exception(PJS_Context *);    
 
-PJS_EXTERN void
-PJS_error_handler(JSContext *, const char *, JSErrorReport *);
-
 #ifdef __cplusplus
 }
 #endif

Modified: trunk/libjavascript-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libjavascript-perl/debian/changelog?rev=18270&op=diff
==============================================================================
--- trunk/libjavascript-perl/debian/changelog (original)
+++ trunk/libjavascript-perl/debian/changelog Wed Apr  2 17:32:18 2008
@@ -1,3 +1,9 @@
+libjavascript-perl (1.05-1) UNRELEASED; urgency=low
+
+  * New upstream release.
+
+ -- gregor herrmann <gregor+debian at comodo.priv.at>  Wed, 02 Apr 2008 19:29:27 +0200
+
 libjavascript-perl (1.04-3) unstable; urgency=low
 
   [ gregor herrmann ]

Modified: trunk/libjavascript-perl/lib/JavaScript.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libjavascript-perl/lib/JavaScript.pm?rev=18270&op=diff
==============================================================================
--- trunk/libjavascript-perl/lib/JavaScript.pm (original)
+++ trunk/libjavascript-perl/lib/JavaScript.pm Wed Apr  2 17:32:18 2008
@@ -1,6 +1,6 @@
 package JavaScript;
 
-use 5.006;
+use 5.008;
 
 use strict;
 use warnings;
@@ -23,7 +23,7 @@
 
 our %EXPORT_TAGS = ( all => [@EXPORT_OK] );
 
-our $VERSION = '1.04';
+our $VERSION = '1.05';
 
 our $MAXBYTES = 1024 ** 2;
 

Modified: trunk/libjavascript-perl/lib/JavaScript/Context.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libjavascript-perl/lib/JavaScript/Context.pm?rev=18270&op=diff
==============================================================================
--- trunk/libjavascript-perl/lib/JavaScript/Context.pm (original)
+++ trunk/libjavascript-perl/lib/JavaScript/Context.pm Wed Apr  2 17:32:18 2008
@@ -272,14 +272,6 @@
     return;
 }
 
-sub set_error_handler {
-    my ($self, $handler) = @_;
-
-    $handler = _resolve_method($handler, 1);
-    
-    jsc_set_error_handler($self->{_impl}, $handler);
-}
-
 sub set_branch_handler {
     my ($self, $handler) = @_;
 
@@ -470,20 +462,12 @@
 
 Returns the C<JavaScript::Context>-object associated with a given native context.
 
-=item set_error_handler ( $handler )
-
-Attaches an error handler (a function that is called when an error occurs) to the contex.
-The argument I<$handler> must be either a code-reference or the name of a subroutine in
-the calling package.
+=item set_branch_handler ( $handler )
+
+Attaches an branch callback handler (a function that is called when a branch is performed) to the context. The argument I<$handler> may be a code-reference or the name of a subroutine.
 
 To remove the handler call this method with an undefined argument.
 
-=item set_branch_handler ( $handler )
-
-Attaches an branch callback handler (a function that is called when a branch is performed) to the context. The argument I<$handler> may be a code-reference or the name of a subroutine.
-
-To remove the handler call this method with an undefined argument.
-
 The handler is called when a script branches backwards during execution, when a function returns and the end of the script. To continue execution the handler must return a true value. To abort execution either throw an exception or return a false value.
 
 =back
@@ -538,10 +522,6 @@
 
 Defines a new named property in I<parent> with the value of I<object>.
 
-=item jsc_set_error_handler ( PJS_Context *context, SV *handler )
-
-Attaches an exception handler to the context. No check is made to see if I<handler> is a valid SVt_PVCV.
-
 =item jsc_set_branch_handler ( PJS_Context *context, SV *handler )
 
 Attaches a branch handler to the context. No check is made to see if I<handler> is a valid SVt_PVCV.




More information about the Pkg-perl-cvs-commits mailing list