Changeset 15 in bookmarks for trunk/bkmk
- Timestamp:
- 02/09/13 21:02:43 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bkmk
r14 r15 2 2 use strict; 3 3 4 use DBI;5 4 use YAML; 6 5 use Bookmarks; 6 use Getopt::Long; 7 7 8 my $dbname = 'new.db'; 8 GetOptions( 9 'file|f=s' => \my $DBNAME, 10 ); 9 11 10 my $dbh = DBI->connect("dbi:SQLite:dbname=$dbname", "", "", { RaiseError => 1, PrintError => 0 });12 die "Usage: $0 --file <dbname> <command>\n" unless $DBNAME; 11 13 12 14 my $bookmarks = Bookmarks->new({ 13 db h => $dbh,15 dbname => $DBNAME, 14 16 }); 15 17 … … 34 36 # TODO: coordinate this commandline script with the CGI app 35 37 print Dump(\@resources); 36 } 38 }, 39 load => sub { 40 my ($src_file) = @_; 41 my $src_bookmarks = YAML::LoadFile($src_file); 42 for my $bookmark (@{ $src_bookmarks }) { 43 $bookmarks->add($bookmark); 44 } 45 }, 37 46 ); 38 47
Note: See TracChangeset
for help on using the changeset viewer.