Biblio::Zotero::DB - helper module to access the Zotero SQLite database
version 0.004
my $db = Biblio::Zotero::DB->new( profile_name => 'abc123.default' ); $db->schema->resultset('Item')->all;
A DBIx::Class schema that is connected to the zotero.sqlite file.
zotero.sqlite
This can be cleared using clear_schema.
clear_schema
A string that contains the filename of the zotero.sqlite file. The default is located in the directory of "profile_directory" attribute.
"profile_directory"
A string that contains the directory where the Zotero attachments are located. The default is the storage subdirectory of the "profile_directory" directory.
storage
A string that contains the directory where the zotero.sqlite database is located,
$db->profile_directory( "$ENV{HOME}/.zotero/zotero/abc123.default/zotero/" );
A string containing the profile name to use. Setting this will set the "profile_directory" attribute.
$db->profile_name( 'abc123.default' ); # corresponds to a profile directory such as # <~/.zotero/zotero/abc123.default/zotero/>
Returns an arrayref of the possible profile directories that contain a Zotero SQLite database. This can be used as a class method.
see: http://www.zotero.org/support/zotero_data
Biblio::Zotero::DB->find_profile_directories() # returns: # [ # "$ENV{HOME}/.zotero/zotero/abc123.default/zotero", # "$ENV{HOME}/.zotero/zotero/def567.default/zotero" # ]
use Biblio::Zotero::DB; use List::UtilsBy qw(min_by); # find the most recently modified my $newest = min_by { -M } @{Biblio::Zotero::DB->find_profile_directories}; my $db = Biblio::Zotero::DB->new( profile_directory => $newest ); # if there is an issue with the database lock here, # see L<Biblio::Zotero::DB::Role::CopyDB> $db->schema->resultset('Item')->all;
Biblio::Zotero::DB::Role::CopyDB
Zakariyya Mughal <zmughal@cpan.org>
This software is copyright (c) 2013 by Zakariyya Mughal.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Biblio::Zotero::DB, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Biblio::Zotero::DB
CPAN shell
perl -MCPAN -e shell install Biblio::Zotero::DB
For more information on module installation, please visit the detailed CPAN module installation guide.