イメージ
 Kindle Paperwhiteが故障 2023年の3月購入なので、1年の保証期間はとっくに過ぎている。 状況は、画面右端が充電後に表示欠けを起こすようになった。 最初は1cm程度だったのに、いまでは2cm程度表示できず、右端の文字が読めない状況に…。 さて、修理可能なのか不明なので、Amazonに問い合わせすることに…。 チャットで問い合わせを選択すると、すぐに担当者につながった。 日本人の名前ではなかったけれど、とても丁寧な対応でしっかり教育されている感じ。 結果的には、 ・修理対応は行っていない。 ・買い替えるしか手段はない。 しかも、同一機種はすでに無く、後継機種(画面が7インチにUp)しか選択できない。 さて、どうしようかとチャットしながら考えていたら、先方から提案が…。  再度、Kindle端末を購入されるのであれば、15%OFFのギフトを送る(登録)ってくれる。  ご検討くださいとのことだった…。 なるほど…。  いま Kindle端末 を見ると22,980円か〜。さらに15%OFFとなると、19,533円 迷うなぁ…。もうタブレットを使用しちゃおうかとも考えていたので…。 ギフトの期限は無いそうなので、しばらく悩んでみますゎ。

久しぶりで、使い方を忘れてた…(Perl)

Perlでプログラムをガシガシと

昨年納品したプログラムの、追加機能の要求が上がったので、見直しを行っていた。

今回は、DBを使うほど件数が増えそうにもない。
履歴を見て登録されているユーザか、そうでないかを判別するだけなので、ハッシュをファイルに紐付けて、簡易のDBとして使うことにする。

 昔なら、メモリがパンクするんじゃ?とかディスク遅いっすとか思ったりして躊躇するんだろうけど、今どきはドンドンメモリ使っちゃおう!ファイル使っちゃおう!なんて思ったりもする。

さて、前回利用したモジュールは
Jcode;
MIME::Parser;
MIME::WordDecoder;
File::Basename;
File::Path;
Fcntl;
File::Temp;
書き出してみるとこんなにもあった。

でもって、今回新たに Storable;

当然、稼働しているプログラムなので、直接いじるわけにはいかない。
とりあえず、ローカルでテストをする。

ソースを取り出して、修正内容を細かく分割。
それぞれテストして、組み立て…。

と、最初のテストで躓いた。

ローカルの環境が、この春に14.04で準備したNewマシンなので、モジュールが入っていない!

モジュールのインストール

そもそも、最初のuse Jcode;でエラー吐いているし…

ということで、インストールしようとしたが、コマンドを全く思い出せない。
あれれ? どうやら老化と共にやってくるアレか?
# perl -MCPAN -e shell
これが思い出せずに、仕方なくググりました。
いやぁ、外部記憶に入れておいて良かったゎ(泣) というか、内部記憶から消去されている模様。

忘れないように、自分を戒めるために記録しておく。

作業自体は、コマンド入力して完了するのに1分もかからないというのに、思い出そうとした時間の方が長いとは…。

root@X200:~# perl -MCPAN -e shell

CPAN.pm requires configuration, but most of it can be done automatically.
If you answer 'no' below, you will enter an interactive dialog for each
configuration option instead.

Would you like to configure as much as possible automatically? [yes] 

Autoconfigured everything but 'urllist'.

Now you need to choose your CPAN mirror sites.  You can let me
pick mirrors for you, you can select them from a list or you
can enter them by hand.

Would you like me to autoroot@X200:~# perl -MCPAN -e shell

CPAN.pm requires configuration, but most of it can be done automatically.
If you answer 'no' below, you will enter an interactive dialog for each
configuration option instead.

Would you like to configure as much as possible automatically? [yes] 

Autoconfigured everything but 'urllist'.

Now you need to choose your CPAN mirror sites.  You can let me
pick mirrors for you, you can select them from a list or you
can enter them by hand.

Would you like me to automatically choose some CPAN mirror
sites for you? (This means connecting to the Internet) [yes] 
Trying to fetch a mirror list from the Internet
Fetching with LWP:
http://www.perl.org/CPAN/MIRRORED.BY

Looking for CPAN mirrors near you (please be patient)
.......................... done!

