Perl error when using Tkx package - perl

I have a problem with the Tkx package. I use Perl 5.14.2 on CentOS, and I know that this version of Perl basically contains the Tkx package. When I try to get the version of Tkx (with the following code snipet)
perl -MTkx -e 'print Tkx::info("patchlevel");'
And I get the following error message:
couldn't load file "/tmp/tclpWVq4S": libXss.so.1: cannot open shared object file:
No such file or directory at -e line 0.
Compilation failed in require.
BEGIN failed--compilation aborted.
I searched for a sollution but I didn't find answer for it. Can anyone tell me what's going on here?

Related

Running perl test in intellij: Can't load module PassEnv at

I want to created perl modules in intellij derived by Tests. I created following test in a new project as shown below
#!/usr/bin/perl
use strict;
use warnings;
use Test::More;
done_testing();
But when i am trying to run the test (Shift+Alt+F10), it fails with below error
Testing started at 10:51 ...
C:/Strawberry/perl/bin\perl.exe C:/Strawberry/perl/bin/prove.bat -PPassEnv --formatter TAP::Formatter::Camelcade --merge --recurse --jobs 1 D:/workspace/code/repo/Modules/ImageUtilities/ReaConverterTest.t
Can't load module PassEnv at C:/Strawberry/perl/bin/prove.bat line 26.
Process finished with exit code 2
But when I run the test from the command line it works fine
$ perl -w ReaConverterTest.t
1..0
I see that there was an issue reported with intellij perl plugin(https://github.com/Camelcade/Perl5-IDEA/issues/1966) but it is closed. Looks like it was fixed in 2019.1 Perl but I am clueless why it's failing for me.
Any idea on how to fix this?
PS: I am using Git-Bash to run Perl scripts, IntelliJ using strawberry Perl installation on windows as Perl interpreter.
Update
When i run the script by adding "use PassEnv" it fails as there is no such module Searching from intellij also results in "no such module"
perl -w ReaConverter.t
Can't locate PassEnv.pm in #INC (you may need to install the PassEnv module) (#INC contain
s: /usr/lib/perl5/site_perl /usr/share/perl5/site_perl /usr/lib/perl5/vendor_perl /usr/sha
re/perl5/vendor_perl /usr/lib/perl5/core_perl /usr/share/perl5/core_perl) at ReaConverter.
t line 6.
BEGIN failed--compilation aborted at ReaConverter.t line 6.
Because of the -PPassEnv option used, prove attempts to load App::Prove::Plugin::PassEnv. It hasn't been installed. Simply install the module.
Note: You want to install it using Strawberry Perl, so the following appears to be the appropriate command from your preferred shell:
/c/Strawberry/perl/bin/cpanm App::Prove::Plugin::PassEnv

Installing cURL modules for Perl on Windows

