How does ActiveState's PPM generate HTML and where does it store it? - perl

I'm using ActiveState Perl 5.22.3 currently and have that installed system wide, while I want to install additional packages using PPM per user only. This works after setting PERL5LIB e.g. to the path C:/Users/[...]/AppData/Roaming/Perl/x64/Current/lib and selecting that directory in the GUI of PPM as the target for installations. What doesn't seem to work is generation of HTML documentation from the installed packages.
The system wide installation folder of Perl contains a html directory with lots of docs with what got installed by default and using Process Monitor I can see that PPM tries to delete the file perltoc.html from that folder. After giving my user permissions to change contents of that directory, that file is recreated, but it doesn't contain any hints to newly installed packages of PPM. Without changing permissions, PPM logs the following error:
2020-02-03T18:57:54 <4> [ppm.bat:26] Can't open 'C:\Program Files\Perl\Current\html/perltoc.html': Permission denied at C:/Program Files/Perl/Current/lib/ActivePerl/DocTools.pm line 36.
That's why I thought that PPM might simply stop too early and doesn't provide HTML successfully. But things doesn't seem to be so easy and there's another HTML-folder in my user profile containing directories for all installed packages already:
C:\Users\[...]\AppData\Roaming\Perl\x64\5.22.3\html\site\lib
The problem is that this thing doesn't contain any files. Looking at Process Monitor, I'm not even sure if PPM generates HTML files at all, even though my packages contain POD-files: PPM is working in temporary directories for each package to install and those contain html-folders and PPM iterates the contents of those, but they seem to be empty. Process Monitor doesn't log any found files and PPM doesn't attempt to copy any individual file at all, even though it logs a copy process:
[InstallArea.pm:362] Installing AAAAAAAAA with id 91
[InstallArea.pm:369] Copy C:\Users\[...]\AppData\Local\Temp\ppm-eYtrkD/AAAAAAAAA-1.01/blib/html --> C:/Users/[...]/AppData/Roaming/Perl/x64/Current/html
[InstallArea.pm:369] Copy C:\Users\[...]\AppData\Local\Temp\ppm-eYtrkD/AAAAAAAAA-1.01/blib/lib --> C:/Users/[...]/AppData/Roaming/Perl/x64/Current/lib
So, how should PPM work regarding HTML-docs at all? How does it decide when to generate that, where does it generate that and where does it put it? I couldn't find much docs about how things should work by default.
Thanks!

Related

How can you run a config script when installing a perl module?

I've been searching for a couple of hours and I'm coming up empty trying to find a solution. I'm using Dist::Zilla. I have a module that uses a simple config file in .ini format located in the module's share/ directory. When my module is installed, I'd like the install script to prompt the user for configuration options and save the user's options in the config file. Then, using File::UserConfig, it will copy the file over to the user's configuration directory where it can be loaded by the module when it runs.
Someone had suggested the Dist::Zilla::Plugin::MakeMaker::Custom module but I know next to nothing about MakeMaker and how I might write a custom one to kick off the configuration script.
I'm surprised I can't find anything that makes this easy to do. Perhaps I'm searching on the wrong keywords?
You had discussed this in IRC, and the gist is:
You cannot rely on the installation process allowing any interaction, as a large amount of installations are via cpanm which is non-interactive and hides output from Makefile.PL by default. This is because users don't like having to configure things, and as an example, a Carton deployment is frequently non-interactive by its nature. You can allow configuration via environment variables recognized by your Makefile.PL to get around this.
You can document to install using the --interactive option for cpanm in order to respond to prompts in your Makefile.PL, injected into the generated file using the [MakeMaker::Awesome] plugin.
You can include a script with the distribution that will set up the configuration so the user can do it themselves separate from the installation.

Installing cpan or cpanm modules on a behind-firewall machine with no Internet connection

I've already read related threads like these, but they do not fully capture our situation.
This is on a firewalled machine. No net access. We can ftp files to folders and install modules from there.
We have CHMOD 777 for our users on some folders. We can install Perl modules if we locally build them by downloading the relevant .pm files. But when these files cannot install, we do not have any cpan or cpanm.
I'd like to install, for example, HTML::Restrict. If I do the download + install thing, the Restrict.pm gives me this error:
/lib/HTML/Restrict.PM:328: Unknown command paragraph "=encoding UTF-8"
Reading a bit online suggests that this could be an old Perl problem. We use 5.8.x. Our own dev machines have the luxury of 5.16.x and internet access so installing module is a cinch. Anyway, one of my older machines also has 5.8.x, and installing the module via cpanminus worked there (with internet).
So, question: is it possible to install "cpanminus" (cpanm) through FTP, then upload specific module files to the server through FTP too, and then go into shell and install modules via cpanm by pointing it to respective .pm files?
Thank you for any pointers.
You should take a look at perldoc perlmodinstall which goes into detail about how to install a module from its distribution. It follows what should be a familiar incantation
Decompress
Unpack
Build
Test
Install
Assuming you're on a Linux system, this commonly takes take the form of
gzip -d My-Module-Distribution.tar.gz
tar -xof My-Module-Distribution.tar
perl Makefile.PL
make
make test
make install
But after the Unpack stage you will often find a README file or other text file that will describe any unusual steps to be taken
Clearly some of these steps can be combined. For instance, most people will probably want to use
tar -xvfz My-Module-Distribution.tar.gz
to avoid having to invoke gzip separately. Likewise, the make system will force a build phase as a prerequisite if you use just
make test
without the preceding make
The linked document has a lot to say about how to install on other platforms, should you not be running a Linux variant
I still don't really understand your thinking, but you can get a stand-alone version of cpanm using curl. For instance
curl -sS --location https://cpanmin.us/ --output cpanm
then you should be able to just copy it to your target machine, put it on your PATH, and do
cpanm HTML-Restrict-2.2.2.tar.gz
but I doubt if you will find any change to the specific errors you are getting

