NAME

Data::Walk::Print - A data printing function

SYNOPSIS

    #!perl
	use Modern::Perl;
	use YAML::Any;
	use Moose::Util qw( with_traits );
	use Data::Walk::Extracted v0.011;
	use Data::Walk::Print v0.009;

	$| = 1;

	#Use YAML to compress writing the data ref
	my  $firstref = Load(
		'---
		Someotherkey:
			value
		Parsing:
			HashRef:
				LOGGER:
					run: INFO
		Helping:
			- Somelevel
			- MyKey:
				MiddleKey:
					LowerKey1: lvalue1
					LowerKey2:
						BottomKey1: 12345
						BottomKey2:
						- bavalue1
						- bavalue2
						- bavalue3'
	);
	my  $secondref = Load(
		'---
		Someotherkey:
			value
		Helping:
			- Somelevel
			- MyKey:
				MiddleKey:
					LowerKey1: lvalue1
					LowerKey2:
						BottomKey2:
						- bavalue1
						- bavalue2
						BottomKey1: 12354'
	);
	my $AT_ST = with_traits( 
			'Data::Walk::Extracted', 
			( 'Data::Walk::Print' ),
		)->new(
			match_highlighting => 1,#This is the default
		);
	$AT_ST->print_data(
		print_ref	=>  $firstref,
		match_ref	=>  $secondref,
		sort_HASH	=> 1,#To force order for demo purposes
	);
    
    #####################################################################################
    #     Output of SYNOPSIS
    # 01:{#<--- Ref Type Match
    # 02:	Helping => [#<--- Secondary Key Match - Ref Type Match
    # 03:		'Somelevel',#<--- Secondary Position Exists - Secondary Value Matches
    # 04:		{#<--- Secondary Position Exists - Ref Type Match
    # 05:			MyKey => {#<--- Secondary Key Match - Ref Type Match
    # 06:				MiddleKey => {#<--- Secondary Key Match - Ref Type Match
    # 07:					LowerKey1 => 'lvalue1',#<--- Secondary Key Match - Secondary Value Matches
    # 08:					LowerKey2 => {#<--- Secondary Key Match - Ref Type Match
    # 09:						BottomKey1 => '12345',#<--- Secondary Key Match - Secondary Value Does NOT Match
    # 10:						BottomKey2 => [#<--- Secondary Key Match - Ref Type Match
    # 11:							'bavalue1',#<--- Secondary Position Exists - Secondary Value Matches
    # 12:							'bavalue2',#<--- Secondary Position Exists - Secondary Value Does NOT Match
    # 13:							'bavalue3',#<--- Secondary Position Does NOT Exist - Secondary Value Does NOT Match
    # 14:						],
    # 15:					},
    # 16:				},
    # 17:			},
    # 18:		},
    # 19:	],
    # 20:	Parsing => {#<--- Secondary Key Mismatch - Ref Type Mismatch
    # 21:		HashRef => {#<--- Secondary Key Mismatch - Ref Type Mismatch
    # 22:			LOGGER => {#<--- Secondary Key Mismatch - Ref Type Mismatch
    # 23:				run => 'INFO',#<--- Secondary Key Mismatch - Secondary Value Does NOT Match
    # 24:			},
    # 25:		},
    # 26:	},
    # 27:	Someotherkey => 'value',#<--- Secondary Key Match - Secondary Value Matches
    # 28:},
    #####################################################################################

 

DESCRIPTION

This Moose::Role is mostly written as a demonstration module for Data::Walk::Extracted. Both Data::Dumper - Dump and YAML - Dump functions are more mature than the printing function included here.

Caveat utilitor

Supported Node types

ARRAY
HASH
SCALAR

Supported one shot "Attributes"

match_highlighting

USE

This is a Moose::Role and can be used as such. One way to incorporate this role into Data::Walk::Extracted and then use it is the method 'with_traits' from Moose::Util. Otherwise see Moose::Manual::Roles.

Attributes

Data passed to ->new when creating an instance using a class. For modification of these attributes see "Methods". The ->new function will either accept fat comma lists or a complete hash ref that has the possible appenders as the top keys. Additionally some attributes that meet the necessary criteria can be passed to print_data and will be adjusted for just the run of that method call.

match_highlighting

Definition: this determines if a comments string is added after each printed row that indicates how the 'print_ref' matches the 'match_ref' (or not).
Default True (1)
Range This is a Boolean data type and generally accepts 1 or 0

Attributes in Data::Walk::Extracted

also affect the output.

Methods

Definition: this is the method used to print a data reference
Accepts: either a single data reference or One or two named arguments in a fat comma list or hashref
single variable option - if only one variable is sent and it fails the test for "exists $variable->{print_ref}" then the program will attempt to name it as print_ref => $variable
named variable options - if variables are named including one with 'print_ref' then the following two named variables are accepted
match_ref - this is a reference used to compare against the 'print_ref' - Optional
Returns: 1 (And prints out the data ref with matching assesment comments per "match_highlighting")

set_match_highlighting( $bool )

Definition: this is a way to change the match_highlighting attribute
Accepts: a Boolean value
Returns: ''

GLOBAL VARIABLES

$ENV{Smart_Comments}

The module uses Smart::Comments with the '-ENV' option so setting the variable $ENV{Smart_Comments} will turn on smart comment reporting. There are three levels of 'Smartness' called in this module '### #### #####'. See the Smart::Comments documentation for more information.

SUPPORT

Data-Walk-Extracted/issues

TODO

Support printing CodeRefs
Support printing Objects / Instances
Find better print parsing logic - Complex Dispatch Tables?

AUTHOR

Jed Lund
jandrew@cpan.org

COPYRIGHT

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

The full text of the license can be found in the LICENSE file included with this module.

Dependancies

Data::Walk::Extracted
version
Moose::Role
MooseX::Types::Moose
Smart::Comments - With the -ENV variable set

SEE ALSO

Data::Walk
Data::Walker
Data::Dumper - Dump
YAML - Dump

1 POD Error

The following errors were encountered while parsing the POD:

Around line 384:

L<> starts or ends with whitespace