From 63ea2492d1b7676d5aae7c9dd7912ca78159c321 Mon Sep 17 00:00:00 2001 From: dakkar Date: Sat, 26 Mar 2011 13:44:35 +0000 Subject: many more BrowserObjects --- lib/DeWeave/Collection.pm | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'lib/DeWeave/Collection.pm') diff --git a/lib/DeWeave/Collection.pm b/lib/DeWeave/Collection.pm index 92c5342..6ad87eb 100644 --- a/lib/DeWeave/Collection.pm +++ b/lib/DeWeave/Collection.pm @@ -3,8 +3,11 @@ use Moose; use namespace::autoclean; use MooseX::Types::Moose qw(ArrayRef); use JSON::Any; +use Try::Tiny; use DeWeave::EDO; use Lingua::EN::Inflect::Number 'to_S'; +use Log::Log4perl ':easy'; +use Data::Dump 'pp'; has items => ( isa => ArrayRef['DeWeave::WBO'], @@ -38,9 +41,22 @@ sub from_json { my $args = $j->decode($json); - my @items = map { - $class->item_class->new({%$_,__crypt=>$crypt}) - } @$args; +DEBUG '$args ',{filter=>\&pp,value=>$args}; + + my @items; + + for my $input_item (@$args) { + my $item; + try { + $item = $class->item_class->new({%$input_item,__crypt=>$crypt}) + } + catch { + die $_ unless ref($_) && $_->isa('DeWeave::Exception::Deleted'); + }; + push @items,$item + if $item; + } + return $class->new({ items => \@items, }); -- cgit v1.2.3