unable to run php cli from the command line when xampp portable is installed in another drive

I have installed a xampp portable package on my drive D, added the php folder path inside it on the system environment so I would be able to run php basically anywhere from the command line. but when i try to check if its working by executing the "php -v" command, it runs but i get this following error/warning messages.
"Warning: PHP Startup: Unable to load dynamic library 'xampp-portable\php\ext[:any].dll - The specified module could not be found."
*the [:any] there just means some dll filename.
and i get a lot of that warnings with just varying dll filenames,
anyway, here's the catch. when i do change my current path in the command line to somewhere in drive D, and then run the same command "php -v" it runs smoothly.
so what configuration should i do to fix this problem?
by the way, i do the same with mysql, putting its bin directory path on the system enviroment, run it in both inside drive C and drive D. and it runs smoothly. so i guess this problem is only on php.
I've posted the same question in xampp forums and this is the answer that was given to me. I'll be quoting the answer as it was and give credit to the one who answere it.
XAMPP is very proud that it don't have to set any environment
variables or registry values.
What you want to do is not possible with XAMPP portable without
mapping to a specific Drive letter. All configurations in xampp
portable have relative paths, so if you want to use cli from a
different drive letter, php can be executed, but all extensions of
them throw errors.
I would install the full version of XAMPP, map it to the current drive
letter with help of the setup_xampp.bat file and use the XAMPP control
panel Shell instead of default command line (advantage: The XAMPP
control panel shell sets local include paths to the needed XAMPP
folders).
Works for me (i can even use pear, git, composer, and other cli
scripts with the Xampp Shell if correct integrated).
best wishes, Altrea
credits to Altrea
Open your php.ini file, replace all relative paths to absolute paths. Eg: \xampp\ to C:\xampp\

dpan does not find Perl module in package root

We use MyCPAN::App::DPAN (Version 1.28) just like in Question: How can I manage Perl module dependencies?
This works quite well in general. But we ran into troubles with some specific packages:
As expample DBD::Oracle does not have their main *.pm file in DBD-Oracle-1.27/lib/DBD/Oracle/Oracle.pm but in DBD-Oracle-1.27/Oracle.pm.
It seems that dpan does not find this *.pm file, since it is not listed in modules/02packages.details.txt.gz. Whereas DBD::Oracle::Object (other Perl-Module of this distribution, but located DBD-Oracle-1.27/lib/DBD/Oracle/) is listed there.
In dpan.conf we only have set the recommended values:
dpan_dir /some/dir
indexer_id Me
pause_full_name The Admin Team
pause_id TAT
system_id my system id
Other Packages with the same problem:
Apache::DB
Packages that work:
Crypt::Blowfish (no extra modules)
Math::Round (no extra modules)
XML::Twig (no "lib" dir, but extra modules)
Does someone have any tips/hints?
DPAN works by indexing the distributions and storing the results in a file in the indexer_reports directory. As a workaround until I can investigate your problem, you can just edit the report it created for the problem distributions. As long as you haven't set fresh_start in your configuration, it will use the cached report which you have edited to add the missing module.

I'm confused about installing WWW::Curl for Perl in Cygwin

I have already installed Perl and libcurl using Cygwin's package manager. Now, I'm trying to install WWW::Curl. I have to specify the cURL include directory in WWW::Curl's Makefile.PL, but I have no idea where to look for this. Thanks for your time.
It will try to guess automatically. If it does not work, see the README.
P.S. LWP is more convenient to use.
edit: Using your package managers own packages is often preferred when using your system perl, cygwin has a package for perl-WWW-Curl, install this package rather than building your own.
Most likely I think you are missing the libcurl-devel package. Although you mention that libcurl is installed, please ensure that libcurl-devel is installed via the cygwin package management application, and try again if required.
WWW:Curl will search for the correct include path, looking for curl/curl.h, if it cannot find the file then it might be looking in the wrong places, you'll have to do a manual install:
download and unpack the package from cpan
read the included README file to understand this process
search your cygwin installation for a file called curl/curl.h note the directory that it is in.
modify the Makefile.PL so that #includes has the directory noted above included.
run perl Makefile.PL
run make && make install
This process is essentially the same problem as the process for a native Win32/strawberry perl install, in that it doesnt know where libcurl is located. you can check the README.Win32 file for similar instructions.
The libcurl-devel package installs the curl/curl.h file to usr/include/ which is a path that is already searched by Makefile.PL.
To however you say you have no idea where to look, locate the curl.h you can do the following:
find / -name curl.h
But be warned this could take a long time, you could try specific locations such as /usr
find /usr -name curl.h
Or even better you can look at the package contents to find the file location:
https://cygwin.com/cgi-bin2/package-cat.cgi?file=x86%2Flibcurl-devel%2Flibcurl-devel-7.41.0-1&grep=libcurl
To echo Alexandr's answer, LWP is more convenient to use cross platform, while covering the same features, it can also do a lot more.