最新版のMoxyをMacBookにインストールするまで



最新版Moxyをチェックアウトする(2008/10/02現在)

svn co http://svn.coderepos.org/share/lang/perl/Moxy/trunk/ moxy

cd moxy

perl Makefile.PL

Warning: prerequisite HTML::Entities::ImodePictogram 0 not found.
Warning: prerequisite HTML::StickyQuery 0 not found.
Warning: prerequisite HTTP::MobileAgent 0 not found.


モジュールないよ!ってエラーが出るので、必要なモジュールをCPANのインストールする。

再度実行。エラーでなくなった。

perl Makefile.PL
Writing Makefile for Moxy


config.yamlの作成

cp config.yaml.sample config.yaml


さぁ実行!HTTP::Engine入ってるのにエラーになる。

./moxy.pl

Can't locate HTTP/Engine.pm in @INC (@INC contains: /Users/acotie/Sites/moxy/lib /opt/local/lib/perl5/5.8.8 /System/Library/Perl/5.8.8/darwin-thread-multi-2level /System/Library/Perl/5.8.8 /Library/Perl/5.8.8/darwin-thread-multi-2level /Library/Perl/5.8.8 /Library/Perl /Network/Library/Perl/5.8.8/darwin-thread-multi-2level /Network/Library/Perl/5.8.8 /Network/Library/Perl /System/Library/Perl/Extras/5.8.8/darwin-thread-multi-2level /System/Library/Perl/Extras/5.8.8 /Library/Perl/5.8.6 /Library/Perl/5.8.1 .) at /Users/acotie/Sites/moxy/lib/Moxy/Cmd.pm line 8.
BEGIN failed--compilation aborted at /Users/acotie/Sites/moxy/lib/Moxy/Cmd.pm line 8.
Compilation failed in require at ./moxy.pl line 7.
BEGIN failed--compilation aborted at ./moxy.pl line 7.


@INCのパスおかしいYO!ってことで、Macportsの場合はmoxy.plのシェルパスを変更。

vim moxy.pl

#!/opt/local/bin/perlに変更


再度実行。今度はYAML読み込み時に何かエラーになる。

./moxy.pl -c config.yaml

Use of uninitialized value in open at /opt/local/lib/perl5/site_perl/5.8.8/YAML.pm line 69.
Use of uninitialized value in sprintf at /opt/local/lib/perl5/site_perl/5.8.8/YAML/Error.pm line 18.
YAML Error: Couldn't open  for input:\n
   Code: YAML_LOAD_ERR_FILE_INPUT
 at /Users/acotie/Sites/moxy/lib/Moxy/Cmd.pm line 33


moxy/lib/Moxy/Cmd.pmの33行目のsub run()の第二引数がなかったみたいで
色々考えたけどどうしてもわからなかったので#ja.cpan/@freenodeでid:tokuhiromさんに質問する。

### $opt: undef

