Installing Perl in VSCode - perl

I am trying to go back in time a little and play around with Perl once again. I have a Mac and VSCode installed and did the following:
brew install perl to install perl
this installs perl at /opt/homebrew/bin/perl and perl --version returns "This is perl 5, version 34, subversion 0 (v5.34.0) built for darwin-thread-multi-2level"
cpanm Perl::LanguageServer to install the language server
and in VSCode I install the Perl extension by Gerald Richter (v2.3.0)
However, when I open create a new text file and set Perl as the file's language, I get the following error message:
ListUtil.c: loadable library and perl binaries are mismatched (got handshake key 0xc700080, needed 0xfb80080)
[Info - 12:52:54 PM] Connection to server got closed. Server will restart.
ListUtil.c: loadable library and perl binaries are mismatched (got handshake key 0xc700080, needed 0xfb80080)
[Info - 12:52:54 PM] Connection to server got closed. Server will restart.
ListUtil.c: loadable library and perl binaries are mismatched (got handshake key 0xc700080, needed 0xfb80080)
[Info - 12:52:54 PM] Connection to server got closed. Server will restart.
ListUtil.c: loadable library and perl binaries are mismatched (got handshake key 0xc700080, needed 0xfb80080)
[Info - 12:52:54 PM] Connection to server got closed. Server will restart.
ListUtil.c: loadable library and perl binaries are mismatched (got handshake key 0xc700080, needed 0xfb80080)
[Error - 12:52:54 PM] Connection to server got closed. Server will not be restarted.
FOLLOW-UP:
In the meantime I uninstalled homebrew perl (brew uninstall perl), and rely on the already installed /usr/bin/perl ("This is perl 5, version 30, subversion 3 (v5.30.3) built for darwin-thread-multi-2level").
Using this version, I could install the language server and get it to run in VSCode. All I needed to do is select "File"->"Save Workspace As" to assign the ${workspace} variable of VSCode.
However, now I run into a new problem, as when I press F-5 (Run), I get the following error message:
Can't locate Perl/LanguageServer/DebuggerInterface.pm in #INC (you may need to install the Perl::LanguageServer::DebuggerInterface module) (#INC contains: /Library/Perl/5.30/darwin-thread-multi-2level /Library/Perl/5.30 /Network/Library/Perl/5.30/darwin-thread-multi-2level /Network/Library/Perl/5.30 /Library/Perl/Updates/5.30.3 /System/Library/Perl/5.30/darwin-thread-multi-2level /System/Library/Perl/5.30 /System/Library/Perl/Extras/5.30/darwin-thread-multi-2level /System/Library/Perl/Extras/5.30).
BEGIN failed--compilation aborted.
The library in question in ~/perl5/lib/perl5/Perl/LanguageServer. I assume I would have to add this directory to the module search path of VSCode - however not sure how.
FOLLOW-UP 2:
The module path can be added in the settings.json file belonging to the module. To get there click on "Perl" in the lower right corner of VSCode, and select "Configure 'Perl' based language settings" in the menu that pops up. This opens the settings.json file.
Once there, add the following line:
"perl.perlInc": [ "/Users/divingtobi/perl5/lib/perl5" ],
and you should be good to go. For some reason it has to be the full path, and ~/ is not interpolated.

On OS/X 12.6:
open cpan
cpan[1]> force install AnyEvent::IO (ignore warnings)
cpan[2]> force install Coro (ignore warnings)
cpan[3]> install Perl::LanguageServer
start VSC
install perl extention
have fun with perl & VSC

Related

LaTeXindent fail in VSCode: Can't locate Log/Log4perl.pm

I'm using LaTeX Workshop on VSCode to build pdf using LaTeX and I'm getting this error in the Output console when I save the .tex file.
Formatting with command latexindent
-c,d:path_to_folder,d:path_to_folder/__latexindent_temp.tex,-y=defaultIndent:
' '
Formatting failed with exit code 2
stderr: Can't locate Log/Log4perl.pm in #INC (you may need to install the Log::Log4perl module) (#INC contains: C:/Program Files/MiKTeX/scripts/latexindent C:/Perl64/site/lib C:/Perl64/lib) at C:/Program Files/MiKTeX/scripts/latexindent/LatexIndent/LogFile.pm line 22.
The problem is only related to the formatting stuff because the build runs successfully generating the pdf as supposed.
What I did:
Opened the CPAN Client of my Windows 10
Run install Log::Log4perl (it installed also other packages like Log::Dispatch::File and
YAML::Tiny)
Rebooted the system
Checked that Log4perl is installed and it is
I also tryied to install Log4perl through VSCode cmd but I'm getting this wierd error:
Running make for E/ET/ETJ/Log-Log4perl-1.53.tar.gz
to undefined at C:/Perl64/site/lib/ExtUtils/Install.pm line 141.
make: *** [pm_to_blib] Error 255
ETJ/Log-Log4perl-1.53.tar.gz
"C:\Program Files (x86)\GnuWin32\bin\make.exe" -- NOT OK
Failed during this command:
ETJ/Log-Log4perl-1.53.tar.gz : make NO
Any suggestions?
I figured it out in the end! To solve the error do:
Download latexindent.exe
Edit Latex-workshop › Latexindent:
Path in the Latex Workshop VSCode extension settings with the
latexindent.exe path

