FAQ
Why does SvPV_nomg call overload magic? Its name says NO MAGIC yet it
runs overload subs. I do not want to run subs or any magic in the SvPV.
What do I do? The Perl_sv_2pv_flags is a SvPV_nomg call. Example call
stack of SvPV_nomg running a sub below.

______________________________________________________________________
perl519.dll!Perl_pp_nextstate(interpreter * my_perl=0x00364dfc)
Line 49 C
    perl519.dll!Perl_runops_standard(interpreter * my_perl=0x00364dfc)
Line 42 + 0x4 C
    perl519.dll!Perl_amagic_call(interpreter * my_perl=0x00364dfc, sv *
left=0x00e09f24, sv * right=0x00364e98, int method=0x0000000a, int
flags=0x00000009) Line 3207 + 0x7 C
    perl519.dll!Perl_sv_2pv_flags(interpreter * my_perl=0x00364dfc, sv *
const sv=0x00e09f24, unsigned int * const lp=0x0012fa80, const long
flags=0x00000000) Line 2795 + 0x14 C
    Util.dll!_validate_int2(interpreter * my_perl=0x00364dfc, sv *
n=0x00e09f24, int negok=0x00000000, sv * * mark=0x00365898) Line 144
+ 0x3e C
    Util.dll!XS_Math__Prime__Util_next_prime(interpreter *
my_perl=0x00364dfc, cv * cv=0x00aa77dc) Line 663 + 0x13 C
    perl519.dll!Perl_pp_entersub(interpreter * my_perl=0x00000000)
Line 2772 C
    perl519.dll!Perl_runops_standard(interpreter * my_perl=0x00364dfc)
Line 42 + 0x4 C
    perl519.dll!S_run_body(interpreter * my_perl=0x00000000, long
oldscope=0x00000001) Line 2433 + 0xa C
    perl519.dll!perl_run(interpreter * my_perl=0x00364dfc) Line 2349 + 0x8 C
    perl519.dll!RunPerl(int argc=0x00000002, char * * argv=0x01364cb8,
char * * env=0x00363340) Line 270 + 0x6 C
    perl.exe!mainCRTStartup() Line 398 + 0xe C
    kernel32.dll!_BaseProcessStart@4() + 0x23

______________________________________________________________________

Search Discussions

  • Father Chrysostomos at Feb 1, 2014 at 7:04 am

    Daniel Dragan wrote:
    Why does SvPV_nomg call overload magic? Its name says NO MAGIC
    The _nomg prefix here is meant to mean no mg_get().
    yet it
    runs overload subs. I do not want to run subs or any magic in the SvPV.
    What do I do?
    That depends on how you want Perl to handle references.

    You could do an SvROK check first and skip the call to SvPV.

    If you want the effect of "no overloading" (or overload::StrVal),
    unfortunately there is no C API for that. (Do you think we need
    one?) You could either modify PL_curcop in place to set up the hints
    and set them back again (hacky), or create a Perl sub that does
    sub { no overloading; "$_[0]" }. No it's not pretty, but I think you
    are the first one to come up with this use case.

    There is an undocumented SV_SKIP_OVERLOAD flag that will cause SvPV to
    return null. I don't think it works properly. It will return NULL in
    cases that have no overloading.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupperl5-porters @
categoriesperl
postedFeb 1, '14 at 6:23a
activeFeb 1, '14 at 7:04a
posts2
users2
websiteperl.org

2 users in discussion

Father Chrysostomos: 1 post Bulk88: 1 post

People

Translate

site design / logo © 2022 Grokbase