Category: The Perl Programming Language
-
how can I read a file from last line to first line on the Unix command line?
- https://stackoverflow.com/questions/48721344/how-can-i-read-a-file-from-last-line-to-first-line-in-shell
- https://www.man7.org/linux/man-pages/man1/tac.1.html – cat vs tac
$ perl -e 'print reverse <>' Input_file
There are also solutions in awk and sed – read the stackoverflow article for those solutions!
-
perl’s Text::CSV – on github – does not need compilation
Sometimes I need its CSV.pm and CSV_PP.pm on my NAS-s in order to link them into some perl installation.
-
today I ran into the “Tie::Hash::NamedCapture” problem again, and I decided to resolve it properly
I started experiencing this problem a while ago, I guess with some new Perl release “creeping” in. So far I have “resolved” this problem by choosing an older Perl version hanging around. Today on cygwin I installed “perl-debuginfo” – this won’t solve the problem on my other platforms, but at least I finally have a hook on the issue.
-
how do I encode UTF-8 characters into numeric character reference format (in Perl)?
- https://stackoverflow.com/questions/4752353/how-do-i-encode-characters-into-numeric-character-reference-format-in-perl
- https://stackoverflow.com/a/4753600/3119172
$ echo 'foobar' | perl -pe "s/./ sprintf '&#x%04x;', ord($&) /ge"
-
Perl’s DBD::Oracle vs Debian
For accessing an Oracle DB server from a client computer (w/o its own Oracle DB server installation) you need “Oracle Instant Client” (a set of packages of installables for various computer architectures, supplied by Oracle for free):
You won’t find Oracle Instant Client for Debian (outside your organisation or company), but …:
I.e. before installing DBD::Oracle these components of Oracle Instant Client must already be installed:
- basic resp. basiclite
- devel
- sqlplus
How to install DBD::Oracle?
- the “CPAN way” using a C compiler (gcc) etc
- as a readymade OS (i.e. Debian) package
Of course there are organisational reasons, that enforce the installation as readymade OS package.
DBD::Oracle for Debian is named libdbd-oracle-perl, here you find for which Debian version it is available and a lot more details:
If you are using a version of Debian like Jessie, that is not listed there, i.e. your version of Debian is not supported, you may want to create your own libdbd-oracle-perl through backporting the Debian Sid “source package components”.
This certainly involves using a C compiler (gcc) etc, but it in the end it creates a Debian package, that you can distribute within your organisation (resp. company).
How to retrieve the source package?
Retrieving the source package, the “dget” approach (preferred): go to the versioned links section, choose the .dsc link for the latest version, use dget on it, as suggested by the hint popping up, while you hover over the .dsc link.
Retrieving the source package, the “if using dget failed” approach: go to the general / source link:
Choose the sid link:
Download the 3 files listed there:
*.dsc*.orig.tar.**.debian.tar.*
Run this command line on the .dsc file downloaded right before:
$ dpkg-source --extract libdbd-oracle-perl_VERSION.dscThis created a source tree.
You will now adapt the source tree to your needs (if necessary). Maybe
dpkg-buildpackagewill make you return to this phase.Quite possibly you can now just run the next step within that source tree:
$ dpkg-buildpackage --build=any,all --unsigned-source --unsigned-changesresp.:
$ dpkg-buildpackage -b -us -ucCongratulations, you created your own
libdbd-oracle-perl_*.deb.- a Debianized Perl CPAN package: backporting from Debian Sid (a related article of mine)
-
installing Perl’s resp. CPAN’s CryptX as Debian package
- “Perl module that provides a self-contained crypto toolkit”
- https://metacpan.org/pod/CryptX — CryptX on CPAN
- https://tracker.debian.org/pkg/libcryptx-perl
- the “sid” AKA “unstable” AKA “bleeding edge” version is probably the one you are after
- download all 3 files mentioned there (source package) – actually (“in an ideal world“): dget the .dsc file, that will download all of them and check MD5 values
- https://manpages.debian.org/unstable/devscripts/dget.1.en.html
- adapt the minimal release specified by debhelper within debian/control
- run “dpkg-source -x” on the .dsc file
- https://manpages.debian.org/unstable/dpkg-dev/dpkg-source.1.en.html
- …
I hope I will be able to use this as a template for other CPAN modules (like DBD::Oracle, …).