summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordakkar <dakkar@luxion>2005-10-19 18:49:40 +0000
committerdakkar <dakkar@luxion>2005-10-19 18:49:40 +0000
commit3852abfb5c39807cc238e46bf7247e1afcd4cca9 (patch)
tree40430160276afa01ecffdd156c578e241ae0da63
parenttemplate iniziale (diff)
downloadBookmarks-3852abfb5c39807cc238e46bf7247e1afcd4cca9.tar.gz
Bookmarks-3852abfb5c39807cc238e46bf7247e1afcd4cca9.tar.bz2
Bookmarks-3852abfb5c39807cc238e46bf7247e1afcd4cca9.zip
fatto il db
-rw-r--r--lib/Bookmarks.pm2
-rw-r--r--lib/Bookmarks/C/Main.pm45
-rw-r--r--lib/Bookmarks/M/DB.pm42
-rw-r--r--lib/Bookmarks/M/DB/Links.pm29
-rw-r--r--lib/Bookmarks/M/DB/LinksTags.pm29
-rw-r--r--lib/Bookmarks/M/DB/Tags.pm29
-rw-r--r--lib/Bookmarks/V/TT.pm29
-rw-r--r--script/bookmarks_makedb.pl44
-rw-r--r--t/C/Main.t7
-rw-r--r--t/M/db_links.t3
-rw-r--r--t/M/db_linkstags.t3
-rw-r--r--t/M/db_sqlitesequence.t3
-rw-r--r--t/M/db_tags.t3
-rw-r--r--t/V/TT.t4
14 files changed, 271 insertions, 1 deletions
diff --git a/lib/Bookmarks.pm b/lib/Bookmarks.pm
index 4603e5e..f81ec80 100644
--- a/lib/Bookmarks.pm
+++ b/lib/Bookmarks.pm
@@ -1,7 +1,7 @@
package Bookmarks;
use strict;
-use Catalyst qw/-Debug/;
+use Catalyst qw/-Debug Prototype/;
our $VERSION = '0.01';
diff --git a/lib/Bookmarks/C/Main.pm b/lib/Bookmarks/C/Main.pm
new file mode 100644
index 0000000..63744c1
--- /dev/null
+++ b/lib/Bookmarks/C/Main.pm
@@ -0,0 +1,45 @@
+package Bookmarks::C::Main;
+
+use strict;
+use base 'Catalyst::Base';
+
+=head1 NAME
+
+Bookmarks::C::Main - Catalyst component
+
+=head1 SYNOPSIS
+
+See L<Bookmarks>
+
+=head1 DESCRIPTION
+
+Catalyst component.
+
+=head1 METHODS
+
+=over 4
+
+=item default
+
+=cut
+
+sub default : Private {
+ my ( $self, $c ) = @_;
+ $c->res->output('Congratulations, Bookmarks::C::Main is on Catalyst!');
+}
+
+=back
+
+
+=head1 AUTHOR
+
+A clever guy
+
+=head1 LICENSE
+
+This library is free software . You can redistribute it and/or modify
+it under the same terms as perl itself.
+
+=cut
+
+1;
diff --git a/lib/Bookmarks/M/DB.pm b/lib/Bookmarks/M/DB.pm
new file mode 100644
index 0000000..44d7498
--- /dev/null
+++ b/lib/Bookmarks/M/DB.pm
@@ -0,0 +1,42 @@
+package Bookmarks::M::DB;
+
+use strict;
+use base 'Catalyst::Model::CDBI';
+use Path::Class;
+
+my $DBHOME=dir(Bookmarks->config->{home})->file('bookmarks.db');
+
+__PACKAGE__->config(
+ dsn => "dbi:SQLite:$DBHOME",
+ user => '',
+ password => '',
+ options => {},
+ relationships => 1
+);
+
+
+=head1 NAME
+
+Bookmarks::M::DB - CDBI Model Component
+
+=head1 SYNOPSIS
+
+ Very simple to use
+
+=head1 DESCRIPTION
+
+Very nice component.
+
+=head1 AUTHOR
+
+Clever guy
+
+=head1 LICENSE
+
+This library is free software . You can redistribute it and/or modify it under
+the same terms as perl itself.
+
+=cut
+
+1;
+
diff --git a/lib/Bookmarks/M/DB/Links.pm b/lib/Bookmarks/M/DB/Links.pm
new file mode 100644
index 0000000..7b8928f
--- /dev/null
+++ b/lib/Bookmarks/M/DB/Links.pm
@@ -0,0 +1,29 @@
+package Bookmarks::M::DB::Links;
+
+use strict;
+
+=head1 NAME
+
+Bookmarks::M::DB::Links - CDBI Model Component Table Class
+
+=head1 SYNOPSIS
+
+ Very simple to use
+
+=head1 DESCRIPTION
+
+Very nice component.
+
+=head1 AUTHOR
+
+Clever guy
+
+=head1 LICENSE
+
+This library is free software . You can redistribute it and/or modify it under
+the same terms as perl itself.
+
+=cut
+
+1;
+
diff --git a/lib/Bookmarks/M/DB/LinksTags.pm b/lib/Bookmarks/M/DB/LinksTags.pm
new file mode 100644
index 0000000..df85fe7
--- /dev/null
+++ b/lib/Bookmarks/M/DB/LinksTags.pm
@@ -0,0 +1,29 @@
+package Bookmarks::M::DB::LinksTags;
+
+use strict;
+
+=head1 NAME
+
+Bookmarks::M::DB::LinksTags - CDBI Model Component Table Class
+
+=head1 SYNOPSIS
+
+ Very simple to use
+
+=head1 DESCRIPTION
+
+Very nice component.
+
+=head1 AUTHOR
+
+Clever guy
+
+=head1 LICENSE
+
+This library is free software . You can redistribute it and/or modify it under
+the same terms as perl itself.
+
+=cut
+
+1;
+
diff --git a/lib/Bookmarks/M/DB/Tags.pm b/lib/Bookmarks/M/DB/Tags.pm
new file mode 100644
index 0000000..3011510
--- /dev/null
+++ b/lib/Bookmarks/M/DB/Tags.pm
@@ -0,0 +1,29 @@
+package Bookmarks::M::DB::Tags;
+
+use strict;
+
+=head1 NAME
+
+Bookmarks::M::DB::Tags - CDBI Model Component Table Class
+
+=head1 SYNOPSIS
+
+ Very simple to use
+
+=head1 DESCRIPTION
+
+Very nice component.
+
+=head1 AUTHOR
+
+Clever guy
+
+=head1 LICENSE
+
+This library is free software . You can redistribute it and/or modify it under
+the same terms as perl itself.
+
+=cut
+
+1;
+
diff --git a/lib/Bookmarks/V/TT.pm b/lib/Bookmarks/V/TT.pm
new file mode 100644
index 0000000..d2063b6
--- /dev/null
+++ b/lib/Bookmarks/V/TT.pm
@@ -0,0 +1,29 @@
+package Bookmarks::V::TT;
+
+use strict;
+use base 'Catalyst::View::TT';
+
+=head1 NAME
+
+Bookmarks::V::TT - TT View Component
+
+=head1 SYNOPSIS
+
+See L<Bookmarks>
+
+=head1 DESCRIPTION
+
+TT View Component.
+
+=head1 AUTHOR
+
+A clever guy
+
+=head1 LICENSE
+
+This library is free software . You can redistribute it and/or modify
+it under the same terms as perl itself.
+
+=cut
+
+1;
diff --git a/script/bookmarks_makedb.pl b/script/bookmarks_makedb.pl
new file mode 100644
index 0000000..84e2fd5
--- /dev/null
+++ b/script/bookmarks_makedb.pl
@@ -0,0 +1,44 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+use DBI;
+use FindBin;
+use Path::Class;
+
+my $DBHOME=dir($FindBin::Bin)->parent->file('bookmarks.db');
+
+my $db=DBI->connect("dbi:SQLite:$DBHOME");
+
+local $/='';
+while (<DATA>) {
+ my $rv=$db->do($_);
+ warn 'Problemi: '.$db->errstr() unless $rv;
+}
+
+__DATA__
+drop table links_tags;
+
+drop table links;
+
+drop table tags;
+
+create table links (
+ pk integer primary key autoincrement,
+ url text unique,
+ descr text,
+ icon blob,
+ add_date integer,
+ last_access_date integer,
+ access_count integer
+);
+
+create table tags (
+ pk integer primary key autoincrement,
+ name text unique,
+ descr text
+);
+
+create table links_tags (
+ link integer,
+ tag integer
+);
diff --git a/t/C/Main.t b/t/C/Main.t
new file mode 100644
index 0000000..83ca15b
--- /dev/null
+++ b/t/C/Main.t
@@ -0,0 +1,7 @@
+
+use Test::More tests => 3;
+use_ok( Catalyst::Test, 'Bookmarks' );
+use_ok('Bookmarks::C::Main');
+
+ok( request('main')->is_success );
+
diff --git a/t/M/db_links.t b/t/M/db_links.t
new file mode 100644
index 0000000..d0457c3
--- /dev/null
+++ b/t/M/db_links.t
@@ -0,0 +1,3 @@
+use Test::More tests => 2;
+use_ok( Catalyst::Test, 'Bookmarks' );
+use_ok('Bookmarks::M::DB::Links');
diff --git a/t/M/db_linkstags.t b/t/M/db_linkstags.t
new file mode 100644
index 0000000..17b9823
--- /dev/null
+++ b/t/M/db_linkstags.t
@@ -0,0 +1,3 @@
+use Test::More tests => 2;
+use_ok( Catalyst::Test, 'Bookmarks' );
+use_ok('Bookmarks::M::DB::LinksTags');
diff --git a/t/M/db_sqlitesequence.t b/t/M/db_sqlitesequence.t
new file mode 100644
index 0000000..df8d0f9
--- /dev/null
+++ b/t/M/db_sqlitesequence.t
@@ -0,0 +1,3 @@
+use Test::More tests => 2;
+use_ok( Catalyst::Test, 'Bookmarks' );
+use_ok('Bookmarks::M::DB::SqliteSequence');
diff --git a/t/M/db_tags.t b/t/M/db_tags.t
new file mode 100644
index 0000000..7c14151
--- /dev/null
+++ b/t/M/db_tags.t
@@ -0,0 +1,3 @@
+use Test::More tests => 2;
+use_ok( Catalyst::Test, 'Bookmarks' );
+use_ok('Bookmarks::M::DB::Tags');
diff --git a/t/V/TT.t b/t/V/TT.t
new file mode 100644
index 0000000..23fd270
--- /dev/null
+++ b/t/V/TT.t
@@ -0,0 +1,4 @@
+
+use Test::More tests => 1;
+use_ok('Bookmarks::V::TT');
+