使用perl MIME :: Parser时的文件输出

时间:2013-06-09 15:16:05

标签: perl

如何获取以下选项的路径?
basiclly消息将被解析为后面的dir“/ tmp / msg-1370789006-11903-0”,它由以下内容组成: 时间和进程ID,如何将其存入我的变量供以后使用?

### Tell it where to put things:
    $parser->output_under("/tmp");

1 个答案:

答案 0 :(得分:0)

发行版的整体documentation(也可在发行版的README文件中找到)包含以下有用信息:

 Overview of the classes

    Here are the classes you'll generally be dealing with directly:

        (START HERE)            results() .-----------------.
              \                 .-------->| MIME::          |
               .-----------.   /          | Parser::Results |
               | MIME::    |--'           `-----------------'
               | Parser    |--.           .-----------------.
               `-----------'   \ filer()  | MIME::          |
                  | parse()     `-------->| Parser::Filer   |
                  | gives you             `-----------------'
                  | a...                                  | output_path() 
                  |                                       | determines
                  |                                       | path() of...
                  |    head()       .--------.            |
                  |    returns...   | MIME:: | get()      |
                  V       .-------->| Head   | etc...     |
               .--------./          `--------'            |
         .---> | MIME:: |                                 |
         `-----| Entity |           .--------.            |
       parts() `--------'\          | MIME:: |           /
       returns            `-------->| Body   |<---------'
       sub-entities    bodyhandle() `--------'
       (if any)        returns...       | open()
                                        | returns...
                                        |
                                        V
                                    .--------. read()
                                    | IO::   | getline()
                                    | Handle | print()
                                    `--------' etc...

这导致我们查看MIME :: Body的documentation,其中包括以下内容:

### Where's the data?
if (defined($body->path)) {   ### data is on disk:
    print "data is stored externally, in ", $body->path;
}
else {                        ### data is in core:
    print "data is already in core, and is...\n", $body->as_string;
}

### Get rid of anything on disk:
$body->purge;