"Can't locate PgCommon.pm" when trying to uninstall Postgres server - postgresql

I'm trying to remove postgres from my Ubuntu machine, but when I do, I'm getting the error message
Can't locate PgCommon.pm (#INC is [... a list of paths ...])
Any idea why PostgreSQL would lose track of a file it installed itself?

This can happen if you changed Perl interpreters since installing postgres. It can't find the package anymore because it was installed into a different modules directory. If this command
$ which perl
doesn't give this response
/usr/bin/perl
It's likely that you're just using the wrong Perl binary. In my case, I had symlinked /usr/local/bin/perl to my custom Perl binary (which my app needs in order to function) so I just renamed the symlink temporarily, ran apt-get remove postgres again, then put the symlink back where it was!

Related

Perforce P4Perl Api installs in wrong directory

I have two Perl versions installations on my PC, 5.12.3 and 5.16.3. To install the P4Perl API, I needed to set in Path the location of Perl 5.16.3(otherwise I was getting a P4Perl API installer error) and after succesfully running the installation, I searched for the P4.pm module and noticed that the installation of the P4.pm module was done in the folder of the 5.12.3 installation.
As you can see in the title, the installation was done for Perl 5.16
But if I search for the P4.pm, it is located in the 5123 folder ( which is coresponding to Perl 5.12.3
Even more, when I try to run a simple script which only imports the P4.pm module:
-with Perl 5.16.3 it complains about the missing P4.pm module
-with Perl 5.12.3 it complains about the missing perl516.dll which I can find with Everything in the installation of Perl 5.16.3.
After this, I thought to move the content which was installed in 5.12.3 installation to the 5.16.3 installation, just as #Gerhard suggested. And now it works. Does anyone knows why it messes up at installation?
Even though, the files exist physically.
Copy the Directories of the module files to the <PATH_TO_PERL>/lib and <PATH_TO_PERL>/site/lib to solve the issue.
Perl modules almost always exists as /lib/DIR/DIR/Module.pm
for instance C:\perl64\lib\Date\Simple\date.pm
If the files exists on their own, the there is a problem with the module installation itself. Or, Somewhere there is a path reference to your old perl version directory.
To see which perl path is used by default, do:
perl -e "print $^X"
Hope that helps a bit.

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

How do I install DBI module for Perl on Heroku machine

So I have my Ruby-on-rails app that i successfully released to heroku. However to populate the database I have several perl scripts that basically sync up tables on local database with a remote database.
On my development machine (on ec2) it works fine but I also have a lot of stuff i have installed on it over time.
When I try to run my scripts I get the following error (latest perl is installed by the way)
Can't locate DBI.pm in #INC (#INC contains: /etc/perl /usr/local/lib/perl/5.10.1 /usr/local/share/perl/5.10.1 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl .) at copyStaff.pl line 4.
BEGIN failed--compilation aborted at copyStaff.pl line 4.
How do I install DBI module for Perl on heroku?
I tried through bash
apt-get install libdbi-perl
This gave me an output of
W: Not using locking for read only lock file /var/lib/dpkg/lock
E: Unable to write to /var/cache/apt/
E: The package lists or status file could not be parsed or opened.
[This might be irrelevant]
I tried to run this command
dpkg --configure -a
But it told me it requires super user privileges
su -l root -c "dpkg --configure -a"
asked for root password and apparently I don't know the password (it's not the heroku login), no clue what it might be.
I also downloaded the file directly, but I need super user access. I also tried
$perl -MCPAN -e shell
cpan> install DBI
(this had same problem of not beng able to save the file)
I have a feeling i might be going at it completely the wrong way, but I can't figure out what I need to do to run those scripts.
You're going to have to investigate Perl Buildpacks for Heroku, of which I know of the existence of Perloku, and two others calling themselves something along the lines of perl-heroku.
Buildpacks attempt to install environments that Heroku does not support natively, like Perl. I found some install Mojolicious, another installs an apache2/mod_perl env.
You'll have to talk to the buildpack maintainers to find out if they have DBI/ DBD::mysql installed, but it is likely they do, just based on the popularity of those modules.
If you get that far, then all you have to do is sync the databases :-)
Well I got the answer from customer support, just pasting it here
Unfortunately we don't support installing additional libraries or binaries to our stacks. The best workaround is to vendor these into your project. You'll need to use 64-bit Linux versions to make them work on Heroku; compiling statically can also help ensure that any dependencies needed are included. Similarly, for gems that depend on external libraries, we recommend compiling the gem statically and vendoring it into your project.
If you do wish to try to vendor your binary, library, or gem, you can use Heroku as your build environment. One of our engineers created a build server that allows you to upload source code, run the compilation step, and then download the resulting binary. You can find this project here:
https://github.com/heroku/vulcan

Regarding perl 5.8.3 DBI installation

