- Timestamp:
- 04/11/14 11:03:53 (11 years ago)
- Location:
- trunk/lib
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Bookmark.pm
r70 r75 17 17 has bookmark_uri => ( is => 'rw' ); 18 18 has exists => ( is => 'ro' ); 19 has collection => ( is => 'ro' ); 19 20 20 21 sub created { scalar localtime $_[0]->ctime } … … 44 45 } 45 46 47 sub update { 48 my $self = shift; 49 die "Not part of a collection; nowhere to write this bookmark" unless $self->collection; 50 return $self->collection->update($self); 51 } 52 46 53 # module return 47 54 1; -
trunk/lib/Bookmarks.pm
r72 r75 67 67 return Bookmark->new({ 68 68 %$bookmark, 69 exists => 1, 70 tags => [ $self->get_tags({ uri => $bookmark->{uri} }) ], 71 base_uri => $self->base_uri, 69 exists => 1, 70 tags => [ $self->get_tags({ uri => $bookmark->{uri} }) ], 71 base_uri => $self->base_uri, 72 collection => $self, 72 73 }); 73 74 } … … 110 111 push @resources, Bookmark->new({ 111 112 %$resource, 112 tags => [ $self->get_tags({ uri => $resource->{uri} }) ], 113 base_uri => $self->base_uri, 113 exists => 1, 114 tags => [ $self->get_tags({ uri => $resource->{uri} }) ], 115 base_uri => $self->base_uri, 116 collection => $self, 114 117 }); 115 118 } … … 184 187 my $bookmark = shift; 185 188 189 #TODO: accept a pre-made Bookmark object in addition to a hash 186 190 my $uri = $bookmark->{uri}; 187 191 my $title = $bookmark->{title}; -
trunk/lib/Bookmarks/Controller.pm
r74 r75 203 203 204 204 # write to the database 205 $ self->bookmarks->update($bookmark);205 $bookmark->update; 206 206 207 207 #TODO: not RESTful; proper response would be a 200
Note: See TracChangeset
for help on using the changeset viewer.