How to install dmake with perl?

Can someone please tell me how to download dmake with Perl?
I have tried with CPAN, but this is what I get:
cpan> install dmake
Database was generated on Wed, 10 Jul 2019 10:13:05 GMT
Running install for module 'dmake'
'" "' is not recognized as an internal or external command,
operable program or batch file.
Checksum for C:\STRAWB~1\cpan\sources\authors\id\S\SH\SHAY\dmake-4.12.2.2.zip ok
Scanning cache C:\STRAWB~1\cpan\build for sizes
............................................................................DONE
Package contains both files[ChangeLog COPYING dmake.exe META.yml NEWS PATCH.TXT README.TXT] and directories[man readme startup]; not recognized as a perl package, giving up
Configuring S/SH/SHAY/dmake-4.12.2.2.zip with Makefile.PL
Running make for S/SH/SHAY/dmake-4.12.2.2.zip
gmake: *** No targets specified and no makefile found. Stop.
SHAY/dmake-4.12.2.2.zip
C:\STRAWB~1\c\bin\gmake.exe -- NOT OK
Stopping: 'install' failed for 'dmake'.
Failed during this command:
SHAY/dmake-4.12.2.2.zip : writemakefile NO -- Package contains both files[ChangeLog COPYING dmake.exe META.yml NEWS PATCH.TXT README.TXT] and directories[man readme startup]; not recognized as a perl package, giving up
I have also tried with ppm install dmake, but I got this:
Installing package 'dmake'...
Error installing package 'dmake': Could not locate a PPD file for package dmake
Not answering the question because it's a XY problem, but giving you the info you need.
The most recent mod_perl2 compiled for Strawberry is against Perl 5.12, which is long out of support. Using any other version of Perl is not going to work. You should ask ApTest to update and recompile for a current Strawberry and release a new setup_spmp helper. They are relying on a dead piece of tech (mod_perl2), so they should either support the required dependency properly or move their application onto a modern stack.

Perl Net-SSLeay installation on AIX

When running make test for Net-SSLeay, this error is repeated.
Failed test 'use Net::SSLeay::Handle;'
at t/handle/local/05_use.t line 8.
Tried to use 'Net::SSLeay::Handle'.
Error: Can't load '/ld01/perlsrc/Net-SSLeay-1.85/blib/arch/auto/Net/SSLeay/SSLeay.so' for module Net::SSLeay: rtld: 0712-001 Symbol EVP_DigestInit was referenced
from module /ld01/perlsrc/Net-SSLeay-1.85/blib/arch/auto/Net/SSLeay/SSLeay.so(), but a runtime definition
of the symbol was not found.
System is running AIX 7.1 Perl 5.24.4 and openssl 1.0.2o all compiled with gcc 6.3 (64-bit)
Has anyone seen this error before?
The problem was with our installation of openssl 1.0.2o. It was built as 32-bit. We fixed it by rebuilding it with exporting OBJECT_MODE=64 before running config and make commands.
The sequence was as follows:
for openssl
export OBJECT_MODE=64
config -- make -- make test -- make install
For Net-SSLeay
export OPENSSL_PREFIX=/usr/local/ssl (where openssl installed on our system)
perl Makefile.PL -- make -- make test -- make install
That got Net-SSLeay installed correctly.

Why does Perl module Crypt::SSLeay give an error upon loading?

