/[Frey]/trunk/lib/Frey/DelIcioUs.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/lib/Frey/DelIcioUs.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 336 by dpavlin, Sat Nov 8 16:59:08 2008 UTC revision 337 by dpavlin, Sat Nov 8 23:22:03 2008 UTC
# Line 21  has 'password' => ( Line 21  has 'password' => (
21    
22  sub path {  sub path {
23          my $self = shift;          my $self = shift;
24          'var/delicious/' . $self->username;          'var/delicious/' . $self->username . '.yml';
25  }  }
26    
27  sub data {  sub posts {
28          my $self = shift;          my $self = shift;
29    
30          if ( my $posts = $self->load( $self->path ) ) {          if ( my $posts = $self->load( $self->path ) ) {
# Line 42  sub data { Line 42  sub data {
42          warn substr($content,0,100), ' ... ', substr($content,-100);          warn substr($content,0,100), ' ... ', substr($content,-100);
43          my $posts = XMLin( $content );          my $posts = XMLin( $content );
44          warn dump( $posts );          warn dump( $posts );
45          $self->store( $self->path . '.yml', $posts );          $self->store( $self->path, $posts );
46          return $posts;          return $posts;
47  }  }
48    
49    sub data {
50            my $self = shift;
51    #       $self->posts;
52            $self->sponge;
53    }
54    
55    sub sponge {
56            my $self = shift;
57    
58            my $posts = $self->posts->{post};
59            die "not ARRAY ",dump( $posts ) unless ref($posts) eq 'ARRAY';
60    
61            my @NAME = keys %{ $posts->[0] };
62            my @rows;
63    
64            foreach my $post ( @$posts ) {
65                    my @row;
66                    push @row, $post->{ $_ } foreach @NAME;
67                    push @rows, \@row;
68            }
69    
70    
71            return {
72                    rows => \@rows,
73                    NAME => \@NAME,
74            }
75    }
76    
77  1;  1;

Legend:
Removed from v.336  
changed lines
  Added in v.337

  ViewVC Help
Powered by ViewVC 1.1.26