Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^2: Inspecting the name of a variable

by LanX (Canon)
on Sep 01, 2012 at 20:18 UTC ( #991193=note: print w/ replies, xml ) Need Help??


in reply to Re: Inspecting the name of a variable
in thread Inspecting the name of a variable

Well ... RTFM doesn't explain anything. =)

localized variables are propagated into any called subs.

apparently PadWalker is missing a pad to investigate or should extend it's documentation.

UPDATE: ... well only if aliases have a pad...

UPDATE: yes it's because of the aliasing:

our $orig=666; for our $x (42,$orig) { say $bar,our_name($bar); say $x,our_name($x); }

10$bar 42 10$bar 666$orig

Cheers Rolf


Comment on Re^2: Inspecting the name of a variable
Select or Download Code
Re^3: Inspecting the name of a variable
by remiah (Hermit) on Sep 02, 2012 at 14:46 UTC

    Hello

    I found Data::Dumper::Names with this thread . In this manual of Data::Dumper::Names, there is "Unknown Variables" section.

    "Unknown Variables" section seems to me having some relation with your case... not printing name "$x".

    update:
    Sorry if I am looking into wrong direction.
      Thats where I started, but if you look into Ovid's code you will see that he's only inspecting lexical variables.

      Cheers Rolf

        I saw it. It used the same module, PadWalker.

        With -d debug, when I type V at for loop, I see "$x = 42" in the list. It seems there is some way for printing variable names...

        I know nothing for perlguts,and don't understand what is Alias here ...
        Hope you get some hints from superior monks.

        regrads.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://991193]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (8)
As of 2014-07-29 07:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (211 votes), past polls