I am trying to get WWW::Mechanize to login to Yahoo using https; however, it requires the use of Crypt::SSLeay for sending over https.
Crypt::SSLeay installed succesfully, and openssl was already installed on the system.
However, it gives the error upon loading:
Can't load '/home/gen19/perl5/lib/perl5/lib/site_perl/5.10.1/i686-linux//auto/Crypt/SSLeay/SSLeay.so' for module Crypt::SSLeay: /home/gen19/perl5/lib/perl5/lib/site_perl/5.10.1/i686-linux//auto/Crypt/SSLeay/SSLeay.so: undefined symbol: PL_sv_undef at /usr/lib/perl5/5.8.0/i386-linux-thread-multi/DynaLoader.pm line 229.
at /home/gen19/lwp4 line 15
Compilation failed in require at /home/gen19/lwp4 line 15.
BEGIN failed--compilation aborted at /home/gen19/lwp4 line 15.
The installation of Crypt::SSLeay was successful, and could recognize the installation of openssl (here):
perl Makefile.PL
=======================================================
Only one OpenSSL installation found at /usr
Consider running 'perl Makefile.PL --default' the next
time Crypt::SSLeay is upgraded to select this directory
automatically thereby avoiding the following prompt.
=======================================================
Which SSL install path do you want to use? [/usr] /home/gen19/ssldir
BUILD INFORMATION
================================================
ssl library: OpenSSL 0.9.8 in /home/gen19/ssldir
ssl header: openssl/ssl.h
libraries: -L/home/gen19/ssldir/lib -lssl -lcrypto -lgcc
include dir: -I/home/gen19/ssldir/include/openssl -I/usr/kerberos/include
================================================
Note (probably harmless): No library found for -lgcc
Writing Makefile for Crypt::SSLeay
The test suite can attempt to connect to public servers
to ensure that the code is working properly. If you are
behind a strict firewall or have no network connectivity,
these tests may fail (through no fault of the code).
Do you want to run the live tests (y/N) ? [N]
NOTE: recently installed Perl v5.10.1 using App::perlbrew, due to LWP::UserAgent's needing it. I installed Crypt::SSLeay using my new version of Perl.
I don't have root priveldiges, as I am doing this on a remote server at school. Please tell me why it's giving the error even though it installed succesfully. I know it has something to do with the shared libraries, but the installation recognized them.
SIDE NOTE: my script works fine if I don't say "use Crypt::SSLeay;" at the start, but it gives the error when I use https that it's not a supported protocol, and needs LWP::protocol::https installed. Installing that always fails.
EDIT: Thanks for your help, CJM. Apparently it was using the old version of Perl when I executed, but now I've fixed that.
It doesn't give that error anymore; however, it still says
Error GETing https://login.yahoo.com/config/login_verify2?&.src=ym: Protocol scheme 'https' is not supported (LWP::Protocol::https not installed) at lwp4 line 14
I thought Crypt::SSLeay was supposed to take care of this.
If you examine the error message, you'll notice it mentions both 5.10.1 and 5.8.0 (in the Perl library paths). This indicates that you're trying to use a module built for one version of Perl with a different version. XS-based Perl modules (i.e. ones that include C code) are not binary compatible between major releases of Perl.
It appears you installed Crypt::SSLeay using Perl 5.10.1, and are trying to use it with 5.8.0. That won't work. Use only Perl 5.10.x with that installation. If you need to use it with Perl 5.8.0 also, install another copy in a different directory.

Why can't DynaLoader.pm load SSleay.dll for Net::SSLeay and Crypt::SSLeay?

I have Perl v5.10. I am trying to install Net::SSLeay 1.30 and Crypt::SSLeay 0.57.
I have already installed OpenSSL 0.9.8e.
For Net::SSLeay 1.30 I followed these steps:
perl Makefile.PL -windows C:\openssl
nmake
nmake test -- test fails
nmake install
perl test.pl
but I got an fatal error as:
D:\perl\Net_SSLeay.pm-1.30>perl -w test.pl
1..20
Can't load 'D:/perl/site/lib/auto/Net/SSLeay/SSLeay.dll' for module Net::SSLeay: load_file:The specified module could not be found at D:/perl/lib/DynaLoader.pm line 203.
at test.pl line 25
Compilation failed in require at test.pl line 25.
BEGIN failed--compilation aborted at test.pl line 25.
I got the same results for Crypt::SSLeay 0.57.
Randy Kobes has an answer for this on the Perl Win32 mailing list. Does your PATH environment variable contain the directory that contains libeay32.dll or ssleay32.dll?
There are many other answers that you can find in Google too. In cases like these, I take the whole error message and shove it into the Google search bar. I start cutting out parts of the error message, such as the specific paths, until I get some search results. This almost always works for me since I'm rarely the first person to have a problem.
Shared libs often have external dependencies, and on some operating systems those dependencies need to be immediately fulfilled when the first shared library is loaded, like your SSLeay.dll, which usually needs the two crypto libs. On linux you can check with ldd the run-time behavior, if all libs are found.
To debug this add the env var PERL_DL_DEBUG=5, like set PERL_DL_DEBUG=5 and try again or use the external tool depends.exe to see what dll's exactly are missing.
I had a similar problem with Windows Par::Packer. The resulting myprogram.exe had trouble loading rurban's hint with PERL_DL_DEBUG
Can't load 'temp\7e717f68.xs.dll' for module Crypt::SSLeay: load_file:Das angegebene Modul wurde nicht gefunden at <embedded>/DynaLoader.pm line 193.
at <embedded>/PAR/Heavy.pm line 95.
I was not able to find out which dlls to include with pp. After these hints I was simply looking to the dll-file with a hex editor and found this string: libgcc_s_dw2-1.dll - this was the dll to include into my "compiled" exe-program:
pp -M Crypt::SSLeay ^
-l c:/strawberry/perl/vendor/lib/auto/Crypt/SSLeay/SSLeay.xs.dll ^
-l c:/strawberry/c/bin/libgcc_s_dw2-1.dll ....
I'm having this same problem with a fresh install of Strawberry Perl 5.30. Googling the error just gives a bunch of unanswered, or half answered questions. Rurban is pointing in the right direction with using depends.exe. Opening ssleay.xs.dll and waiting for it to finishing throwing errors shows 5 main dll's that it depends on. 2 of which are windows core dll's, and 3 from openssl and perl. In the strawberry install, the 2 dll's related to crypto are in the [perlinstallpath]\c\bin folder. Add this to your windows %PATH% variable and it will start working.