Noticed our system has perl 5.8.3. I am unable to locate the DBI.pm. When i did perl -V it was showing the below output. Pasted it below. Using HPUX11 os. All installed files under the perl installation directory are having root or bin as owner of the file. I dont have root password now. I want to install DBI.pm. how can i do it. Do i need to download it from CPAN or Active Perl Website?
perl -V
Characteristics of this binary (from libperl): Compile-time options:
MULTIPLICITY USE_ITHREADS USE_LARGE_FILES PERL_IMPLICIT_CONTEXT
Locally applied patches:
ActivePerl Build 809
22218 Remove the caveat about detached threads crashing on Windows
22201 Avoid threads+win32 crash by freeing Perl interpreter slightly later
22169 Display 'out of memeory' errors using low-level I/O
22159 Upgrade to Time::Hires 1.55
22120 Make 'Configure -Dcf_by=...' work
22051 Upgrade to Time::HiRes 1.54
21540 Fix backward-compatibility issues in if.pm Built under hpux Compiled at May 17 2005 18:12:56
/opt/perl/lib/5.8.3/PA-RISC1.1-thread-multi
/opt/perl/lib/5.8.3
/opt/perl/lib/site_perl/5.8.3/PA-RISC1.1-thread-multi
/opt/perl/lib/site_perl/5.8.3
/opt/perl/lib/site_perl
All installed files under the perl installation directory are having root or bin as user id. I dont have root password now. I want to install DBI. How can i do it?
CPAN has an option local::lib which will install to ~/perl5. If that works for you, that's your best option, otherwise create a directory somewhere that you do have access (probably under your /home), download DBI.pm (and any dependencies) manually, and put it in there.
Then add the directory name to your PERLLIB environment variable (which is not set at the moment). Do perl -V to confirm that ~/perl5 has been added to #INC.

How do I stop cpan from reconfiguring each time? + More

I'm running on a Mac (version 10.6.3) and am struggling to understand what is going on with my Perl installation.
I let the system do a copy from my previous mac, and I appear to have a second perl installed, which appears earlier in my path. I can't tell (or remember) if I might have installed it with fink, macports or CPAN or what.
type -a cpan
cpan is /opt/local/bin/cpan
cpan is /usr/bin/cpan
I'm seeing two oddities. (To start with!) When I run cpan, and let it configure in ~lcuff/.cpan, each time I run it, it wants to reconfigure, giving the message:
Sorry, we have to rerun the configuration dialog for CPAN.pm due to
some missing parameters...
Also, when I try to install File::Find::Rule (so I can list my CPAN modules, per the FAQ) I end up with an error message that I can't decipher or Google a solution for:
Use of inherited AUTOLOAD for non-method Digest::SHA::shaopen() is deprecated at /opt/local/lib/perl5/vendor_perl/5.8.9/darwin-2level/Digest/SHA.pm line 55.
Catching error: "Can't locate auto/Digest/SHA/shaopen.al in \#INC (\#INC contains: /sw/lib/perl5 /sw/lib/perl5/darwin /opt/local/lib/perl5/site_perl/5.8.9/darwin-2level /opt/local/lib/perl5/site_perl/5.8.9 /opt/local/lib/perl5/site_perl /opt/local/lib/perl5/vendor_perl/5.8.9/darwin-2level /opt/local/lib/perl5/vendor_perl/5.8.9 /opt/local/lib/perl5/vendor_perl /opt/local/lib/perl5/5.8.9/darwin-2level /opt/local/lib/perl5/5.8.9 /Users/lcuff) at /opt/local/lib/perl5/vendor_perl/5.8.9/darwin-2level/Digest/SHA.pm line 55\cJ" at /opt/local/lib/perl5/5.8.9/CPAN.pm line 359
CPAN::shell() called at /opt/local/bin/cpan line 198
I just went through my first migration to a new Mac last week, including a switch from fink and system perl to MacPorts and custom perl, so I remember the pain all too well...
As Schwern said, /opt/local is the default install location for MacPorts; fink uses /sw.
I did encounter a similar problem with CPAN configuration, although I didn't make any attempt to determine whether it was repeatable or not.
The first time I ran CPAN config, it said that I had an existing CPAN dir at ~/.cpan and stored the configuration there.
The second time, it wanted to configure into an existing CPAN dir at ~/Library/Application Support/.cpan. I didn't feel like repeating the CPAN configuration, so I broke out, did a quick cd ~/Library/Application Support/.cpan ; rm -rf .cpan ; ln -s ~/.cpan ., and it's worked great for me since then.
Hopefully this will at least help get you pointed in the right direction.
Have a look at Perlbrew.
Perlbrew allows you to install and manage mulitple versions for Perl under your home directory at ~/perl5
Installation is easy:
curl -LO http://xrl.us/perlbrew
chmod +x perlbrew
./perlbrew install
and simply follow the instructions.
Been using it for past few months on Mac OSX and it worked like a charm!
/I3az/