perlbrew custom folder for libs - perl

When I use
perlbrew lib create testlibs
to have a folder to store test libraries from CPAN, it creates a folder under the following path:
$HOME/.perlbrew/libs/perl-5.32.0#testlibs/lib/perl5
How can I tell perlbrew to store the libs folder ( perl-5.32.0#testlibs ) under a different folder such as /opt/perl5/libs, etc.?
I have very little disk space for home mountpoint on my server, so I need libs folders to be created on a different mountpoint. I already have PERLBREW_ROOT set to a different mountpoint, but that only makes perlbrew install new perl installation folders under it. It doesn't do it for the libs folders, which was surprising.
I already read the documentation and googled the hell out of this, but I can't find some env variable I can use to tell perlbrew where to install libs folders.
I know I can manipulate locallib env variables and even use lib on my scripts to point to some other folder, but it would be nice to have this all included within perlbrew.

Related

why there is lib and bin in dart projects

I've been using dart projects in order to practice dart programs and wondered why there are two folders bin and lib both can contain dart files.
I did some research about this and they said bin folder is for creating console application but that didn't help me. I don't have a clear idea about console application.
and why should I bother about these folder if I'm only using dart projects just for practicing dart language?
The bin folder is where you put the public entrypoints for your project to compile it to executable binaries for console applications.
If you are just practing dart code, you can leave it there and just use the lib folder. Just make sure you'll have a file inside bin with the same name as the project/package you created (defined in pubspec.yaml) and a main() function, so you can use dart run.
The lib folder is for all the other code you write. You can add in there all your classes files of your project as a additional code to be called by the files from the bin folder. Or you can use just the lib folder to write a package/library for other apps, without needing to have a bin folder.
But the bin folder can have a file for each command, with a main() inside each file.
For example, you could have in it bin/sum.dart and bin/subtract.dart. Then you can compile each to a executable binary (sum.exe and subtract.exe) to use it as a command-line/console program.
To run each file without compiling just use dart run :COMMAND (in the example above, dart run :sum).
If you want to know more about it, see the documentation explaining how to compile and how to write a package that has a command-line tool

Accessing Data Resources for Python Poetry Based Packages

I recently started experimenting with Poetry for package and dependency management, and I am still getting used to the differences between it and my experience with setuptools. Specifically, I would appreciate help in understanding how to handle the following scenario.
I have a data file that I want to bundle with my package stored in a package subdirectory. Using setup.py I would specify the file and directory names in the setup.py file and then access the file in my code using the pkg_resources API.
What is the equivalent approach using Poetry and pyproject.toml?
Unlike setuptools poetry bundles automatically all files within your package folder into your package, unless you haven't explicit excluded them in your .gitignore or the pyproject.toml.
So after the package is installed, you can access them with pkg_resources.
You could still use setuptools's pkg_resources.
You could also use one of those from Python's own standard library:
https://docs.python.org/3/library/pkgutil.html#pkgutil.get_data
https://docs.python.org/3/library/importlib.html#importlib.resources.read_binary

PowerShell Module not Discovered

I have a PowerShell module that I have created and is installed in the WindowsPowerShell\Modules path. I can auto-discover the module if it installed in the root of the module folder, example WindowsPowerShell\Modules\NewModule, however if I create a sub-folder in the module folder, the module is not long auto-discovered, example WindowsPowerShell\Modules\NewModule\1.0.
Why would the module stop being auto-discovered by adding the module and manifest to a sub-folder in the Module folder? I have plenty of modules using this structure that auto-discover fine. Thank you!
Regarding why the others are working, I'm guessing it's how PS installed the module depending on where it's sourced from (i.e. modules installed from PSGallery typically are in a version subfolder). Per the MS docs on installing modules though, the parent module folder should be directly in your module path in order for it to be recognized correctly as a module:
https://msdn.microsoft.com/en-us/library/dd878350(v=vs.85).aspx
That being said, if you're creating modules and storing them all in a subfolder in your PSModulePath, you should be fine just updating your PSModulePath environment variable to include that subfolder as well. Once done, reload your PS session and retry your import.

how do I import a CPAN module using XS into my project?

My company has policies against using Perl modules which are not in Debian/Ubuntu's repositories. To "import" a non-xs module into my project/repo, it's usually just a matter of copying over the .pm files and putting them in the appropriate directory in lib/. Then I can use as if I'd cpan installed it.
But what do I do for an XS module? How do I "pre-compile" and to where should I copy over the .so and other XS related files? If you look, for example, at Ubuntu's DBD-SQLite package contents here, it seems like it should definitely be possible.
You should look into dh-make-perl for making .deb packages of your perl modules. That way you can install them like a regular shipped module.
You should also read Building Debian packages of Perl modules

how to make sbt portable?

what I wanted to do is to make the sbt portable, at least portable among different Windows machines, so that my sbt plugins, settings, ivy repo, etc. don't have to be setup again on every computer.
my approach is to put the sbt.bat, sbt-launcher.jar and all its required directories, like .sbt, plugins and .ivy into a folder to be synced by Dropbox or likes
I have successfully changed the boot/ivy directory by using -Dsbt.boot.directory -Dsbt.ivy.hom in command line for sbt-launch.jar, but I can't find the same for plugins or the whole .sbt folder.
finally I tried Sandro's solution, so far it seems working~~
You can use http://code.google.com/p/symlinker/ to create a Symbolic link to the .sbt folder in your Dropbox directory. That way, Dropbox will see the .sbt folder inside its own directory, while the "actual" folder will still be in the default location.