<?xml version="1.0" encoding="UTF-8" ?><rdf:RDF 
  xmlns="http://purl.org/rss/1.0/"
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns:atom="http://www.w3.org/2005/Atom"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xml:lang="ja">
  <channel rdf:about="http://w.atwiki.jp/cons/">
    <title>てきとうメモ - cons @ wiki</title>
    <link>http://w.atwiki.jp/cons/</link>
    <atom:link href="https://w.atwiki.jp/cons/rss10.xml" rel="self" type="application/rss+xml" />
    <atom:link rel="hub" href="https://pubsubhubbub.appspot.com" />
    <description>てきとうメモ - cons @ wiki</description>

    <dc:language>ja</dc:language>
    <dc:date>2010-08-06T11:42:34+09:00</dc:date>
    <utime>1281062554</utime>

    <items>
      <rdf:Seq>
                <rdf:li rdf:resource="https://w.atwiki.jp/cons/pages/20.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/cons/pages/15.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/cons/pages/19.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/cons/pages/14.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/cons/pages/18.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/cons/pages/1.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/cons/pages/2.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/cons/pages/17.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/cons/pages/16.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/cons/pages/13.html" />
              </rdf:Seq>
    </items>
	
		
    
  </channel>
    <item rdf:about="https://w.atwiki.jp/cons/pages/20.html">
    <title>Email</title>
    <link>https://w.atwiki.jp/cons/pages/20.html</link>
    <description>
      **添付ファイルの自動処理
***メールの添付ファイルの仕組み
SMTPでメールを送信するとき、DATAコマンドに続いてメールの内容をMIME形式でテキストを送信する。

 To:Display Name&lt;someone@example.com&gt;\r\n
 From:\r\n
 Subject:
 Content-Type:text/plain
 \r\n
 (本文のテキスト)

添付ファイルを含むメールは、本文のテキストを一つのpart、添付ファイルをエンコードしてMIME形式にしたものをもう一つのpartとしたmultipart MIMEとして送信される。

添付ファイルを抽出するには、POPでmultipart MIMEを取得したあと、MIMEをパースしてファイルを取り出せばよい。

***Perl
use MIME::IMAPClient;
use Email::MIME;
use Email::MIME::Attachment::Stripper;

Thunderbird 2.x から送られてくるメールのテキストの添付ファイルは抽出できない。
 
