in reply to Re: get name of lexical variable
in thread get name of lexical variable

One could write a nice subroutine useful in debugging, whic when called in the following way:

my $aLex=25; print(display($aLex),"\n");
would print
$aLex == 25

-- 
Ronald Fischer <ynnor@mm.st>

Replies are listed 'Best First'.
Re^3: get name of lexical variable
by ambrus (Abbot) on Jul 13, 2009 at 11:35 UTC

      I'm not so happy with either one. Data::Dumper::Simple uses a source filter, and source filtering has already bitten me more than once. Data::Dumper::Names uses undocumented features in Perl which doesn't make it trustworthy either...

      -- 
      Ronald Fischer <ynnor@mm.st>
Re^3: get name of lexical variable
by mzedeler (Pilgrim) on Jul 13, 2009 at 18:44 UTC

    I agree that there are uses for a subroutine that can return such names as requested, but usually when people ask for something like this, its a sign of a more mundane problem solved in the wrong way.

      Encapsulation rules? Which ones did s/he break? Looks like a solid debug example to me.

        hkwilliamson hasn't revealed what (s)he is going to use this introspection sub for. The debugging example was written by ysth.