Re: names, values, boxes and microchips

Discussion in 'Perl Misc' started by gamo@telecable.es, Jul 23, 2013.

  1. Guest

    > __SUB__ A special token that returns a reference to the
    >current
    > subroutine,


    The OP wanted the name; will stringify(__SUB__) work?
    ------------------

    If Rainer wants a name, it is a ugly name, not a name for a pretty debug,
    but a name which I thinks is unique, and "could" be used

    $ perl -E 'sub a{ say (__SUB__); return 1; }; a();'
    CODE(0x8195c00)
    , Jul 23, 2013
    #1
    1. Advertising

  2. writes:
    >> __SUB__ A special token that returns a reference to the
    >>current
    >> subroutine,

    >
    > The OP wanted the name; will stringify(__SUB__) work?
    > ------------------
    >
    > If Rainer wants a name, it is a ugly name, not a name for a pretty debug,
    > but a name which I thinks is unique, and "could" be used
    >
    > $ perl -E 'sub a{ say (__SUB__); return 1; }; a();'
    > CODE(0x8195c00)


    The value in brackets is the 'pointer value' stored in the reference
    object, cf

    [rw@sapphire]~ $perl -MDevel::peek -e '$s = sub {}; Dump($s); print($s, "\n")'
    SV = RV(0x620c88) at 0x620c78
    REFCNT = 1
    FLAGS = (ROK)
    RV = 0x620c90
    SV = PVCV(0x623988) at 0x620c90
    REFCNT = 2
    FLAGS = (PADMY,ANON,WEAKOUTSIDE)
    COMP_STASH = 0x605bb0 "main"
    START = 0x629140 ===> 0
    ROOT = 0x6291e0
    GVGV::GV = 0x605e50 "main" :: "__ANON__"
    FILE = "-e"
    DEPTH = 0
    FLAGS = 0x90
    OUTSIDE_SEQ = 94
    PADLIST = 0x620ca8
    PADNAME = 0x620d38(0x6293d0) PAD = 0x620cf0(0x628e10)
    OUTSIDE = 0x605fa0 (MAIN)
    CODE(0x620c90)

    This implies that it is meaningless outside of the context of the
    process it came from and not necessarily unique: The same memory
    location could be used to store a different subroutine at some other
    time, at least in theory.
    Rainer Weikusat, Jul 24, 2013
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stefan Mueller
    Replies:
    5
    Views:
    12,359
    jamesxa
    Jun 16, 2009
  2. fBechmann
    Replies:
    0
    Views:
    393
    fBechmann
    Jun 10, 2004
  3. wanwan
    Replies:
    3
    Views:
    418
    Alex Martelli
    Oct 14, 2005
  4. KathyB
    Replies:
    3
    Views:
    156
    KathyB
    Sep 12, 2003
  5. Rainer Weikusat

    names, values, boxes and microchips

    Rainer Weikusat, Jul 16, 2013, in forum: Perl Misc
    Replies:
    12
    Views:
    260
    Rainer Weikusat
    Jul 22, 2013
Loading...

Share This Page