Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Those bits of source show how strict vars works, but what I'm more interested (and couldn't figure out) is which part of the code determines whether or not a glob assignment will result in setting the IMPORT flag on the GV.

Well, http://perl5.git.perl.org/perl.git/blob?f=gv.c#l1578 is it I think, HINT_STRICT_VARS means strict is on, and that is where the name/flags are checked  (*name == 'a' || *name == 'b') should be familiar (its $a and $b)

Its not commented/decorated, so my next move would be to fireup gitk or some such gitness to see how that block has changed (if at all) over the years ... and refresh my http://search.cpan.org/dist/illguts/index.html knowledge ... cause whatever I knew once I forgot :)

Then

Peeking at the array is meh

$ perl -e "use Devel::Peek; use strict; BEGIN{*main::foo=\@main::foo; +Dump(\@main::foo)}; print @foo; " SV = IV(0xac90b0) at 0xac90b4 REFCNT = 1 FLAGS = (TEMP,ROK) RV = 0x99b9fc SV = PVAV(0x3faa8c) at 0x99b9fc REFCNT = 2 FLAGS = () ARRAY = 0x0 FILL = -1 MAX = -1 ARYLEN = 0x0 FLAGS = (REAL) Variable "@foo" is not imported at -e line 1. Global symbol "@foo" requires explicit package name at -e line 1. Execution of -e aborted due to compilation errors. $ perl -e "use Devel::Peek; use strict; BEGIN{package Pkg; *main::foo= +\@main::foo;};package main; Dump\@foo; " SV = IV(0x3f9a40) at 0x3f9a44 REFCNT = 1 FLAGS = (TEMP,ROK) RV = 0xa8d714 SV = PVAV(0x3faaa4) at 0xa8d714 REFCNT = 2 FLAGS = () ARRAY = 0x0 FILL = -1 MAX = -1 ARYLEN = 0x0 FLAGS = (REAL)

Peeking at the glob is more promising

$ perl -e "use Devel::Peek; use strict; BEGIN{*main::foo=\@main::foo; +Dump(*main::foo)}; print @foo; " SV = PVGV(0xa6ad1c) at 0x99b984 REFCNT = 4 FLAGS = (MULTI,IN_PAD) NAME = "foo" NAMELEN = 3 GvSTASH = 0x3f991c "main" GP = 0xac5fac SV = 0x0 REFCNT = 1 IO = 0x0 FORM = 0x0 AV = 0x99ba04 HV = 0x0 CV = 0x0 CVGEN = 0x0 LINE = 1 FILE = "-e" FLAGS = 0xa EGV = 0x99b984 "foo" Variable "@foo" is not imported at -e line 1. Global symbol "@foo" requires explicit package name at -e line 1. Execution of -e aborted due to compilation errors. $ perl -e "use Devel::Peek; use strict; BEGIN{package Pkg; *main::foo= +\@main::foo;};package main; Dump*foo; " SV = PVGV(0xa6ad3c) at 0x99b994 REFCNT = 2 FLAGS = (MULTI,IN_PAD,IMPORT( AV )) NAME = "foo" NAMELEN = 3 GvSTASH = 0x3f9934 "main" GP = 0xac5fec SV = 0x0 REFCNT = 1 IO = 0x0 FORM = 0x0 AV = 0xa8d714 HV = 0x0 CV = 0x0 CVGEN = 0x0 LINE = 1 FILE = "-e" FLAGS = 0x2a EGV = 0x99b994 "foo"

Something something ... looking at prev link ... something http://perl5.git.perl.org/perl.git?a=search&h=HEAD&st=grep&s=GvIMPORTED

http://search.cpan.org/dist/illguts/index.html#GvFLAGS

http://perl5.git.perl.org/perl.git?a=search&h=HEAD&st=grep&s=IMPORTED\S%2Bon&sr=1
http://perl5.git.perl.org/perl.git/blob?f=gv.h#l178
?imported subs http://perl5.git.perl.org/perl.git/blob?f=gv.c#l399
?imported scalar http://perl5.git.perl.org/perl.git/blob?f=pp_hot.c#l161
?imported glob scalar assignment http://perl5.git.perl.org/perl.git/blob?f=sv.c#l3758
?imported scalar ref http://perl5.git.perl.org/perl.git/blob?f=sv.c#l4234
!SCREAM http://perl5.git.perl.org/perl.git/blob?f=sv.h#l362

360 #define SVprv_PCS_IMPORTED SVp_SCREAM /* RV is a proxy for a con +stant 361 subroutine in another packa +ge. Set the 362 GvIMPORTED_CV_on() if it ne +eds to be 363 expanded to a real GV */

So, next move, somehow gitk/gitness , track IMPORTED\S+on changes ... maybe just grep each major release ..

When lacking understanding, I grep more :D


In reply to Re^3: Creating "Lexical" Symbol Table Aliases (a la "use vars") From The Same Package by Anonymous Monk
in thread Creating "Lexical" Symbol Table Aliases (a la "use vars") From The Same Package by OneTrueDabe

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2024-04-19 05:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found