It has been about 12 years since I have had to think about Perl....
I have an iPad and I have a Postgresql database on my home server.
I have turned on the MacOS(client) VPN on the mac mini that I use
as my home server and can access my home network in a secure fashion...
I would like to be able to easily access my database running on this
server from my iPad.
It turns out that once upon a time I wrote a perl cgi that allowed
me to access postgresql and display the results of selections in
a html table.
It appears that I need to install DBI and DBD for Postgresql.
Unfortunately I have pretty much forgotten most of my Perl
( Sh*t happens when you get into your seventies...)
Could some kind soul give me a quick guide on how to install
the necessary modules to enable the cgi?
I have a fat libpq installed...
The perl script rmtpgsql.cgi is located here: http://homepage.mac.com/levanj/Perl/
If you use Postqresql and have the dbd stuff installed and are bored
you might give it a whirl and let me know if it still works.
If I can get it working then I could use Safari on the iPad to provide
easy viewing of my personal database.
Thanks,
Jerry
>I have an iPad and I have a Postgresql database on my home server.
>
>I have turned on the MacOS(client) VPN on the mac mini that I use
>as my home server and can access my home network in a secure fashion...
>
>It turns out that once upon a time I wrote a perl cgi that allowed
>me to access postgresql and display the results of selections in
>a html table.
>
>It appears that I need to install DBI and DBD for Postgresql.
>
>Unfortunately I have pretty much forgotten most of my Perl
>( Sh*t happens when you get into your seventies...)
>
>Could some kind soul give me a quick guide on how to install
>the necessary modules to enable the cgi?
Presuming you have the developer tools installed then use CPAN. I've
recently installed DBI and DBD::SQLite on my Mac Mini without any
complaints. I see that I am excluded from getting DBD:Pg because I
can't answer a simple question:
Configuring DBD::Pg 2.17.2
Path to pg_config? You tell me!
Use of uninitialized value $ENV{"POSTGRES_HOME"} ...
But no doubt as a user of Pg and 4 years my senior you will be able
to answer it.
21:41:50 User:jd Cwd: /usr/lib
➔ sudo cpan
Password:
Terminal does not support AddHistory.
cpan shell -- CPAN exploration and modules installation (v1.9402)
Enter 'h' for help.
cpan[1]> install DBI DBD::Pg
CPAN: Storable loaded ok (v2.18)
JD
>Is doing a:
>
> sudo perl -MCPAN -e shell
>
>The standard way of preparing to install modules?
>
>Seems like root might only be needed for actual installation...
With sudo you are superuser; that's quite good enough.
I never do it that way. I just type sudo cpan, as I said.
In fact I don't usually do that because I work mainly with my own
installation of perl, so I do
$ cd /usr/local/bin; sudo ./cpan
in order to get the modules installed where I want them and not in
the Apple installation. I wouldn't trust Apple to overwrite their
own installation. I trust them to take my money and not much else.
JD
A more modern way of doing this is to install your own version of Perl
5 with [perlbrew][1] and then use [cpanm][2] to manage your CPAN
installs. You may also find [this Stack Overflow question][3] useful.
By using a non-system version of Perl 5, you will not be susceptible
to problems such as the 2009-001 Apple security update [breaking][4]
Perl 5.
[1]: http://search.cpan.org/dist/App-perlbrew/lib/App/perlbrew.pm
[2]: http://search.cpan.org/dist/App-cpanminus/lib/App/cpanminus.pm
[3]: http://stackoverflow.com/questions/3718153/how-can-i-install-perl-version-under-my-home-using-perlbrew
[4]: http://www.theregister.co.uk/2009/02/16/apple_update_perl_breakage/
--
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.
> Is doing a:
>
> sudo perl -MCPAN -e shell
>
> The standard way of preparing to install modules?
>
> Seems like root might only be needed for actual installation...
Current versions of CPAN can be configured to request a sudo password at
the install step, while running the rest with normal permissions.
IIRC (I use cpanp, and I haven't had to set this up in a while):
> o conf make_install_make_command 'sudo make'
> o conf mbuild_install_build_command 'sudo ./Build'
> o conf commit
In the CPAN shell should set it up for you. Depending on what order
you've done things in, some temp folders may have been created with
root-only access at this point, which you might need to change. (That is:
If they were created by a 'sudo' run, they'll have root-only access.
Otherwise they'll have access for your user.)
You also don't need to go to the shell, and 'cpan' should be installed as
a stand-alone script:
> cpan i Module::Name
But all of that is basically just making things a bit less verbose and
noisy. (And the one safety of not running tests as root. Note that some
module tests will _fail_ if run as root...)
Daniel T. Staal
---------------------------------------------------------------
This email copyright the author. Unless otherwise noted, you
are expressly allowed to retransmit, quote, or otherwise use
the contents for non-commercial purposes. This copyright will
expire 5 years after the author's death, or in 30 years,
whichever is longer, unless such a period is in excess of
local copyright law.
---------------------------------------------------------------