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

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

Thread Previous | Thread Next
Eric Brine
December 19, 2013 14:25
Re: [perl #120826] call_sv's docs are misleading
Message ID:
On Thu, Dec 19, 2013 at 4:47 AM, bulk88 <> wrote:

> # New Ticket Created by  bulk88
> # Please include the string:  [perl #120826]
> # in the subject line of all future correspondence about this issue.
> # <URL: >
> This is a bug report for perl from,
> 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

   - AV*, HV* and undef are errors.
   - sv == &PL_sv_yes is a no-op. It is documented as "unfound import,
   - 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 Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About