--- trunk/lib/Frey/DelIcioUs.pm 2008/11/08 23:03:35 336 +++ trunk/lib/Frey/DelIcioUs.pm 2008/11/08 23:22:03 337 @@ -21,10 +21,10 @@ sub path { my $self = shift; - 'var/delicious/' . $self->username; + 'var/delicious/' . $self->username . '.yml'; } -sub data { +sub posts { my $self = shift; if ( my $posts = $self->load( $self->path ) ) { @@ -42,8 +42,36 @@ warn substr($content,0,100), ' ... ', substr($content,-100); my $posts = XMLin( $content ); warn dump( $posts ); - $self->store( $self->path . '.yml', $posts ); + $self->store( $self->path, $posts ); return $posts; } +sub data { + my $self = shift; +# $self->posts; + $self->sponge; +} + +sub sponge { + my $self = shift; + + my $posts = $self->posts->{post}; + die "not ARRAY ",dump( $posts ) unless ref($posts) eq 'ARRAY'; + + my @NAME = keys %{ $posts->[0] }; + my @rows; + + foreach my $post ( @$posts ) { + my @row; + push @row, $post->{ $_ } foreach @NAME; + push @rows, \@row; + } + + + return { + rows => \@rows, + NAME => \@NAME, + } +} + 1;