New urllist
  http://cpan.develooper.com/
  http://mirrors.gossamer-threads.com/CPAN/
  http://mirror.team-cymru.org/CPAN/

Autoconfiguration complete.

commit: wrote '/home/satoshi/.cpan/CPAN/MyConfig.pm'

You can re-run configuration any time with 'o conf init' in the CPAN shell
Terminal does not support AddHistory.

cpan shell -- CPAN exploration and modules installation (v2.00)
Enter 'h' for help.

cpan[1]> install Jcode
Fetching with LWP:
http://cpan.develooper.com/authors/01mailrc.txt.gz
Reading '/home/satoshi/.cpan/sources/authors/01mailrc.txt.gz'
............................................................................DONE
Fetching with LWP:
http://cpan.develooper.com/modules/02packages.details.txt.gz
Reading '/home/satoshi/.cpan/sources/modules/02packages.details.txt.gz'
  Database was generated on Tue, 09 Sep 2014 13:53:17 GMT
..............
  New CPAN.pm version (v2.05) available.
  [Currently running version is v2.00]
  You might want to try
    install CPAN
    reload cpan
  to both upgrade CPAN.pm and run the new version without leaving
  the current session.


..............................................................DONE
Fetching with LWP:
http://cpan.develooper.com/modules/03modlist.data.gz
Reading '/home/satoshi/.cpan/sources/modules/03modlist.data.gz'
DONE
Writing /home/satoshi/.cpan/Metadata
Running install for module 'Jcode'
Running make for D/DA/DANKOGAI/Jcode-2.07.tar.gz
Fetching with LWP:
http://cpan.develooper.com/authors/id/D/DA/DANKOGAI/Jcode-2.07.tar.gz
Fetching with LWP:
http://cpan.develooper.com/authors/id/D/DA/DANKOGAI/CHECKSUMS
Checksum for /home/satoshi/.cpan/sources/authors/id/D/DA/DANKOGAI/Jcode-2.07.tar.gz ok
Scanning cache /home/satoshi/.cpan/build for sizes
DONE

  CPAN.pm: Building D/DA/DANKOGAI/Jcode-2.07.tar.gz

Checking if your kit is complete...
Looks good
Writing Makefile for Jcode
Writing MYMETA.yml and MYMETA.json
cp Jcode/Nihongo.pod blib/lib/Jcode/Nihongo.pod
cp Jcode.pm blib/lib/Jcode.pm
Manifying blib/man3/Jcode::Nihongo.3pm
Manifying blib/man3/Jcode.3pm
  DANKOGAI/Jcode-2.07.tar.gz
  /usr/bin/make -- OK
Running make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/append.t ... ok     
t/convert.t .. ok     
t/getcode.t .. ok   
t/h2z.t ...... ok   
t/jfold.t .... ok   
t/length.t ... ok   
t/mime.t ..... ok     
t/new.t ...... ok     
t/perl581.t .. ok   
t/regex.t .... ok   
t/tr.t ....... ok     
All tests successful.
Files=11, Tests=244,  1 wallclock secs ( 0.08 usr  0.01 sys +  1.20 cusr  0.02 csys =  1.31 CPU)
Result: PASS
  DANKOGAI/Jcode-2.07.tar.gz
  /usr/bin/make test -- OK
Running make install
Manifying blib/man3/Jcode::Nihongo.3pm
Installing /usr/local/share/perl/5.18.2/Jcode.pm
Installing /usr/local/share/perl/5.18.2/Jcode/Nihongo.pod
Installing /usr/local/man/man3/Jcode::Nihongo.3pm
Installing /usr/local/man/man3/Jcode.3pm
Appending installation info to /usr/local/lib/perl/5.18.2/perllocal.pod
  DANKOGAI/Jcode-2.07.tar.gz
  /usr/bin/make install  -- OK

cpan[2]> Terminal does not support GetHistory.
Lockfile removed.
matically choose some CPAN mirror
sites for you? (This means connecting to the Internet) [yes] 
Trying to fetch a mirror list from the Internet
Fetching with LWP:
http://www.perl.org/CPAN/MIRRORED.BY

Looking for CPAN mirrors near you (please be patient)
.......................... done!

