develooper Front page | perl.perl5.porters | Postings from August 2001

marking can() coderef as a method

Thread Next
Geoffrey Young
August 23, 2001 10:50
marking can() coderef as a method
Message ID:
hi all...

  I thought it might be genuinely useful to mark a coderef returned by
UNIVERSAL::can() as being a method so that XS routines can know whether to
use perl_call_method or perl_call_sv on it.  

  please forgive me if I misunderstand the purpose of CvMETHOD_on - I
scoured the archives but could only find a smattering of information and I'm
probably a bit out of my league here anyway... 


this patch is against the current bleedperl available from rsync - a clean
build passes all tests on my system.

--- universal.c.old	Thu Aug 23 13:14:18 2001
+++ universal.c	Thu Aug 23 13:38:27 2001
@@ -219,8 +219,10 @@
     if (pkg) {
         GV *gv = gv_fetchmethod_autoload(pkg, name, FALSE);
-        if (gv && isGV(gv))
+        if (gv && isGV(gv)) {
+	    CvMETHOD_on(GvCV(gv));
 	    rv = sv_2mortal(newRV((SV*)GvCV(gv)));
+        } 
     ST(0) = rv;

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About