+3.16 - 2009-01-23
+
+ * fix DEFSV_set() for threaded 5.005 perls
+ * add G_METHOD support to call_sv()
+
3.15 - 2009-01-18
* added support for the following API
use strict;
use vars qw($VERSION $data);
-$VERSION = do { my @r = '$Snapshot: /Devel-PPPort/3.15 $' =~ /(\d+\.\d+(?:_\d+)?)/; @r ? $r[0] : '9.99' };
+$VERSION = do { my @r = '$Snapshot: /Devel-PPPort/3.16 $' =~ /(\d+\.\d+(?:_\d+)?)/; @r ? $r[0] : '9.99' };
sub _init_data
{
################################################################################
##
-## $Revision: 18 $
+## $Revision: 19 $
## $Author: mhx $
-## $Date: 2009/01/18 14:10:53 +0100 $
+## $Date: 2009/01/23 18:27:48 +0100 $
##
################################################################################
##
call_method
load_module
vload_module
+G_METHOD
=implementation
__UNDEFINED__ call_method perl_call_method
__UNDEFINED__ eval_sv perl_eval_sv
+/* Replace: 0 */
__UNDEFINED__ PERL_LOADMOD_DENY 0x1
__UNDEFINED__ PERL_LOADMOD_NOIMPORT 0x2
__UNDEFINED__ PERL_LOADMOD_IMPORT_OPS 0x4
-/* Replace: 0 */
+#ifndef G_METHOD
+# define G_METHOD 64
+# ifdef call_sv
+# undef call_sv
+# endif
+# if { VERSION < 5.6.0 }
+# define call_sv(sv, flags) ((flags) & G_METHOD ? perl_call_method((char *) SvPV_nolen_const(sv), \
+ (flags) & ~G_METHOD) : perl_call_sv(sv, flags))
+# else
+# define call_sv(sv, flags) ((flags) & G_METHOD ? Perl_call_method(aTHX_ (char *) SvPV_nolen_const(sv), \
+ (flags) & ~G_METHOD) : Perl_call_sv(aTHX_ sv, flags))
+# endif
+#endif
/* Replace perl_eval_pv with eval_pv */
mPUSHi(i);
void
+call_sv_G_METHOD(sv, flags, ...)
+ SV* sv
+ I32 flags
+ PREINIT:
+ I32 i;
+ PPCODE:
+ for (i=0; i<items-2; i++)
+ ST(i) = ST(i+2); /* pop first two args */
+ PUSHMARK(SP);
+ SP += items - 2;
+ PUTBACK;
+ i = call_sv(sv, flags | G_METHOD);
+ SPAGAIN;
+ EXTEND(SP, 1);
+ mPUSHi(i);
+
+void
load_module(flags, name, version, ...)
U32 flags
SV *name
Perl_load_module(aTHX_ flags, SvREFCNT_inc_simple(name),
SvREFCNT_inc_simple(version), NULL);
-=tests plan => 46
+=tests plan => 52
sub eq_array
{
ok(eq_array( [ &Devel::PPPort::call_argv('f', $flags, @$args) ], $expected));
ok(eq_array( [ &Devel::PPPort::eval_sv("f(qw(@$args))", $flags) ], $expected));
ok(eq_array( [ &Devel::PPPort::call_method('meth', $flags, $obj, @$args) ], $expected));
+ ok(eq_array( [ &Devel::PPPort::call_sv_G_METHOD('meth', $flags, $obj, @$args) ], $expected));
};
ok(&Devel::PPPort::eval_pv('f()', 0), 'y');
################################################################################
##
-## $Revision: 50 $
+## $Revision: 51 $
## $Author: mhx $
-## $Date: 2009/01/18 14:10:55 +0100 $
+## $Date: 2009/01/23 18:28:31 +0100 $
##
################################################################################
##
/* DEFSV appears first in 5.004_56 */
__UNDEFINED__ DEFSV GvSV(PL_defgv)
__UNDEFINED__ SAVE_DEFSV SAVESPTR(GvSV(PL_defgv))
-__UNDEFINED__ DEFSV_set(sv) (GvSV(PL_defgv) = (sv))
+__UNDEFINED__ DEFSV_set(sv) (DEFSV = (sv))
/* Older perls (<=5.003) lack AvFILLp */
__UNDEFINED__ AvFILLp AvFILL
SAVE_DEFSV;
DEFSV_set(newSVpvs("DEFSV"));
XPUSHs(sv_mortalcopy(DEFSV));
- sv_2mortal(DEFSV);
+ /* Yes, this leaks the above scalar; 5.005 with threads for some reason */
+ /* frees it upon LEAVE, thus mortalizing it causes "attempt to free..." */
+ /* sv_2mortal(DEFSV); */
LEAVE;
XPUSHs(sv_mortalcopy(DEFSV));
XSRETURN(3);
################################################################################
##
-## $Revision: 45 $
+## $Revision: 46 $
## $Author: mhx $
-## $Date: 2009/01/18 14:10:53 +0100 $
+## $Date: 2009/01/23 18:28:00 +0100 $
##
################################################################################
##
ok(@o > 100);
ok($fail, 0);
-ok(exists $p{call_sv});
-ok(not ref $p{call_sv});
+ok(exists $p{call_pv});
+ok(not ref $p{call_pv});
ok(exists $p{grok_bin});
ok(ref $p{grok_bin}, 'HASH');
use List::Util qw(max);
use Config;
-my $VERSION = do { my @r = '$Snapshot: /Devel-PPPort/3.15 $' =~ /(\d+\.\d+(?:_\d+)?)/; @r ? $r[0] : '9.99' };
+my $VERSION = do { my @r = '$Snapshot: /Devel-PPPort/3.16 $' =~ /(\d+\.\d+(?:_\d+)?)/; @r ? $r[0] : '9.99' };
$| = 1;
my %OPT = (
require 'testutil.pl' if $@;
}
- if (46) {
+ if (52) {
load();
- plan(tests => 46);
+ plan(tests => 52);
}
}
ok(eq_array( [ &Devel::PPPort::call_argv('f', $flags, @$args) ], $expected));
ok(eq_array( [ &Devel::PPPort::eval_sv("f(qw(@$args))", $flags) ], $expected));
ok(eq_array( [ &Devel::PPPort::call_method('meth', $flags, $obj, @$args) ], $expected));
+ ok(eq_array( [ &Devel::PPPort::call_sv_G_METHOD('meth', $flags, $obj, @$args) ], $expected));
};
ok(&Devel::PPPort::eval_pv('f()', 0), 'y');
ok(@o > 100);
ok($fail, 0);
-ok(exists $p{call_sv});
-ok(not ref $p{call_sv});
+ok(exists $p{call_pv});
+ok(not ref $p{call_pv});
ok(exists $p{grok_bin});
ok(ref $p{grok_bin}, 'HASH');