develooper Front page | perl.perl5.porters | Postings from December 2013

Re: [perl #120826] call_sv's docs are misleading

Thread Previous | Thread Next
From:
Eric Brine
Date:
December 19, 2013 14:25
Subject:
Re: [perl #120826] call_sv's docs are misleading
Message ID:
CALJW-qGcyG_cV+XvXQfD2=7K+7yMizPFUZuYAT=fKg4-8dLU8g@mail.gmail.com
On Thu, Dec 19, 2013 at 4:47 AM, bulk88 <perlbug-followup@perl.org> wrote:

> # New Ticket Created by  bulk88
> # Please include the string:  [perl #120826]
> # in the subject line of all future correspondence about this issue.
> # <URL: https://rt.perl.org/Ticket/Display.html?id=120826 >
>
>
> This is a bug report for perl from bulk88@hotmail.com,
> generated with the help of perlbug 1.39 running under perl 5.19.7.
>
>
> -----------------------------------------------------------------
> [Please describe your issue here]
>
> call_sv's docs currently say
>
> ---------------------------------------------------------------
> =for apidoc p||call_sv
>
> Performs a callback to the Perl sub whose name is in the SV.  See
> L<perlcall>.
>
> =cut
> ---------------------------------------------------------------
>
> That says it is exactly equivalent to "call_pv(SvPV_nolen(sv),0);"
>
> perlcall says "This allows you to specify the Perl subroutine to be
> called either as a C string (which has first been converted to an SV) or
> a reference to a subroutine."
>
> So my question is, what is the all inclusive list of what call_sv can be
> used on? And more specifically, will call_sv take a CV *? Not a SV * ref
> to a CV *, but a CV *?
>

[Assumes neither G_METHOD nor G_METHOD_NAMED was provided as a flag.]

A comment in the source says "May be called with any of a CV, a GV, or an
SV containing the name."

But it also accepts a code reference. Specifically, when neither G_METHOD
nor G_METHOD_NAMED was provided as a flag, it takes whatever pp_entersub
takes.

   - AV*, HV* and undef are errors.
   - sv == &PL_sv_yes is a no-op. It is documented as "unfound import,
   ignore".
   - GV*, CV*, code reference are accepted as the source of a CV*.
   - Anything else is presumed to be a string.

Note: "GV*" is defined as: SvTYPE(sv) == SVt_PVGV or SvTYPE(sv) == SVt_PVLV
&& isGV_with_GP(sv)

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About