This script runs a web-service thru the Open Library (OL) API, stores data send by the web-service into files and generate XHTML to display data in a very simple page. The microlibraryis made to manage everithing to generate a book-shelf pages, using your data from Open Library. For more informations an How To, please see http://goo.gl/k375R
This first implementation is a physical object (books) swaping/sharing system. Our Library project is to create an online index which could make (in next version) possible to :
retrieve informations about registered documents
know where documents are physically based and if you can loan it )
register an account & create your own Library DataBase
share it with other users.
Our desire is to provide a private Libraries Network in an IRL spirit, a Library of Libraries ("meta-libraries"), physically based (shelfs). We don't want to provide downloadable documents.
That's why our project is named "Self Shelf Swap". It's first implementation will be Bibliothek.
List are considered like thematic shelfes of your library. First the microlibrary kernel calls the Properties Reader, that will parse our open_library_lists file, and return an array if list ids. This array is passed as an argument to the build_the_list_request() subroutine of the Curl Requester, that will build and get the list requests. For each list id, we get a RDF flux containing books URI. Flux are stored into your hard drive by passing the RDF flux, the list id and the "list" flag (to specify that we manage lists) to the store_RDF_flux() of the RDF Tool.
Next, for each list, we load the file on disk thru the parse_RDF_file() subroutine, passing the list id as an argument. We get many data thru the get_list_element() subroutine of RDFTool, that will get all books data. For more information about this part, see the RDFTool documentation.
The Web Displayer is scattered everywhere and will be remplaced soon by a more decent system (AKA MVC). See you soon.
To deploy and install your microlibrary, you need a GNU/Linux environment or any Perl friendly system. Dime and a shoestring has been only tested on Debian or Ubuntu. Feel free to test it on other platforms and give us feedback...
Install every dependencies. You can follow the DEPENDENCIES section of this documentation and test it by running the microlibrary.pl script. To run this script, just open a terminal, go to the dime_and_a_shoestring. Fix the $ENV{HOME} environment variable that should target the 'cgi-bin' directory containing the microlibrary.pl script. Set the $reload_mode and the $log_mode flags to '1', let the $html_mode and $sad_deps_mode to '0'.
Now type into your terminal :
$ perl microlibrary.pl
The script should start and send querries to microlibrary. This can take some time. We wait to receive the response of every querry before to send another one. Once every querries have been send, a kind of database is stored into your hard drive in
/home/foo/bar/dime_and_a_shoestring/database/book/$ /list/$
Now turn the $reload_mode and the $log_mode flags to '0'. As your database is you don't even need to send request to Open Library. You will re-run the script with $reload_mode activated each time you add a list/shelf, a book, or update informations into OL. Set the $html_mode to '1'. Your microlibrary is ready, you just need to deploy it on your public server (don't forget to update the $ENV{HOME} variable).
We will use the Open Library database and list feature to constitute the shelfes of a very simple library : lists are thematic shelfes, and your set of lists under a OL account is a Microlibrary. Soon, we will provide more powerful features. You can turn of the interraction with the OL API by giving the value of 0 to the $reload_mode scalar. Data will be read from the files stores on your harddrive. Script with "$reload_mode = 1" must have been run at least once to generate files on your hard drive.
In development and debug environment you must most of the time use our "log mode" that will display useful informations when processing. Don't forget to turn it of ( $log_mode = 0) in production environment cause it will display logs into you web pages.
This is the mode for production environment. It will display your data into XHTML tags ( $html_mode = 1 ).
This is the Simple And Dirty dependencies logger ( $sad_deps_mode = 1 ), that will display all needed dependencies. Only works when dependencies are used (to confirm ?) Don't forget to turn it of ( $sad_deps_mode = 0 ) in production environment cause it will display logs into you web pages.
Microlinrary comes with : Data::CURL::CurlRequester - Data:Properties::PropertiesReader - Data::RDF::RDFTool Tools::EnvViewer - View::WebDisplayer
We use these CPAN modules : Data::Dumper - Encode::Encoder - File::Basename - IO::File - Module::ScanDeps - Net::Curl::Simple - Properties - XML::Simple
This will at least need these following CPAN modules to work : local::lib - Log::Simplest - Merror - RDF::Redland - Test::Simple
The Microlibrary Kernel has been an exercice for learning perl and is not recommended for re-use.
Some hard coded things and configuration stuff should be into properties files. See # See https://bugs.launchpad.net/bibliothek-project/+bug/856571
The Microlibrary is not cross-platform and has been tested ONLY on Debian-like GNU/Linux systems. At this day, we didn't try to deploy it on MS Windows, but feel free to help us if you want !
This is the most S.A.D. thing about the microlibrary... View is scattered everywhere, there is nothing to do than do re-do it correctly !!!
This section could be ported to a meta.yaml file
Self Shelf Swap - Simon Foutaiz - 2011-05-24
my ( $firstname = "seb", $lastname = "feugere", $provider = "gmail"); print $firstname . "." . $lastname . "@" . $provider . "." .com;
This is version 0.01, well known as a Dime And A Shoestring
Copyright 2011 Self Shelf Swap.
This library is free software. You can redistribute it and/or modify it under the same terms as Perl himself.