2011-12-27 10 views
2

は、私はそのようなスクリプトを持っている:(Script.pl)Runtime.pmにOAuth.pmが見つかりません。ネット:: Twitterのモジュール

#!/usr/bin/perl 
use strict; 
use warnings; 
use encoding 'utf-8'; 
use FindBin; 
use lib "$FindBin::Bin/lib"; 
use TwitterModule; 
use IO::Prompt; 

# Read keys from file 
open KEYS, "<keys.txt" or die $!; 
my ($ckey, $csecret, $atocken, $asecret) = <KEYS>; 

# Auth 
my $nt = TwitterModule::auth($ckey, $csecret, $atocken, $asecret) ; 

# Other code skipped. 

と、このようなモジュール:(LIB/TwitterModule.pm)

package TwitterModule; 
use strict; 
use warnings; 
use utf8; 
use encoding 'utf8'; 
use base 'Exporter'; 
use Net::Twitter; 

BEGIN { 
    use Exporter(); 

    our $VERSION = '0.01b'; 
    our @EXPORT_OK = qw(&auth); 
    our %EXPORT_TAGS = (
     'functions' => [ qw(&auth) ] 
    ); 

    # add all the other ":class" tags to the ":all" class, deleting duplicates 

    my %seen; 
    push @{$EXPORT_TAGS{all}}, 
     grep {!$seen{$_}++} @{$EXPORT_TAGS{$_}} foreach keys %EXPORT_TAGS; 
} 

### Common variables ### 
# Make connection 
sub auth { 
    my ($ckey, $csecret, $atocken, $asecret) = @_; 

    my $cn = Net::Twitter->new(
     traits    => [qw/Oauth API::REST/], 
     consumer_key  => $ckey, 
     consumer_secret  => $csecret, 
     access_tocken  => $atocken, 
     access_token_secret => $asecret 
    ); 
    return $cn; 
} 

# Other code skipped 
# return true 
1 

その後、私は私のスクリプトを実行してもらいます"@INCには/ home/rasmi/work/my_project/lib/perl5/site_perl/usr/share/perl5/site_perlというNet/Twitter/Role/Oauth.pmはありません。 /usr/share/perl5/vendor_perl/Module/Runtime.pm行に/ usr/lib/perl5/vendor_perl/usr/share/perl5/vendor_perl/usr/lib/perl5/core_perl/usr/share/perl5/core_perl 205、line 4 /home/rasmi/work/my_project/lib/TwitterModule.pm line 6 "

Net :: Twitterと必要なすべてのユーティリティをインストールし、2台のマシンでテストしました。私がNet :: Twitterをモジュールなしで使用した場合、あるスクリプトですべてうまく動作します。ファイル/usr/share/perl5/vendor_perl/Net/Twitter/Role/Oauth.pmが存在します。

私はこの動作に非常に驚いており、助けに非常に感謝しています。

答えて

4

Net::Twitter::Role::OAuth - 大文字の「A」を綴っているようです。おそらく、大文字と小文字を区別するファイルシステムです。

はあなたのauthサブルーチン内で行修正:

traits    => [qw/OAuth API::REST/], 

をそして、それはおそらく作業を開始します。

+0

+1ニースキャッチ、ジョシュ。 – TLP

+0

私はOS X(大文字と小文字を区別しない)システム上で、私はMIME :: Base64 'Mime :: Base64'というスペルを書いていたので、昨日一ライナーで焼いてしまいました。 .pmはロードされていましたが、 'Mime ::'名前空間には何もありませんでした。だから、これを見つけるのは簡単でした:) –

+0

大文字小文字の区別は非常に簡単です。 – TLP

関連する問題