Changeset 88 in bookmarks
- Timestamp:
- 06/04/15 22:00:25 (9 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bkmk
r87 r88 46 46 list => sub { 47 47 my @tags = @_; 48 my $resources = $bookmarks-> get_bookmarks({48 my $resources = $bookmarks->search({ 49 49 tags => \@tags 50 50 }); … … 77 77 dump => sub { 78 78 my ($dump_file) = @_; 79 my $dump = [ map { $_->TO_JSON } @{ $bookmarks-> get_bookmarks->results } ];79 my $dump = [ map { $_->TO_JSON } @{ $bookmarks->search->results } ]; 80 80 $dump_file ? YAML::DumpFile($dump_file, $dump) : print Dump($dump); 81 81 }, -
trunk/lib/Bookmarks.pm
r84 r88 7 7 8 8 use Bookmark; 9 use Bookmarks::List;10 9 use Bookmarks::Search; 11 10 … … 100 99 } 101 100 102 sub get_bookmarks{101 sub search { 103 102 my $self = shift; 104 103 my $params = shift || {}; … … 130 129 }); 131 130 } 132 return Bookmarks::List->new({ 133 bookmarks => $self, 134 search => $search, 135 results => \@resources, 136 }); 131 $search->results(\@resources); 132 133 return $search; 137 134 } 138 135 -
trunk/lib/Bookmarks/Controller.pm
r75 r88 7 7 use JSON; 8 8 use Bookmarks; 9 use Bookmarks::List; 9 10 use URI; 10 11 use Template; … … 83 84 my $offset = $self->request->param('offset'); 84 85 85 my $list = $self->bookmarks->get_bookmarks({ 86 query => $query, 87 tags => \@tags, 88 limit => $limit, 89 offset => $offset, 86 my $list = Bookmarks::List->new({ 87 bookmarks => $self->bookmarks, 88 search => $self->bookmarks->search({ 89 query => $query, 90 tags => \@tags, 91 limit => $limit, 92 offset => $offset, 93 }), 90 94 }); 91 95 … … 104 108 105 109 # construct a feed from the most recent 12 bookmarks 106 my $list = $self->bookmarks->get_bookmarks({ query => $query, tags => \@tags, limit => 12 }); 110 my $list = Bookmarks::List->new({ 111 bookmarks => $self->bookmarks, 112 search => $self->bookmarks->search({ query => $query, tags => \@tags, limit => 12 }), 113 }); 107 114 return $list->as_atom; 108 115 } -
trunk/lib/Bookmarks/List.pm
r71 r88 13 13 is => 'ro', 14 14 isa => 'Bookmarks::Search', 15 handles => [qw{query tags limit offset }],15 handles => [qw{query tags limit offset results}], 16 16 ); 17 has results => ( is => 'ro' );18 17 has title => ( 19 18 is => 'ro', -
trunk/lib/Bookmarks/Search.pm
r71 r88 11 11 has offset => (is => 'ro'); 12 12 13 has results => (is => 'rw', default => sub { [] }); 14 13 15 # module return 14 16 1; -
trunk/scan
r72 r88 25 25 my $csv = Text::CSV->new; 26 26 27 for my $bookmark (@{ $bookmarks-> get_bookmarks->results }) {27 for my $bookmark (@{ $bookmarks->search->results }) { 28 28 printf "%3d %s\n", $bookmark->id, $bookmark->uri unless $CSV; 29 29 my $response = $ua->head($bookmark->uri);
Note: See TracChangeset
for help on using the changeset viewer.