New urllist
  http://cpan.develooper.com/
  http://mirrors.gossamer-threads.com/CPAN/
  http://mirror.team-cymru.org/CPAN/

Autoconfiguration complete.

commit: wrote '/home/satoshi/.cpan/CPAN/MyConfig.pm'

You can re-run configuration any time with 'o conf init' in the CPAN shell
Terminal does not support AddHistory.

cpan shell -- CPAN exploration and modules installation (v2.00)
Enter 'h' for help.

cpan[1]> install Jcode
Fetching with LWP:
http://cpan.develooper.com/authors/01mailrc.txt.gz
Reading '/home/satoshi/.cpan/sources/authors/01mailrc.txt.gz'
............................................................................DONE
Fetching with LWP:
http://cpan.develooper.com/modules/02packages.details.txt.gz
Reading '/home/satoshi/.cpan/sources/modules/02packages.details.txt.gz'
  Database was generated on Tue, 09 Sep 2014 13:53:17 GMT
..............
  New CPAN.pm version (v2.05) available.
  [Currently running version is v2.00]
  You might want to try
    install CPAN
    reload cpan
  to both upgrade CPAN.pm and run the new version without leaving
  the current session.


..............................................................DONE
Fetching with LWP:
http://cpan.develooper.com/modules/03modlist.data.gz
Reading '/home/satoshi/.cpan/sources/modules/03modlist.data.gz'
DONE
Writing /home/satoshi/.cpan/Metadata
Running install for module 'Jcode'
Running make for D/DA/DANKOGAI/Jcode-2.07.tar.gz
Fetching with LWP:
http://cpan.develooper.com/authors/id/D/DA/DANKOGAI/Jcode-2.07.tar.gz
Fetching with LWP:
http://cpan.develooper.com/authors/id/D/DA/DANKOGAI/CHECKSUMS
Checksum for /home/satoshi/.cpan/sources/authors/id/D/DA/DANKOGAI/Jcode-2.07.tar.gz ok
Scanning cache /home/satoshi/.cpan/build for sizes
DONE

  CPAN.pm: Building D/DA/DANKOGAI/Jcode-2.07.tar.gz

Checking if your kit is complete...
Looks good
Writing Makefile for Jcode
Writing MYMETA.yml and MYMETA.json
cp Jcode/Nihongo.pod blib/lib/Jcode/Nihongo.pod
cp Jcode.pm blib/lib/Jcode.pm
Manifying blib/man3/Jcode::Nihongo.3pm
Manifying blib/man3/Jcode.3pm
  DANKOGAI/Jcode-2.07.tar.gz
  /usr/bin/make -- OK
Running make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/append.t ... ok     
t/convert.t .. ok     
t/getcode.t .. ok   
t/h2z.t ...... ok   
t/jfold.t .... ok   
t/length.t ... ok   
t/mime.t ..... ok     
t/new.t ...... ok     
t/perl581.t .. ok   
t/regex.t .... ok   
t/tr.t ....... ok     
All tests successful.
Files=11, Tests=244,  1 wallclock secs ( 0.08 usr  0.01 sys +  1.20 cusr  0.02 csys =  1.31 CPU)
Result: PASS
  DANKOGAI/Jcode-2.07.tar.gz
  /usr/bin/make test -- OK
Running make install
Manifying blib/man3/Jcode::Nihongo.3pm
Installing /usr/local/share/perl/5.18.2/Jcode.pm
Installing /usr/local/share/perl/5.18.2/Jcode/Nihongo.pod
Installing /usr/local/man/man3/Jcode::Nihongo.3pm
Installing /usr/local/man/man3/Jcode.3pm
Appending installation info to /usr/local/lib/perl/5.18.2/perllocal.pod
  DANKOGAI/Jcode-2.07.tar.gz
  /usr/bin/make install  -- OK

cpan[2]> Terminal does not support GetHistory.
Lockfile removed.

はい! 無事作業が終わって、コードは動きましたとさ。

しかし、ちょっと前まで、使っていたはずなのになぁ。
ボケてきたんだろうか?

コメント

このブログの人気の投稿

Ubuntu24.04 でGUIが死んだ

WPS Officeで日本語入力ができない

VirtualBoxでUSBから起動