タグ

ブックマーク / blog.64p.org (33)

  • shell script を書くときの tips 2つ(初心者向け) - tokuhirom's blog

    shell script は普段さけて通りたいと願ってやまないわけですが、たまには書かないといけないことがあるので、そういうときは覚えておくと便利な tips を2つ。 autodie っぽくするset -eとすると、コマンドの実行に失敗したときにそこで実行がとまるので便利。 #!/bin/sh set -e perl -e 'die' echo SHOULD NOT REACH HEREとすると % ./hoge.sh Died at -e line 1. % echo $? 255となって、最後までいかずに死にます。 複数のコマンドを順番に実行するときに便利。 なお、以下のような挙動をするんだそうです。 ただし失敗したコマンドが until または while ループの一部である、 if 文の一部である、 && または || リストの一部である、 コマンドの返り値が ! で反転されてい

    likk
    likk 2012/07/24
  • Data::MessagePack::Unpacker と AnyEvent::MessagePack に関する注意喚起 - tokuhirom's blog

    typester, gfx, tokuhirom の3人で話しあった結果、以下のように決まりましたので、つつしんでご報告いたします。 Data::MessagePack::Unpacker には Bug があるので Deprecate しました。 今後は typester さんによる Data::MessagePack::Stream をご利用ください。 AnyEvent::MessagePack も Data::MessagePack::Stream を利用するように変更してリリース済みとなっています。 なにか不具合・疑問などありましたら [email protected] までお気軽におといあわせください。 以上です。よろしくおねがいします。

    likk
    likk 2012/06/25
    たらいまわし
  • 適当なscriptでは use autodie; する - tokuhirom's blog

    chdirのときもエラー処理は必須ですな〜自分で使うスクリプトだからええ加減な書き方してた〜反省 #ubuntu #perl http://twitter.com/mukumaru/status/20694618336 perl5.10.1 以後では autodie.pm が標準添付されているので、それを利用するとよい。 % perl -E 'use autodie; chdir "/foo"' Can't chdir('/foo'): No such file or directory at -e line 1こんなかんじ。use strict; use warnings; につづけて use autodie; と書くだけ。 使い捨てスクリプトでは use autodie; しておくと、いちいち組み込み関数のエラー処理かかなくていいので便利。

    likk
    likk 2010/08/11
    ↓ 5.10.1 以前なら use Fatal qw(:filesys); でもいいんじゃないかな
  • tokuhirom blog

    Blog Search when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: ${entry.path} [in template "__entry.ftlh" at line 3, column 25] - Reached through: #include "__entry.ftlh" [in template "entry.ftlh" at

  • tokuhirom blog

    Blog Search when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: ${entry.path} [in template "__entry.ftlh" at line 3, column 25] - Reached through: #include "__entry.ftlh" [in template "entry.ftlh" at

    likk
    likk 2008/11/04
    「ポジティブ要素を考慮した意見」をいうと、「おまえは楽観的だなー」といわれたりする
  • tokuhirom blog

    Blog Search when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: ${entry.path} [in template "__entry.ftlh" at line 3, column 25] - Reached through: #include "__entry.ftlh" [in template "entry.ftlh" at

    likk
    likk 2008/10/20
    Moose::Object::Pluggable
  • tokuhirom blog

    Blog Search when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: ${entry.path} [in template "__entry.ftlh" at line 3, column 25] - Reached through: #include "__entry.ftlh" [in template "entry.ftlh" at

  • tokuhirom blog

    Blog Search when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: ${entry.path} [in template "__entry.ftlh" at line 3, column 25] - Reached through: #include "__entry.ftlh" [in template "entry.ftlh" at

    likk
    likk 2008/05/22
    とりあえず、まだ中級者にすらなってない事を再認識した。 >Plagger のコード読まなくても、中級者になれるような
  • Perl で utf8 化けしたときにどうしたらいいか - TokuLog 改メ tokuhirom’s blog

    Blog Search when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: ${entry.path} [in template "__entry.ftlh" at line 3, column 25] - Reached through: #include "__entry.ftlh" [in template "entry.ftlh" at

    likk
    likk 2008/04/08
    最近ようやく理解した
  • tokuhirom blog

    Blog Search when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: ${entry.path} [in template "__entry.ftlh" at line 3, column 25] - Reached through: #include "__entry.ftlh" [in template "entry.ftlh" at

    likk
    likk 2007/11/13
    pop3s
  • tokuhirom blog

    Blog Search when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: ${entry.path} [in template "__entry.ftlh" at line 3, column 25] - Reached through: #include "__entry.ftlh" [in template "entry.ftlh" at

    likk
    likk 2007/11/13
    Prism
  • tokuhirom blog

    Blog Search when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: ${entry.path} [in template "__entry.ftlh" at line 3, column 25] - Reached through: #include "__entry.ftlh" [in template "entry.ftlh" at

    likk
    likk 2007/10/29
    mobile,irc
  • tokuhirom blog

    Blog Search when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: ${entry.path} [in template "__entry.ftlh" at line 3, column 25] - Reached through: #include "__entry.ftlh" [in template "entry.ftlh" at