1 |
package Data::DelIcioUs; |
package Frey::DelIcioUs; |
2 |
use Moose; |
use Moose; |
3 |
|
|
|
with 'Frey::Config'; |
|
4 |
with 'Frey::Storage'; |
with 'Frey::Storage'; |
5 |
|
|
6 |
|
use LWP::UserAgent; |
7 |
|
use XML::Simple; |
8 |
|
use Data::Dump qw/dump/; |
9 |
|
|
10 |
has 'username' => ( |
has 'username' => ( |
11 |
is => 'rw', |
is => 'rw', |
12 |
isa => 'Str', |
isa => 'Str', |
13 |
required => 1, |
required => 1, |
|
default => sub { |
|
|
my $self = shift; |
|
|
$self->config->{username}; |
|
|
}, |
|
14 |
); |
); |
15 |
|
|
16 |
has 'password' => ( |
has 'password' => ( |
|
is => 'rw', |
|
|
isa => 'Str', |
|
|
required => 1, |
|
|
default => sub { |
|
|
my $self = shift; |
|
|
$self->config->{password}; |
|
|
}, |
|
|
); |
|
|
|
|
|
has 'path' => ( |
|
17 |
is => 'ro', |
is => 'ro', |
18 |
isa => 'Str', |
isa => 'Str', |
19 |
default => sub { |
required => 1, |
|
my $self = shift; |
|
|
'var/delicious/' . $self->username; |
|
|
} |
|
20 |
); |
); |
21 |
|
|
22 |
use LWP::UserAgent; |
sub path { |
23 |
use XML::Simple; |
my $self = shift; |
24 |
use Data::Dump qw/dump/; |
'var/delicious/' . $self->username; |
25 |
|
} |
26 |
|
|
27 |
sub data { |
sub data { |
28 |
my $self = shift; |
my $self = shift; |
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, $posts ); |
$self->store( $self->path . '.yml', $posts ); |
46 |
return $posts; |
return $posts; |
47 |
} |
} |
48 |
|
|