= Bookmarks = This project is my personal replacement for del.icio.us. It has also been a very good way for me to learn about [perldoc:PSGI] and [perldoc:Plack], and some of the more modern ways of writing Perl web applications. == Source Code == - [source:bookmarks Source code browser] - [http://svn.echodin.net/bookmarks/ SVN repository] == Database Design == The database consists of three tables: `bookmarks`, `resources`, and `tags`. I separated `resources` (which hold the URI and title of the targets of the bookmarks) from `bookmarks` (which have an ID, a creation timestamp, and a last-modified timestamp) as a matter of conceptual purity. Since the `tags` table references `resources`, it is clear from the database structure that the tag (like the title) is a property of the ''resource'', not the bookmark. == Classes == {{{#!plantuml @startuml class Bookmark <> { +id +uri +title +ctime +mtime +tags +bookmark_uri +exists +collection: Bookmarks +TO_JSON() +update() } class Bookmarks { +dbh +base_uri +create_tables() +get_bookmark({ id : int }): Bookmark +get_bookmark({ uri : string }): Bookmark +search(params : hashref) : Bookmarks::Search +get_tags({ uri : string }) : array +get_tags() : array +get_cotags({ search : Bookmarks::Search }) : array +get_last_modified_time() : int +add(bookmark : hashref) : Bookmark +update(bookmark : Bookmark) : Bookmark } class Bookmarks::List <> { +bookmarks: Bookmarks +search: Bookmarks::Search +title } class Bookmarks::Search <> { +query +tags +limit +offset +results } class Bookmarks::Controller { +dbname +bookmarks : Bookmarks +base_uri : URI +request : Plack::Request +find_or_new() +list() +feed() +view(id : int) +view_field(id : int, field : string) +create_and_redirect() +update_and_redirect(id : int) } class BookmarksApp { } Bookmarks <- Bookmarks::List : bookmarks Bookmarks::List --> Bookmarks::Search : search Bookmark - Bookmarks : collection > Bookmarks::Controller ..> Bookmarks::List Bookmarks::Controller --> Bookmarks : bookmarks BookmarksApp .> Bookmarks::Controller @enduml }}} == CPAN Modules == The application currently depends on the following CPAN modules: * [perldoc:YAML] * [perldoc:Plack::Builder] * [perldoc:Plack::Request] * [perldoc:Router::Resource] * [perldoc:Moose] * [perldoc:HTTP::Date] * [perldoc:SQL::Interp] * [perldoc:URI] * [perldoc:Encode] * [perldoc:JSON] * [perldoc:Template] == Reports == Bash code snippet that will display a count of bookmark resources by URI host: {{{#!bash sqlite3 bookmarks.db 'select uri from resources' \ | perl -mURI -mYAML -ne'$uri = URI->new($_); $h = $uri->authority; $servers{$h}++; BEGIN { my %servers }; END { print YAML::Dump(\%servers) }' }}} == See Also == * [./Installation] * [./RestAPI] * [./Wishlist]