1

ここでMIME::Parser::FileUnder説明したようにサブクラス化しようとしています。だから私はこのモジュールをインストールします:

$ sudo cpan install MIME::Parser::FileUnder
[...]
Result: PASS
  DSKOLL/MIME-tools-5.504.tar.gz
  /usr/bin/make test -- OK
Running make install
Manifying blib/man3/MIME::Decoder::Gzip64.3pm
Appending installation info to /usr/local/lib/perl/5.14.2/perllocal.pod
  DSKOLL/MIME-tools-5.504.tar.gz
  sudo /usr/bin/make install  -- OK

正常にインストールされているように見えますが、

$ ./test_gmail.pl
Can't locate MIME/Parser/FileUnder.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/site_perl .) at GMailMIMEParser.pm line 4.
BEGIN failed--compilation aborted at GMailMIMEParser.pm line 4.
Compilation failed in require at ./test_gmail.pl line 13.
BEGIN failed--compilation aborted at ./test_gmail.pl line 13.

もう一度インストールしようとするMIME::Parser::FileUnderと、他のモジュールのように最新であると通知されるのではなく、奇妙にインストールされます。

これは私のサブクラスGMailMIMEParserです:

package GMailMIMEParser;

use strict;
use MIME::Parser::FileUnder;

our @ISA = qw(MIME::Parser::FileUnder);

my $cur = 0;

sub output_path
{
    my $class = shift;
    my $head = shift;
    print(STDERR $head);
    $cur++;
    return "./$cur";
}

前もって感謝します!

4

1 に答える 1

0

私は単に間違ったことをしていました。I have to subclass MIME::Parser::Filerand not MIME::Parser::FileUnder、それ自体がMIME::Parser::Filerサブクラスです。

package GMailMIMEParser;

use strict;
use MIME::Parser::Filer;

our @ISA = qw(MIME::Parser::Filer);

my $cur = 0;

sub output_path
{
    my $class = shift;
    my $head = shift;
    print(STDERR $head);
    $cur++;
    return "./$cur";
}
于 2013-03-23T21:04:36.540 に答える