my $variables

Discussion in 'Perl Misc' started by George Mpouras, May 31, 2012.

  1. is there any way to catch the "my" variable names like the "our" variables ?

    my $var_001 = 'hello';
    our $var_002 = 'world';
    foreach (grep /var/, keys %{__PACKAGE__.::}) {print "$_
    ",${__PACKAGE__.::}{$_},"\n"}
     
    George Mpouras, May 31, 2012
    #1
    1. Advertising

  2. "George Mpouras" <> writes:

    > is there any way to catch the "my" variable names like the "our" variables ?


    Yes, with the peek_my function from PadWalker.

    PadWalker has some interesting use cases, but if you need it in you
    daily development then you are either hacking perl internals or doing
    something wrong.

    //Makholm
     
    Peter Makholm, May 31, 2012
    #2
    1. Advertising

  3. PadWalker does not help, you have to know the variable name. I want all the
    my ... to decide what to do after I know their names. There is product that
    inside their C code they have warp Perl
     
    George Mpouras, May 31, 2012
    #3
  4. "George Mpouras" <> writes:

    > PadWalker does not help, you have to know the variable name. I want all the
    > my ... to decide what to do after I know their names.


    I have no idea what you are looking for if it isn't just

    keys %{ my_peek(0) };

    //Makholm
     
    Peter Makholm, May 31, 2012
    #4
    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. avnrao
    Replies:
    0
    Views:
    3,392
    avnrao
    May 7, 2004
  2. Replies:
    1
    Views:
    958
  3. dwok
    Replies:
    7
    Views:
    720
    Hal Rosser
    Mar 4, 2005
  4. Replies:
    10
    Views:
    35,998
    jporter892
    Jun 6, 2011
  5. Replies:
    9
    Views:
    995
Loading...

Share This Page