show variable name as __VAR__#74
Open
hakonhagland wants to merge 15 commits into
Open
Conversation
Contributor
Author
|
Added PPI support and some tests.. |
|
Nice one! I've been wanting this same thing for a while now. |
Contributor
Author
|
I am not sure why the tests failed here.. the tests passes on my machine using perl v5.20 on Ubuntu 14.10. |
…r earlier perl versions
Owner
|
@hakonhagland @jayallen YES! That's a very nice feature indeed. Sorry for not reviewing this before, I'll definitely look into reviewing and merging this right after the holidays. Thanks! |
hakonhagland
added a commit
to hakonhagland/Data-Printer
that referenced
this pull request
Jul 17, 2020
Pull request garu#74 'show variable name as __VAR__' had a dependency on the PPI module which made its inclusion in the master less atractive for the users not using the feature. By refactoring the part of the code that depended on PPI out in a separate module, only the users that would like to use the feature needs to install PPI. The code remaining in master (that does not depend on PPI) now implements a plugin hook in the write_label() sub in Data::Printer::Object. An option in the configuration file called 'caller_plugin' is used to register a caller plugin. If such a plugin is registered, write_label() will load the plugin and then call the plugin to do the generation of the label string. The refactored part of garu#74 that depends on PPI has been included in the module Data::Printer::Plugin::Caller::PPI (currently on Github).
hakonhagland
added a commit
to hakonhagland/Data-Printer
that referenced
this pull request
Mar 9, 2021
Pull request garu#74 'show variable name as __VAR__' had a dependency on the PPI module which made its inclusion in the master less atractive for the users not using the feature. By refactoring the part of the code that depended on PPI out in a separate module, only the users that would like to use the feature needs to install PPI. The code remaining in master (that does not depend on PPI) now implements a plugin hook in the write_label() sub in Data::Printer::Object. An option in the configuration file called 'caller_plugin' is used to register a caller plugin. If such a plugin is registered, write_label() will load the plugin and then call the plugin to do the generation of the label string. The refactored part of garu#74 that depends on PPI has been included in the module Data::Printer::Plugin::Caller::PPI (currently on Github).
|
How about using PadWalker? Data::Dumper::Names and Data::Dump::Streamer both do this, though they are both really old. |
Contributor
Author
@grr Yes I have considered those also, see https://github.com/hakonhagland/Data-Printer-Plugin-Caller-PPI/blob/b8d9eb2ec5ad2c5a9d6addc5a2f7cf91365b1f4d/lib/Data/Printer/Plugin/Caller/PPI/Parser.pm#L21 |
hakonhagland
added a commit
to hakonhagland/Data-Printer
that referenced
this pull request
Jan 2, 2023
Pull request garu#74 'show variable name as __VAR__' had a dependency on the PPI module which made its inclusion in the master less atractive for the users not using the feature. By refactoring the part of the code that depended on PPI out in a separate module, only the users that would like to use the feature needs to install PPI. The code remaining in master (that does not depend on PPI) now implements a plugin hook in the write_label() sub in Data::Printer::Object. An option in the configuration file called 'caller_plugin' is used to register a caller plugin. If such a plugin is registered, write_label() will load the plugin and then call the plugin to do the generation of the label string. The refactored part of garu#74 that depends on PPI has been included in the module Data::Printer::Plugin::Caller::PPI (currently on Github).
hakonhagland
added a commit
to hakonhagland/Data-Printer
that referenced
this pull request
Jan 14, 2023
Pull request garu#74 'show variable name as __VAR__' had a dependency on the PPI module which made its inclusion in the master less atractive for the users not using the feature. By refactoring the part of the code that depended on PPI out in a separate module, only the users that would like to use the feature needs to install PPI. The code remaining in master (that does not depend on PPI) now implements a plugin hook in the write_label() sub in Data::Printer::Object. An option in the configuration file called 'caller_plugin' is used to register a caller plugin. If such a plugin is registered, write_label() will load the plugin and then call the plugin to do the generation of the label string. The refactored part of garu#74 that depends on PPI has been included in the module Data::Printer::Plugin::Caller::PPI (currently on Github).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi guys!
Background: It could be useful to have the original variable name included in the output from the
pcommand.When I debug a program I often have many
pstatements following each other.In order to easily see which output belongs to which variable, it would be nice if I could type:
with output:
$var = 2. I would like to avoid repeating myself like:To me, this seems to be a difficult problem, that would involve parsing Perl code and probably should be done using the
PPImodule for parsing. However, my first strategy for building a solution to this was to get started somehow :-) something is better than nothing.So this pull request is indeed a very crude first attempt, and I hope it will be accepted so it could be gradually improved with time :-)