あたらしものずきっ!

試してみたものとか、遊んでみたものを色々記してみます。

sqliteでdbの作成

Model作成のためにSQLiteに手をつける。

MacPortsからsqlite3のインストール。

%sudo port install sqlite3

dbファイルの作成をためしてみる。

%sqlite3 appinfo.db
sqlite>create table appinfo(key integer primary key, name varchar(30));
sqlite>insert into appinfo values(null,'hoge');
sqlite>.quit

必要なモジュールのインストール。(参照 DBICによるモデル作成)
途中のDBIx::Classのインストールで以下の表示がでた。

############################### WARNING #################################
#                                                                       #
# You are running a buggy version of DBD::SQLite known to randomly      #
# segfault on errors.  Even if you have the latest CPAN module version, #
# the sqlite3 dynamic library on this system might have been compiled   #
# against an older buggy sqlite3 dev library (oddly DBD::SQLite will    #
# prefer the system library against the one bundled with it). You are   #
# strongly advised to resolve this issue before proceeding.             #
#                                                                       #
#########################################################################

古いDBD::SQLiteを拾ってくることにした。

%wget http://search.cpan.org/CPAN/authors/id/M/MS/MSERGEANT/DBD-SQLite-1.13.tar.gz
%tar xvfz DBD-SQLite-1.13.tar.gz
%cd DBD-SQLite-1.13
%perl Makefile.PL USE_LOCAL_SQLITE=true
%sudo make && make test
%sudo make install

そのあと再びDBIx::Classを入れようとしたところ、

- DBD::SQLite              ...missing. (would need 1.14)

上記の表示に。そこで一旦中断して設定。

%sudo cpan
cpan>o conf init makepl_arg USE_LOCAL_SQLITE=true

再度DBIx::Classいれると

  /usr/bin/make install  -- OK

となった。