Changeset 4086 for src/perl5

Show
Ignore:
Timestamp:
05/29/05 04:09:52 (4 years ago)
Author:
clkao
svk:copy_cache_prev:
5515
Message:

Make multiple returned value into AV for perl5_apply.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/perl5/perl5.c

    r4052 r4086  
    216216    SV *sv; 
    217217    void *old_env = pugs_getenv(); 
     218    int count, i; 
    218219 
    219220    dSP; 
     
    234235 
    235236    if (inv != NULL) { 
    236         call_method(SvPV_nolen(sub), cxt); 
     237        count = call_method(SvPV_nolen(sub), cxt); 
    237238    } 
    238239    else { 
    239         call_sv(sub, cxt); 
     240        count = call_sv(sub, cxt); 
    240241    } 
    241242 
    242243    SPAGAIN; 
    243244 
    244     rv = newSVsv(POPs); 
     245    if (count == 1) { 
     246        rv = newSVsv(POPs); 
     247    } 
     248    else { 
     249        rv = (SV *)newAV(); 
     250        for (i=0; i<count; ++i) { 
     251            av_push ((AV *)rv, POPs); 
     252        } 
     253    } 
    245254 
    246255    PUTBACK;