| 1 | = Bookmarks Wishlist = |
| 2 | |
| 3 | - import/export of bookmark data |
| 4 | - tool to scan database for broken URLs |
| 5 | - machine tags |
| 6 | - could this be useful: http://stackoverflow.com/questions/418898/sqlite-upsert-not-insert-or-replace |
| 7 | - suite of tools to init, start, and stop an instance |
| 8 | - better name |
| 9 | |
| 10 | Tool suite example to create an instance of the application in the directory "foo": |
| 11 | {{{ |
| 12 | $ mkdir foo |
| 13 | $ cd foo |
| 14 | $ bkmk init |
| 15 | # writes a basic conf.yml, creates a bookmarks.db SQLite database using bookmarks.sql |
| 16 | # could prompt for settings or take them on the command line |
| 17 | $ bkmk start |
| 18 | # starts up the server using starman, by default on port 5000 |
| 19 | $ bkmk stop |
| 20 | # stops the running server |
| 21 | }}} |
| 22 | Deleting bookmarks |
| 23 | {{{ |
| 24 | sub delete { |
| 25 | my $self = shift; |
| 26 | my $bookmark = shift; |
| 27 | |
| 28 | my $sth_insert = $self->dbh->prepare('insert into deleted_bookmarks (id, dtime) values (?, ?)'); |
| 29 | $sth_insert->execute($bookmark->id, time); |
| 30 | my $sth_delete = $self->dbh->prepare('delete from bookmarks where id = ?'); |
| 31 | $sth_delete->execute($bookmark->id); |
| 32 | } |
| 33 | }}} |
| 34 | Paging of results (will require counting bookmark total) |
| 35 | {{{ |
| 36 | sub get_count { |
| 37 | my $self = shift; |
| 38 | my $search = shift; |
| 39 | |
| 40 | my ($sql, @bind) = sql_interp( |
| 41 | 'select count(*) from resources join bookmarks on resources.uri = bookmarks.uri', |
| 42 | $self->_sql_where_clause($search), |
| 43 | ); |
| 44 | my $sth = $self->dbh->prepare($sql); |
| 45 | $sth->execute(@bind); |
| 46 | my ($count) = $sth->fetchrow_array; |
| 47 | return $count; |
| 48 | } |