From e1872c5028937753e0ecbebcded8a312d5eb7ce4 Mon Sep 17 00:00:00 2001 From: dakkar Date: Fri, 25 Mar 2011 23:54:14 +0000 Subject: very broken, can't decrypt --- lib/DeWeave/Collection.pm | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 lib/DeWeave/Collection.pm (limited to 'lib/DeWeave/Collection.pm') diff --git a/lib/DeWeave/Collection.pm b/lib/DeWeave/Collection.pm new file mode 100644 index 0000000..803a8cc --- /dev/null +++ b/lib/DeWeave/Collection.pm @@ -0,0 +1,30 @@ +package DeWeave::Collection; +use Moose; +use namespace::autoclean; +use MooseX::Types::Moose qw(ArrayRef Int Str Num); +use JSON::Any; +use DeWeave::EDO; + +has items => ( + isa => ArrayRef['DeWeave::WBO'], + is => 'ro', + required => 1, +); + +sub from_json { + my ($class,$json,$crypt)=@_; + + my $j = JSON::Any->new; + + my $args = $j->decode($json); + use Data::Dump 'pp';warn pp $args; + + my @items = map { + DeWeave::EDO->new({%$_,__crypt=>$crypt}) + } @$args; + return $class->new({ + items => \@items, + }); +} + +1; -- cgit v1.2.3