in reply to Re^7: DBI placeholders for spatial data
in thread DBI placeholders for spatial data

Guess? How about printing the environment instead of guessing?

I guess because the DBI environment variables are not available to me on the shared hosting!

There is a script in my cgi-bin which lists all the CGI environment variables and there is nothing helpful in there. When I connect by SSH and run perl -e 'foreach $k(keys %ENV){print "$k - $ENV{$k}\n";}' I get environment variables for SSH and for local PERL and other directories but nothing relating to DBI

So, as it is hidden from me by the server admins, I can only guess...

Replies are listed 'Best First'.
Re^9: DBI placeholders for spatial data
by afoken (Canon) on Jul 01, 2021 at 05:48 UTC

    I guess because the DBI environment variables are not available to me on the shared hosting!

    There is a script in my cgi-bin which lists all the CGI environment variables and there is nothing helpful in there. When I connect by SSH and run perl -e 'foreach $k(keys %ENV){print "$k - $ENV{$k}\n";}' I get environment variables for SSH and for local PERL and other directories but nothing relating to DBI

    Of course you won't see the web server environment variables when running code from an SSH shell.

    So, as it is hidden from me by the server admins, I can only guess...

    Nonsense. When you run from the web server, i.e. a CGI or something running via mod_perl, you will see exactly the same variables as Perl. There is no way to hide anything. If DBI can see an environment variable, so can any other perl code started by the web server.

    Depending on how your shared hosting is configured, your CGIs may actually be run via mod_perl, using ModPerl::Registry. Loading Apache::DBI from the webserver may also happen. That changes how DBI->connect() works, as documented in Apache::DBI. The documentation also gives a hint how to detect that situation: $ENV{'MOD_PERL'} is set and $INC{'Apache/DBI.pm'} should exist.

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)