16:43 実行時のエラーはこんな感じです>< http://rafb.net/p/Z5IwFv21.html
16:45 やっぱり ./moxy.pl -c config.yaml
16:45 という風にパス指定するのがいいとおもいます
16:49 ぬー
16:50 -c が動いてないことを発見
16:50 fixed
16:50 ちなむと、moxy は plagger と同じで
16:50 make install するっていうのは想定外なんす>acotie
16:50 そうなんですか!!!!
16:50 www
16:51 いくつかMoxyで検索してインストールの参考にさせてもらったんですが
16:51 http://tumblr.zeg.la/post/7039921/moxy
16:52 すべて無駄でしたね^^
16:52 (´・ω・`)

fix版をコミットして頂いた箇所をsvnアップデートして再度実行。

svn update

./moxy.pl -c config.yaml


"my" variable $config masks earlier declaration in same scope at /Users/acotie/Sites/moxy/lib/Moxy/Cmd.pm line 36.
open configuration file: config.yaml
Moxy::Storage::DBM_File [debug] storage file is /tmp/moxy.ndbm
HTTP::Server::Simple: You can connect to your server at http://localhost:3128/
Moxy [debug] Authorization header: 
Moxy [debug] Authorization header: acotie,
Moxy [debug] Authorization header: acotie,
Moxy::Storage::DBM_File [debug] get storage user_agent_acotie,
Moxy::Plugin::UserAgentSwitcher [debug] UserAgent is KDDI-TS3G UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0
Moxy [debug] Run hook and get response: request_filter
Moxy::Storage::DBM_File [debug] get storage Moxy::Plugin::UserID,acotie,,KDDI-TS3G UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0
Moxy::Storage::DBM_File [debug] get storage Moxy::Plugin::HTTPHeaderacotie,
Moxy [debug] Run hook and get response: request_filter_E
Use of uninitialized value in split at /opt/local/lib/perl5/site_perl/5.8.8/HTTP/MobileAttribute/Plugin/Display.pm line 31.
Use of uninitialized value in exponentiation (**) at /opt/local/lib/perl5/site_perl/5.8.8/HTTP/MobileAttribute/Plugin/Display.pm line 34.
Moxy [debug] -- response status: 500
Moxy [debug] Content-Type: text/plain
Moxy [debug] Authorization header: acotie,
Moxy::Storage::DBM_File [debug] get storage user_agent_acotie,
Moxy::Plugin::UserAgentSwitcher [debug] UserAgent is KDDI-TS3G UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0
Moxy [debug] Run hook and get response: request_filter
Moxy::Storage::DBM_File [debug] get storage Moxy::Plugin::UserID,acotie,,KDDI-TS3G UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0
Moxy::Storage::DBM_File [debug] get storage Moxy::Plugin::HTTPHeaderacotie,
Moxy [debug] Run hook and get response: request_filter_E

動いた!URLを入力してsubmitボタン押したら、次のページが表示されない><

17:43 あうあう
17:45 http://codepad.org/dW6TLJqO
17:45 sudo -H cpan Encode::JP::Mobile
17:46 ふるいんじゃね?
17:46 acotie_: upgrade Encode::JP::Mobile
17:54 わわ、ありがとうございます。全部一気にアップデートしてしまいましたww
17:54 Unknown encoding 'x-sjis-kddi-auto-raw' at /opt/local/lib/perl5/site_perl/5.8.8/darwin-2level/Encode/JP/Mobile/ConvertPictogramSJIS.pm line 34
17:55 とかでてるってことは
17:55 Encode::JP::Mobile が怪しいな、と
17:55 思って、そうなったら新バージョンがでてないかな、と
17:55 想像するのだ
17:56 この件をblogにまとめるんだ > acotie
17:56 http://perl-users.jp/acotie/
17:56 はい!ありがとうございます><
18:01 わーわー
18:01 動作確認できました!!
18:01 ありがとうございます><
18:01 おめでとう!
18:01 おめでとう!
18:01 おめでとう!
18:02 good
18:02 god!
18:03 ちなみに以前インストールしたmoxyのバージョンは、すっごく古いものだったみたいですw

すごい前のバージョンより使いやすくなってる!見やすくなってる!!



まとめ

  • moxy.plとPlaggerはmake installしてはいけないらしい。
  • moxy.plをMacportsのPerl実行パスに変更する
  • エラーを見て、最新版のモジュールにする(sudo -H cpan Encode::JP::Mobile)
  • 絵文字表示の為に、ImageMagick+GhostScript+LHaを別途インストールする必要がある。
  • 質問する第一声はものすごく勇気がいる
  • #ja.cpanをはじめPerl界隈の方はとても優しい。(パッと見はツンツンしてるかも!?)


別途、Moxy最新版インストール方法のまとめを書く。

そして私もmoxyブランチきったので怖がらずにアップしていく予定。

CDや本だったらスペシャルサンクスに載せたいくらい、すごく感謝しています。
id:tokuhiromさん、本当にありがとうございます^^


ワッサーは絵文字使えるよ!みんな知ってると思うけどwassrの中の人もすごいんだよ!!

私もwassrとMoxyの普及活動に励みます!!!

「Wassr」サービス終了のお知らせ