Changeset 3865 for src/perl5

Show
Ignore:
Timestamp:
05/25/05 07:33:47 (4 years ago)
Author:
autrijus
svk:copy_cache_prev:
5385
Message:

* new perl5_can API to test whether a method can be found

in perl5 land, or fallback to perl6.

Location:
src/perl5
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • src/perl5/perl5.c

    r3863 r3865  
    167167    return rv; 
    168168} 
     169 
     170bool 
     171perl5_can(SV *inv, char *subname) 
     172{ 
     173    int rv; 
     174 
     175    dSP; 
     176 
     177    ENTER; 
     178    SAVETMPS; 
     179 
     180    PUSHMARK(SP); 
     181    XPUSHs(inv); 
     182    XPUSHs(newSVpv(subname, 0)); 
     183    PUTBACK; 
     184 
     185    call_pv("UNIVERSAL::can", G_SCALAR); 
     186 
     187    SPAGAIN; 
     188 
     189    rv = POPi; 
     190    /* printf("Checking: %s->can(%s), ret %d\n", SvPV_nolen(inv), subname, rv); */ 
     191 
     192    PUTBACK; 
     193    FREETMPS; 
     194    LEAVE; 
     195 
     196    return rv; 
     197} 
     198 
  • src/perl5/perl5.h

    r3863 r3865  
    88SV * perl5_newSViv ( int iv ); 
    99SV * perl5_call(char *subname, int argc, SV** args); 
    10  
     10bool perl5_can(SV *inv, char *subname);