summaryrefslogtreecommitdiff
path: root/lib/DeWeave/WBO.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/DeWeave/WBO.pm')
-rw-r--r--lib/DeWeave/WBO.pm21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/DeWeave/WBO.pm b/lib/DeWeave/WBO.pm
index 56bc3e1..d38120f 100644
--- a/lib/DeWeave/WBO.pm
+++ b/lib/DeWeave/WBO.pm
@@ -4,6 +4,7 @@ use namespace::autoclean;
use MooseX::Types::Moose qw(Int Str Num);
use JSON::Any;
use Try::Tiny;
+use Log::Log4perl ':easy';
use Data::Dump 'pp';
has id => (
@@ -37,6 +38,20 @@ has ttl => (
is => 'ro',
);
+sub _debug_data {
+ my ($self,$msg,$data) = @_;
+
+ local $Log::Log4perl::caller_depth = $Log::Log4perl::caller_depth+1;
+
+ my %data_clean;my @keys_clean = grep {!/^_/} keys %$data;
+ @data_clean{@keys_clean} = @$data{@keys_clean};
+
+ DEBUG $msg, {
+ filter => \&pp,
+ value => \%data_clean,
+ };
+}
+
sub from_json {
my ($class,$json,$crypt)=@_;
@@ -44,6 +59,8 @@ sub from_json {
my $args = $j->decode($json);
+ $class->_debug_data('$args ',$args);
+
if (defined $args->{payload}) {
$args->{__crypt}=$crypt;
}
@@ -65,6 +82,10 @@ around BUILDARGS => sub {
@$args{keys %$extra_args} =
values %$extra_args;
+ delete @$args{grep {!defined $args->{$_}} keys %$args};
+
+ $class->_debug_data('buildargs: ',$args);
+
return $args;
};