I have ActivePerl 5.14.2 on my Windows machine. I have been trying to install the LWP cURL module. I have already installed the libcurl-dev library and GCC on my machine.
I also understand that LWP cURL has a dependency on the WWW-Curl-Easy module. So I installed that too. I installed all these through the command lines using the steps given in the Readme files. I ran the perl makefile.pl command followed by a make and a make install. No errors were given out during the installation.
I am trying to execute this sample code to test my LWP cURL installation:
use LWP::Curl;
use strict;
use warnings;
my $lwpcurl = LWP::Curl->new();
my $content = $lwpcurl->get('http://search.cpan.org','http://www.cpan.org');
I am receiving the below error:
Can't locate loadable object for module WWW::Curl in #INC (#INC
contains: C:/Perl64/site/lib C:/Perl64/lib .) at
C:/Perl64/site/lib/WWW/Curl.pm line 11. BEGIN failed--compilation
aborted at C:/Perl64/site/lib/WWW/Curl.pm line 11. Compilation failed
in require at C:/Perl64/site/lib/WWW/Curl/Easy.pm line 9. Compilation
failed in require at C:/Perl64/site/lib/LWP/Curl.pm line 5. BEGIN
failed--compilation aborted at C:/Perl64/site/lib/LWP/Curl.pm line 5.
Compilation failed in require at D:\Varsha\Curl.pl line 1. BEGIN
failed--compilation aborted at D:\Varsha\Curl.pl line 1.
Where am I going wrong?
This is probably not the direction you want to go, but I'd advise you to consider upgrading your perl and changing distributions:
Install Strawberry Perl - 5.18.2.2 is the currently recommended version.
Install cpanm: perl -MCPAN -e "install App::cpanminus"
Install LWP::Curl: cpanm LWP::Curl
I won't bother trying convince you of the change, but Strawberry Perl and cpanm in combination make installing modules a lot easier than having to dealing with the proprietary ppm's of ActivePerl in my opinion.
Just something to consider if you ever get tired of the occasional headaches.
The error means that WWW::Curl is either not installed or its path is not searchable (it's not in #INC). So the solutions are
Make sure that the module is installed.
Add the path where the module is installed to the #INC. Since you are on Windows, you can use set PERL5LIB = c:\path\to\dir
For a permanent solution follow the below:
Right-click My Computer and click Properties.
In the System Properties window, click on the Advanced tab.
In the Advanced section, click the Environment Variables button.
In the Environment Variables window in the "User variables for Foo Bar" section click on New and type in the following:
Variable name: PERL5LIB
Variable value: c:\path\to\dir
Then click OK 3 times. Windows that you open after this will already know about the new variable. Type this in the command window, to see the newly set value:
echo %PERL5LIB%
This will add the private /home/foobar/code directory (or c:\path\to\dir directory) to the beginning of #INC for every script that is executed in the same environment.
Also see: Installing perl dependency automatically in perl

Can not install Apache2::Const module

I have installed Apache 2.2.25 with mod_perl 2.0.7 running on Debian 7.1.0. During its installation mod_perl had to install module named Apache2::Const, but it didn't. mod_perl have installed modules from the same group, e.g. Apache2::Access, Apache2::Connection, Apache2::RequestUtil.
So when I use this command (i /Apache2::Const/) in cpan shell it outputs following:
cpan[3]> i /Apache2::Const/
Module id = Apache2::ConstantsTable
CPAN_USERID PHRED (Fred Moyer <fred#redhotpenguin.com>)
CPAN_VERSION undef
CPAN_FILE P/PH/PHRED/mod_perl-2.0.8.tar.gz
UPLOAD_DATE 2013-04-18
INST_FILE (not installed)
And when I use this command (install Apache2::Const):
cpan[4]> install Apache2::Const
Warning: Cannot install Apache2::Const, don't know what it is.
Try the command
i /Apache2::Const/
to find objects with matching identifiers.
I've tried to run:
install Apache2::ConstantsTable
But it didn't help.
Also, when I run following script:
perl -e "use v5.14.2; use Apache2::Const"
it outputs:
Not a CODE reference at /usr/lib/perl/5.14/DynaLoader.pm line 207.
END failed--call queue aborted at /usr/local/lib/perl/5.14.2/ModPerl/Const.pm line 207.
Compilation failed in require at /usr/local/lib/perl/5.14.2/Apache2/Const.pm line 18.
BEGIN failed--compilation aborted at /usr/local/lib/perl/5.14.2/Apache2/Const.pm line 18.
Compilation failed in require at -e line 1.
BEGIN failed--compilation aborted at -e line 1.
I tried to install this module manually (via Makefile.PL) from mod_perl package. I also tried to reinstall mod_perl. Nothing helped.
All the other Apache2::* modules works correctly.
I really need to install Apache2::Const module. Thanks for your replies.
Solved long time ago by installing all this stuff from debian package. I was hard noob in linux when I posted the question.

Can't locate LWP/Simple.pm in #INC [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
What's the easiest way to install a missing Perl module?
I'm attempting to run a Perl script to convert SCXML to Graphviz DOT. I modified the first line of the script to:
#!/usr/bin/env perl
and chmod +x the file. When I run it via ./scmxl2dot.pl I see the following error output:
Can't locate LWP/Simple.pm in #INC (#INC contains: /opt/local/lib/perl5/site_perl/5.12.3/darwin-multi-2level /opt/local/lib/perl5/site_perl/5.12.3 /opt/local/lib/perl5/vendor_perl/5.12.3/darwin-multi-2level /opt/local/lib/perl5/vendor_perl/5.12.3 /opt/local/lib/perl5/5.12.3/darwin-multi-2level /opt/local/lib/perl5/5.12.3 /opt/local/lib/perl5/site_perl /opt/local/lib/perl5/vendor_perl .) at ./scmxml2dot.pl line 14.
BEGIN failed--compilation aborted at ./scmxml2dot.pl line 14.
Line 14 of the file is use LWP::Simple;
How do I:
Find out if I have this thing (module?) installed, and/or
Get LWP::Simple and make it available to the script?
This is running under OS X 10.7.3 and Perl 5.12.3 (as seen in the error).
You're already determined that you don't have it (somewhere it can be found).
perl -MCPAN -e'install "LWP::Simple"'
Execute the following from the command line:
perl -MLWP::Simple -e 1
If you don't get any output from the above command then the module is installed; if you get an error, it's not installed
to install use
perl -MCPAN -e'install "LWP::Simple"'
When perl encounters use My::Module it goes over the elements of the built-in #INC module that contains directory names. In each directory it check if there is a subdirectory called "My" and if in that subdirectory there is a file called "Module.pm".
check where LWP::Simple module is installed on your system and type below line just above the use LWP::Simple statement of your code.
use lib '/usr/local/module';
use LWP::Simple;
Take a look at the Perldoc webpage. This will tell you which modules are standard Perl modules and which ones aren't.
You can also use the perldoc command to find out if a Perl module is installed, and if it is, its documentation.
$ perldoc LWP::Simple
(If Perldoc doesn't execute as a command do ls -l /usr/bin/perl*. On Macs, some of the Perl commands don't have the execute bit turned on. To turn it on, do sudo chmod a+x /usr/bin/perl).
It just happens the LWP::Simple isn't a standard Perl module, and if you don't have it, you'll have to install it. Most people have already told you about cpan. Unfortunately, by default, the Mac doesn't have the needed command line development tools installed. You'll have to install them.
Once they're installed, you can use the cpan command to install LWP::Simple:
$ sudo cpan #Run cpan and configure it. It takes about 3 minutes
cpan> install LWP::Simple
cpan> exit

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.