Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > my $variables

Reply
Thread Tools

my $variables

 
 
George Mpouras
Guest
Posts: n/a
 
      05-31-2012
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"}


 
Reply With Quote
 
 
 
 
Peter Makholm
Guest
Posts: n/a
 
      05-31-2012
"George Mpouras" <(E-Mail Removed)> 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

 
Reply With Quote
 
 
 
 
George Mpouras
Guest
Posts: n/a
 
      05-31-2012
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


 
Reply With Quote
 
Peter Makholm
Guest
Posts: n/a
 
      05-31-2012
"George Mpouras" <(E-Mail Removed)> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments