Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: How to get variable name in trace message

by tinita (Parson)
on Jun 15, 2012 at 09:09 UTC ( #976396=note: print w/ replies, xml ) Need Help??


in reply to How to get variable name in trace message

just as an addition: I've been using a vim mapping for a very long time now.
imap DUMPER <ESC>^iwarn __PACKAGE__.':'.__LINE__.$".Data::Dumper->Dump([\<ESC>llyw$a], ['<ESC>pa']);<ESC>

type $varnameDUMPER or %varnameDUMPER or @varnameDUMPER. result:
warn __PACKAGE__.':'.__LINE__.$".Data::Dumper->Dump([\$varname], ['varname']);

ok, the resulting perl code doesn't look nice, but I render it grey with this code:

2match comments /^ *warn __PACKAGE__.*/ highlight comments ctermfg=darkgrey


Comment on Re: How to get variable name in trace message
Select or Download Code
Re^2: How to get variable name in trace message
by ChrisBeall (Novice) on Jun 18, 2012 at 03:06 UTC
    Very nifty! I love Vim, so I'll give this a go too. Thanks.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (8)
As of 2015-07-03 21:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (56 votes), past polls