Skip Menu |

This queue is for tickets about the Devel-MAT CPAN distribution.

Report information
The Basics
Id: 100967
Status: resolved
Priority: 0/
Queue: Devel-MAT

People
Owner: Nobody in particular
Requestors: wolfsage [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 0.21



Subject: Feature Request: $pmat->find_symbol() for 'my' variables
Date: Wed, 17 Dec 2014 09:17:07 -0500
To: bug-Devel-MAT [...] rt.cpan.org
From: "Matthew Horsfall (alh)" <wolfsage [...] gmail.com>
Right now, find_symbol() will not return 'my' variables from packages. It would be wonderful if there was a method that *did* do this. Thanks, -- Matthew Horsfall (alh)
On Wed Dec 17 09:17:16 2014, wolfsage@gmail.com wrote: Show quoted text
> Right now, find_symbol() will not return 'my' variables from packages. > > It would be wonderful if there was a method that *did* do this.
In summary; that's not doable: lexical variables exist per scope (i.e. per PAD), not globally. You could iterate *all* of the PADs and find all of the lexicals of some given name, but common names like '$self' are likely to find hundreds if not thousands of hits. It's unclear from the request what's required here, but for example if you already know what function to be looking in, then you can just inspect PADs of the CODE directly by using the ->lexvars method. -- Paul Evans
A partial attempt at this has been added. CODE and PAD objects now have a $idx = $sv->padix_from_padname( $name ) method which looks up the pad index for a given lexical name. You can then inspect a pad at that index to find the value of that lexical at that depth. Will this suffice for your purpose? -- Paul Evans
From: wolfsage [...] gmail.com
On Thu Oct 29 14:53:00 2015, PEVANS wrote: Show quoted text
> A partial attempt at this has been added. CODE and PAD objects now > have a > > $idx = $sv->padix_from_padname( $name ) > > method which looks up the pad index for a given lexical name. You can > then inspect a pad at that index to find the value of that lexical at > that depth. > > Will this suffice for your purpose?
Yes, I think that will do. Thanks a ton! -- Matthew Horsfall (alh)
Released -- Paul Evans