原因は
[[Thunderbird bug #65794&gt;https://bugzilla.mozilla.org/show_bug.cgi?id=65794]]
 Content-Type: text/plain;
 Content-Disposition: inline; filename=&quot;...&#039;
なんでもかんでもinline扱い。

とりあえず以下のようにすれば動く。

 use Email::MIME::Attachment::Stripper;
 {package Email::MIME::Attachment::Stripper;
 sub _detach_all {
    my ($self, $part) = @_;
    $part ||= $self-&gt;{message};
    return if $part-&gt;parts == 1;
    my @attach = ();
    my @keep   = ();
    foreach ( $part-&gt;parts ) {
        my $ct = $_-&gt;content_type                  || &#039;text/plain&#039;;
        my $dp = $_-&gt;header(&#039;Content-Disposition&#039;) || &#039;inline&#039;;
        push(@keep, $_) and next
          if $ct =~ m[text/plain]i &amp;&amp; $dp =~ /inline/i &amp;&amp; !(defined $_-&gt;filename);
        push @attach, $_;
  if ($_-&gt;parts &gt; 1) {
          my @kept=$self-&gt;_detach_all($_);
    push(@keep,@kept) if @kept;
        }
    }
    $part-&gt;parts_set(\@keep);
    push @{$self-&gt;{attach}}, map {
        my $content_type = parse_content_type($_-&gt;content_type);
        {
            content_type =&gt; join(
                                 &#039;/&#039;,
                                 @{$content_type}{qw[discrete composite]}
                                ),
            payload      =&gt; $_-&gt;body,
            filename     =&gt;   $self-&gt;{attr}-&gt;{force_filename}
                            ? $_-&gt;filename(1)
                            : ($_-&gt;filename || &#039;&#039;),
        }
    } @attach;
    return @keep;
 }}    </description>
    <dc:date>2010-08-06T11:42:34+09:00</dc:date>
    <utime>1281062554</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/cons/pages/15.html">
    <title>繰り返し</title>
    <link>https://w.atwiki.jp/cons/pages/15.html</link>
    <description>
      **Shell
***bash
 while true; do mplayer *.mp3; done
***csh
;と改行は重要

 while(1); mplayer *.mp3 
 end

 loop:
 mplayer *.mp3
 goto loop
あるいは
 loop:
 mplayer *.mp3;goto loop
**Scheme
 (for-each ... (iota n))

named-letをつかう
 (let loop (...)
   (... (loop ...)))

**Arc
 (to i n (pr i))    </description>
    <dc:date>2010-07-29T06:40:10+09:00</dc:date>
    <utime>1280353210</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/cons/pages/19.html">
    <title>やっつけ仕事</title>
    <link>https://w.atwiki.jp/cons/pages/19.html</link>
    <description>
      **CP932 (Windowsの日本語コード)
***Perl
 use Encode::Guess qw(cp932 utf8 eucjp);
 print encode(&quot;utf8&quot;, decode(&quot;Guess&quot;, (pack &quot;s&quot;, 0x8740)));    </description>
    <dc:date>2010-07-29T06:36:28+09:00</dc:date>
    <utime>1280352988</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/cons/pages/14.html">
    <title>リスト</title>
    <link>https://w.atwiki.jp/cons/pages/14.html</link>
    <description>
      *構造
配列 連結リスト
**append
***R5RS
(append list_1 list_2 ... list_n) - リストの連結
  
 (let* ((a (list 1 2 3)) (b (list 4 5)) (c (append a b)))
  (set-car! (list-tail c 2) &#039;x)
  (set-car! (list-tail c 3) &#039;y)
  (values a b c)) =&gt; (1 2 3) (y 5) (1 2 x y 5)

(append! list_1 list_2 ... list_n) - リストの連結
list1 ... list_n-1 が破壊される場合がある。

 (define x (list &#039;a &#039;b &#039;c))
 (set! x (append! x &#039;(1 2 3))
 x =&gt; (a b c 1 2 3)
**concat
***javascript
**indexOf
**iota
***srfi
srfi-1: (iota count [start] [step]) - 等間隔の数値をもつリスト
 (start start+step ... start+(count-1)*step)

 (iota 6) =&gt; (0 1 2 3 4 5)
 (iota 3 5 0.5) =&gt; (5 5.5 6)
**join
**lastIndexOf
**length
**list
**list-ref
***R5RS
(list-ref list index)
 (list-ref &#039;(a b c d) 2) =&gt; c
**memcpy
***C
 #include &lt;string.h&gt;
 memcpy (void *dest, const void *src, size_t n);
**pop
***Perl
pop array - Pops and returns the last value of the array, shortening the array by one element.
 @a = (1, 2, 3, 4);
 pop (@a) =&gt; 4
 &quot;@a&quot; =&gt; 1 2 3
***Gauche
Macro: (pop! place) - (car place) を返し、place に (cdr place) をセットする
 (set! x &#039;(1 2 3 4))
 (pop! x) =&gt; 1
 x =&gt; (2 3 4)
Perlのshiftに近い
**push
**reverse
**shift
***Perl
shift array - 配列の先頭の値を除去し、その値を返す。
配列が空の場合、未定義値が返る。definedで検出。
**slice
**sort
**splice
**split
**subseq
***Common Lisp
***Gauche
 (use gauche.sequence)
 (subseq &#039;(a b c d e) 2 2) =&gt; (c d)
**unshift
***Perl
unshift array, list - Prepends list to the front of the array, and returns the new number of elements in the array.

 @a = (1, 2);
 unshift (@a, 3, 4, 5) =&gt; 5
 &quot;@a&quot; =&gt; 3 4 5 1 2
**vector    </description>
    <dc:date>2010-07-29T06:33:26+09:00</dc:date>
    <utime>1280352806</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/cons/pages/18.html">
    <title>REPL</title>
    <link>https://w.atwiki.jp/cons/pages/18.html</link>
    <description>
      Read-Eval-Print Loop. interactive mode とも。意味合いは違うが、同じ機能を持つものをShellと呼んでいる場合も多い。
**Perl
***いつもの
list
 perl -ne &#039;print eval, &quot;\n&gt; &quot;&#039;
scalar
 perl -ne &#039;print eval. &quot;\n&quot;&#039;
 perl -pe &#039;$_=eval&#039;
***perl debugger
 perl -de 0
***Shell::Perl
 cpan&gt; install Shell::Perl
 $ pirl
 pirl @&gt; @a=(1, 2, 3);
 (1, 2, 3)
 pirl @&gt; :set ctx $
 pirl $&gt; (1, 2, 3)
 Useless use of a constant in void context at (eval 17) line 1.
 3
 pirl $&gt; :help

表示形式は以下から選べる。
 
 pirl $&gt; :set out [D|DD|DDS|Y|P]
  D : Data::Dump
  DD : Data::Dumper
  DDS : Data::Dump::Streamer
  Y : YAML
  P : Plain

Data::Dumpではうまく日本語を表示できないようだが。

 pirl @&gt; &quot;日本語&quot;
 &quot;\xE6\x97\xA5\xE6\x9C\xAC\xE8\xAA\x9E&quot;

***Devel:PERL
 cpan&gt; install Devel::REPL
 # apt-get install libdevel-repl-perl
 $ re.pl
起動がもたつく…
 $ my @a = (1, 2, 3);
 $ARRAY1 = [
             1,
             2,
             3
           ];
 
 $ {
 &gt;  my @a = (4, 5);
 &gt;  print &quot;@a\n&quot;;
 &gt; }
 4 5
 1
 $ print &quot;@a\n&quot;
 4 5
 1
 $ exit
*** psh
csh, bash といったような Unix shell としての perl shell.    </description>
    <dc:date>2010-07-22T04:18:29+09:00</dc:date>
    <utime>1279739909</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/cons/pages/1.html">
    <title>トップページ</title>
    <link>https://w.atwiki.jp/cons/pages/1.html</link>
    <description>
      てきとうメモ。計算機、プログラミング言語関連。    </description>
    <dc:date>2010-07-22T04:15:50+09:00</dc:date>
    <utime>1279739750</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/cons/pages/2.html">
    <title>メニュー</title>
    <link>https://w.atwiki.jp/cons/pages/2.html</link>
    <description>
      **メニュー
-[[トップページ]]
-[[プラグイン紹介&gt;プラグイン]]
-[[まとめサイト作成支援ツール]]
-[[メニュー]]
-[[メニュー2]]

----
count ... &amp;counter()

// リンクを張るには &quot;[&quot; 2つで文字列を括ります。
// &quot;&gt;&quot; の左側に文字、右側にURLを記述するとリンクになります


//**更新履歴
//#recent(20)

&amp;link_editmenu(text=ここを編集)    </description>
    <dc:date>2010-07-22T04:14:44+09:00</dc:date>
    <utime>1279739684</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/cons/pages/17.html">
    <title>逐次実行</title>
    <link>https://w.atwiki.jp/cons/pages/17.html</link>
    <description>
      **Scheme
基本の構文とマクロ
 (begin ...)
 (begin0 ...)
 (let (...) ...)
 (let1 x value ...)
 (when pred ...)

代入が続くときは
 (let* (
  ...
  (data ...)
  (surf (cairo_create_image_surface_for_data ... data))
  (cr (cairo_create surf))
  (_ (cairo_rectangle cr ...))
  ...))    </description>
    <dc:date>2010-07-22T04:06:55+09:00</dc:date>
    <utime>1279739215</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/cons/pages/16.html">
    <title>Scheme/Lisp 処理系</title>
    <link>https://w.atwiki.jp/cons/pages/16.html</link>
    <description>
      **Scheme
Gauche
PLT Scheme
guile
SCM
TinyScheme
mosh    </description>
    <dc:date>2010-07-17T22:59:06+09:00</dc:date>
    <utime>1279375146</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/cons/pages/13.html">
    <title>文字列操作</title>
    <link>https://w.atwiki.jp/cons/pages/13.html</link>
    <description>
      **append
**slice
**splice
**strcmp
**substr
**substring    </description>
    <dc:date>2010-07-17T20:56:49+09:00</dc:date>
    <utime>1279367809</utime>
  </item>
  </rdf:RDF>
