Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^5: Traversing a complex data structure searching for certain keys and printing their values

by newperluser2013 (Novice)
on Apr 29, 2013 at 02:43 UTC ( #1031146=note: print w/replies, xml ) Need Help??


in reply to Re^4: Traversing a complex data structure searching for certain keys and printing their values
in thread Traversing a complex data structure searching for certain keys and printing their values

Just one other thing would you know what I would need to do to this sub routine so that I could get different output formats? For example I still need to pass in @keylist to the subroutine to make sure all the keys are there but I want to also parse in an output format string aswell. So for example if I wanted to print all the lines like this:

%export_name:%filer_device:%filer_volume

or print them with every value like this:

%export_name:%filer_device:%filer_volume:%mount_acl:%mount_group:%moun +t_user:%mount_opts

So I want to be able to pass in $output_format to this function. $output_format equates to one of the strings above. So I could the run funtion like this:

recurse_hash(\%$decoded_json_obj, {}, @keylist, $output_format);
  • Comment on Re^5: Traversing a complex data structure searching for certain keys and printing their values
  • Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1031146]
help
Chatterbox?
[1nickt]: marioroy Yes, I am using it with MCE, as is Discipulus I believe. I was trying to work out how to make a cpanfile that would be smart enough to know which deps to require.
[1nickt]: See this code. (I expected to simply eval loading threads as a check, but weirdness happened with Perlbrew so it's a grep of -V ...)
[choroba]: Config might be better than grepping -V
[Corion]: Also see Config::V, which is less of that hackery, or that hackery hidden in a module ;)
[1nickt]: The problem was with Perlbrew
[Corion]: Whoops - Config::Perl::V
[1nickt]: I found that when using Perlbrew as recommended, with cpanminus in the system perl lib, such tests were failing to detect the data about the perl that was the install destination.

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (11)
As of 2017-10-18 15:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My fridge is mostly full of:

















    Results (249 votes). Check out past polls.

    Notices?