/[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 323 by dpavlin, Thu Nov 6 17:58:20 2008 UTC revision 425 by dpavlin, Tue Nov 18 23:24:53 2008 UTC
# Line 11  has 'username' => ( Line 11  has 'username' => (
11          is => 'rw',          is => 'rw',
12          isa => 'Str',          isa => 'Str',
13          required => 1,          required => 1,
14            documentation => 'login on del.icio.us',
15  );  );
16    
17  has 'password' => (  has 'password' => (
# Line 19  has 'password' => ( Line 20  has 'password' => (
20          required => 1,          required => 1,
21  );  );
22    
23  has 'path' => (  sub path {
24          is => 'ro',          my $self = shift;
25          isa => 'Str',          'var/delicious/' . $self->username . '.yml';
26          default => sub {  }
                 my $self = shift;  
                 'var/delicious/' . $self->username;  
         }  
 );  
27    
28  sub data {  sub posts {
29          my $self = shift;          my $self = shift;
30    
31          if ( my $posts = $self->load( $self->path ) ) {          if ( my $posts = $self->load( $self->path ) ) {
# Line 46  sub data { Line 43  sub data {
43          warn substr($content,0,100), ' ... ', substr($content,-100);          warn substr($content,0,100), ' ... ', substr($content,-100);
44          my $posts = XMLin( $content );          my $posts = XMLin( $content );
45          warn dump( $posts );          warn dump( $posts );
46          $self->store( $self->path . '.yml', $posts );          $self->store( $self->path, $posts );
47          return $posts;          return $posts;
48  }  }
49    
50    sub data {
51            my $self = shift;
52            $self->posts;
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.323  
changed lines
  Added in v.425

  ViewVC Help
Powered by ViewVC 1.1.26