Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

cpan installing .3pm files?

by merlinsdemon (Novice)
on Jun 02, 2019 at 20:52 UTC ( [id://11100857]=perlquestion: print w/replies, xml ) Need Help??

merlinsdemon has asked for the wisdom of the Perl Monks concerning the following question:

Hello Experts,

I'm having the oddest experience. I tried installing:

cpanm Search::Elasticsearch

And it installed...something to that affect...

/Users/my_user/perl5/man/man3/Search::Elasticsearch.3pm

But of course, this file looks odd, at a minimum because I've never noticed a perl module ending in ".3pm" before.

My code can't find it:

my_user@merlinsdemon-mbp:~$ ./test.pl

Can't locate Search/Elasticsearch.pm in @INC (you may need to install the Search::Elasticsearch module) (@INC contains: /Users/my_user/perl5/man/man3/ /Library/Perl/5.18/darwin-thread-multi-2level /Library/Perl/5.18 /Network/Library/Perl/5.18/darwin-thread-multi-2level /Network/Library/Perl/5.18 /Library/Perl/Updates/5.18.4 /System/Library/Perl/5.18/darwin-thread-multi-2level /System/Library/Perl/5.18 /System/Library/Perl/Extras/5.18/darwin-thread-multi-2level /System/Library/Perl/Extras/5.18 .) at ./test.pl line 7.

My code looks like this:

#!/usr/bin/perl use strict; use warnings; use lib qw(/Users/my_user/perl5/man/man3/); print "Hello World\n"; use Search::Elasticsearch; # Connect to localhost:9200: my $e = Search::Elasticsearch->new(); $e->index( index => 'my_app', type => 'blog_post', id => 1, body => { title => 'Elasticsearch clients', content => 'Interesting content...', date => '2014-09-24' } ); 1;

What is going on with my installation dependencies?

Replies are listed 'Best First'.
Re: cpan installing .3pm files?
by choroba (Cardinal) on Jun 02, 2019 at 20:58 UTC
    3pm files are documentation files. The code should be installed somewhere else, typically in perl5/lib/perl5/. Adding the documentation path to @INC doesn't help.

    map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

      But adding it to env var MANPATH does help. (It makes man Search::Elasticsearch an option in addition to perldoc Search::Elasticsearch.)

      Thank you, that got me searching in the right direction! All good now. It was in /Users/my_user/perl5/lib/perl5
Re: cpan installing .3pm files?
by dsheroh (Monsignor) on Jun 03, 2019 at 13:10 UTC
    Even without knowing that .3pm indicates a man page, there's a pretty strong clue in that the full path of the file includes a .../man/... directory.

    As for why your code couldn't find the file to (try to) use it, note that the filename is Search::Elasticsearch.3pm, but the error message indicates that Perl was trying to find a module named Search/Elasticsearch.pm - use converts :: to /, while the filename contains a literal ::, in addition to the extension being different.

    Of course, if you really wanted to, you could pass the filename as a string (rather than a bareword) to require and get Perl to try to load it as a module that way, despite the literal colons and the extension... but it would still fail, because the file content is written in troff markup rather than Perl code and/or POD markup, so the result would be an ugly mess of syntax errors instead of working code:

    ~$ perl -E "require '/usr/local/share/man/man3/oo.3pm'" Bareword found where operator expected at /usr/local/share/man/man3/oo +.3pm line 2, near "*(C" (Missing operator before C?) String found where operator expected at /usr/local/share/man/man3/oo.3 +pm line 4, near ". ds C` "" (Missing semicolon on previous line?) String found where operator expected at /usr/local/share/man/man3/oo.3 +pm line 5, near ". ds C' "" (Missing semicolon on previous line?) String found where operator expected at /usr/local/share/man/man3/oo.3 +pm line 6, near ". ds L"" (Missing semicolon on previous line?) <...a few dozen more lines of the same omitted...> String found where operator expected at /usr/local/share/man/man3/oo.3 +pm line 22, at end of line (Missing semicolon on previous line?) Can't find string terminator '"' anywhere before EOF at /usr/local/sha +re/man/man3/oo.3pm line 22. Compilation failed in require at -e line 1.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://11100857]
Approved by Discipulus
Front-paged by haukex
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2024-04-26 04:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found