Database encoding not recognized by DBD::Pg

2014-04-03 Thread Vincent Veyron
Hi,

I have the following setup : Workstation, Primary, and Backup servers all 
running on a current version of Debian Stable. All run an identical LAMP stack 
of Apache/Mod_perl/Postgresql, except for default locale (see below). DBD::PG 
version is 3.0.0

My perl modules misbehave when connecting to a UTF8 encoded database on the 
backup server *only*. The link below shows the result of Data::Dumper, decode, 
and data_string_desc for each machine, for a record containing accented 
characters.

http://vincentveyron.com/tmp/tmp.html

I have 2 questions :

- Why does data_string_desc return 'UTF8 off' all servers, when the database is 
UTF8 encoded?

- What should I inspect to understand why data_string_desc gets a wrong number 
of characters in the backup server?

#
#/etc/default/locale for each server 
#
#Workstation
LANG=fr_FR.UTF-8

#Primary
LANG=fr_FR@euro
LANGUAGE=fr_FR:fr

#Backup
LANG=fr_FR@euro


#
#Code used for the example
#
package Mysite::utf8_db_handle ;

use strict ;
use warnings ;

use DBI qw(:utils) ;

use Data::Dumper ;

use Encode qw (decode) ;

use Apache2::Const -compile = qw (OK REDIRECT) ;

sub handler {

my $r = shift ;

my $dbh = DBI-connect_cached( DBI:Pg:dbname=bla_2, 'www-data', undef, {
PrintError = 1,
RaiseError = 1,
AutoCommit = 1,
pg_bool_tf = 't'
  } ) ;

my $sql = 'SELECT prenom FROM tblclient where id_client=2' ;

my $result_set = $dbh-selectall_arrayref($sql) ;

my $content = 'h1Mysite/h1' ;

$content = 'h2Not decoded, using Data::Dumper/h2' ;

$content .= 'pre' ;

$content .= Dumper($result_set) ;

$content .= '/pre' ;

$content .= 'h2Decoded using decode(UTF8,.../h2' ;

$content .= 'p' . ( decode('UTF8', $result_set-[0]-[0] ) || 'wtf?' ) . 
'/p' ;

$content .= 'h2data_string_desc/h2' ;

$content .= 'p' . data_string_desc($result_set-[0]-[0]) . '/p' ;

$r-content_type('text/html; charset=UTF-8') ;

$r-no_cache(1) ;

print $content ;

return Apache2::Const::OK ;

}

1 ;



-- 
Salutations, Vincent Veyron

http://marica.fr/
Gestion des contentieux, des dossiers de sinistres assurance et des contrats 
pour le service juridique


CPAN DBI make make test error

2014-04-03 Thread Karthi Keyan01
Hi,

I'm trying to install the DBI module in the below mentioned steps as a root 
user.


1.  export DB2_HOME=/opt/IBM/db2/V9.7

2.  export DB2LIB=/opt/IBM/db2/V9.7/lib64

3.  perl Makefile.PL

4.  make

5.  make test

6.  make install


The first 3 steps are completed successfully and the 4th step, make process is 
throwing the below error.

xlc_r -q32 -c-D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE 
-qmaxmem=-1 -qnoansialias -DUSE_NATIVE_DLOPEN -DNEED_PTHREAD_INIT 
-qlanglvl=extended -I/usr/local/include -q32 -D_LARGE_FILES -qlonglong -O
-DVERSION=\1.631\  -DXS_VERSION=\1.631\  
-I/usr/opt/perl5/lib/5.10.1/aix-thread-multi/CORE   Perl.c
/bin/sh: xlc_r:  not found.
make: 1254-004 The error code from the last command is 127.


I have posted the complete results that I performed. Kindly help.

--

# export DB2_HOME=/opt/IBM/db2/V9.7  --- Step 1

# export DB2LIB=/opt/IBM/db2/V9.7/lib64--- Step 2

# perl Makefile.PL  --- 
Step 3 - Completed successfully


# make
--- Step 4

Skip blib/arch/auto/DBI/Driver_xst.h (unchanged)
Skip blib/lib/DBD/Proxy.pm (unchanged)
Skip blib/lib/DBI/Gofer/Response.pm (unchanged)
Skip blib/lib/DBI/Gofer/Transport/Base.pm (unchanged)
Skip blib/lib/DBI/Util/_accessor.pm (unchanged)
Skip blib/lib/DBD/DBM.pm (unchanged)
Skip blib/arch/auto/DBI/DBIXS.h (unchanged)
Skip blib/lib/dbixs_rev.pl (unchanged)
Skip blib/lib/DBI/Const/GetInfoType.pm (unchanged)
Skip blib/lib/DBI/Gofer/Serializer/DataDumper.pm (unchanged)
Skip blib/lib/DBI/DBD/Metadata.pm (unchanged)
Skip blib/lib/DBD/Gofer/Transport/pipeone.pm (unchanged)
Skip blib/lib/DBI/Const/GetInfo/ODBC.pm (unchanged)
Skip blib/lib/DBI/ProfileDumper/Apache.pm (unchanged)
Skip blib/lib/DBD/File/Roadmap.pod (unchanged)
Skip blib/arch/auto/DBI/Driver.xst (unchanged)
Skip blib/lib/DBD/File.pm (unchanged)
Skip blib/lib/DBI/Util/CacheMemory.pm (unchanged)
Skip blib/lib/DBD/NullP.pm (unchanged)
Skip blib/lib/DBI/ProfileSubs.pm (unchanged)
Skip blib/arch/auto/DBI/dbi_sql.h (unchanged)
Skip blib/lib/DBD/File/HowTo.pod (unchanged)
Skip blib/lib/DBD/Gofer.pm (unchanged)
Skip blib/arch/auto/DBI/dbivport.h (unchanged)
Skip blib/arch/auto/DBI/dbd_xsh.h (unchanged)
Skip blib/lib/DBI/DBD/SqlEngine/HowTo.pod (unchanged)
Skip blib/arch/auto/DBI/dbixs_rev.h (unchanged)
Skip blib/lib/DBD/Gofer/Transport/Base.pm (unchanged)
Skip blib/lib/DBD/Gofer/Transport/corostream.pm (unchanged)
Skip blib/lib/DBI/FAQ.pm (unchanged)
Skip blib/lib/DBD/Gofer/Policy/rush.pm (unchanged)
Skip blib/lib/DBI/SQL/Nano.pm (unchanged)
Skip blib/lib/DBI/Const/GetInfo/ANSI.pm (unchanged)
Skip blib/lib/DBI/Gofer/Request.pm (unchanged)
Skip blib/lib/DBD/Gofer/Transport/stream.pm (unchanged)
Skip blib/lib/DBD/Gofer/Policy/classic.pm (unchanged)
Skip blib/lib/DBI/Const/GetInfoReturn.pm (unchanged)
Skip blib/lib/DBD/Gofer/Policy/Base.pm (unchanged)
Skip blib/lib/DBI.pm (unchanged)
Skip blib/lib/DBI/Gofer/Serializer/Storable.pm (unchanged)
Skip blib/lib/DBI/Gofer/Transport/stream.pm (unchanged)
Skip blib/lib/DBD/Sponge.pm (unchanged)
Skip blib/lib/DBD/Gofer/Policy/pedantic.pm (unchanged)
Skip blib/lib/DBI/W32ODBC.pm (unchanged)
Skip blib/lib/DBI/DBD/SqlEngine/Developers.pod (unchanged)
Skip blib/lib/DBI/Gofer/Transport/pipeone.pm (unchanged)
Skip blib/lib/DBD/Gofer/Transport/null.pm (unchanged)
Skip blib/lib/Bundle/DBI.pm (unchanged)
Skip blib/lib/DBD/File/Developers.pod (unchanged)
Skip blib/lib/DBI/Profile.pm (unchanged)
Skip blib/lib/DBI/ProfileDumper.pm (unchanged)
Skip blib/lib/DBI/ProxyServer.pm (unchanged)
Skip blib/lib/DBI/Gofer/Serializer/Base.pm (unchanged)
Skip blib/arch/auto/DBI/dbipport.h (unchanged)
Skip blib/lib/DBI/Gofer/Execute.pm (unchanged)
Skip blib/lib/DBI/DBD.pm (unchanged)
Skip blib/lib/DBI/DBD/SqlEngine.pm (unchanged)
Skip blib/lib/Win32/DBIODBC.pm (unchanged)
Skip blib/lib/DBI/PurePerl.pm (unchanged)
Skip blib/lib/DBD/ExampleP.pm (unchanged)
Skip blib/lib/DBI/ProfileData.pm (unchanged)
xlc_r -q32 -c-D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE 
-qmaxmem=-1 -qnoansialias -DUSE_NATIVE_DLOPEN -DNEED_PTHREAD_INIT 
-qlanglvl=extended -I/usr/local/include -q32 -D_LARGE_FILES -qlonglong -O
-DVERSION=\1.631\  -DXS_VERSION=\1.631\  
-I/usr/opt/perl5/lib/5.10.1/aix-thread-multi/CORE   Perl.c
/bin/sh: xlc_r:  not found.
make: 1254-004 The error code from the last command is 127.


Stop.

# make test --- Step 5

xlc_r -q32 -c-D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE 
-qmaxmem=-1 -qnoansialias -DUSE_NATIVE_DLOPEN -DNEED_PTHREAD_INIT 
-qlanglvl=extended -I/usr/local/include -q32 -D_LARGE_FILES -qlonglong -O
-DVERSION=\1.631\  -DXS_VERSION=\1.631\  
-I/usr/opt/perl5/lib/5.10.1/aix-thread-multi/CORE   Perl.c
/bin/sh: xlc_r:  not found.

Re: CPAN DBI make make test error

2014-04-03 Thread Jonathan Leffler
On Thu, Apr 3, 2014 at 6:14 AM, Karthi Keyan01
karthi_keya...@infosys.comwrote:

I'm trying to install the DBI module in the below mentioned steps as a
 root user.



xlc_r -q32 -c-D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE
 -qmaxmem=-1 -qnoansialias -DUSE_NATIVE_DLOPEN -DNEED_PTHREAD_INIT
 -qlanglvl=extended -I/usr/local/include -q32 -D_LARGE_FILES -qlonglong
 -O-DVERSION=\1.631\  -DXS_VERSION=\1.631\
 -I/usr/opt/perl5/lib/5.10.1/aix-thread-multi/CORE   Perl.c

 /bin/sh: xlc_r:  not found.

 make: 1254-004 The error code from the last command is 127.




Maybe you don't have the xlc_r installed on your machine at all, or maybe
it is not on your path when you are logged in as root.

Either way, the primary fix is to ensure that root has access to the xlc_r
compiler.

The secondary problem is that you're compiling as root.  Personally, I
recommend doing the compilation and testing as a regular user.  Only if
you're sure you want to mess with the system installation of Perl do you do
the install as 'root'.  Minimize the use of root privileges; it reduces the
risks of doing damage if something goes wrong.


-- 
Jonathan Leffler jonathan.leff...@gmail.com  #include disclaimer.h
Guardian of DBD::Informix - v2013.0521 - http://dbi.perl.org
Blessed are we who can laugh at ourselves, for we shall never cease to be
amused.


Re: CPAN DBI make make test error

2014-04-03 Thread John R Pierce

On 4/3/2014 8:43 PM, Jonathan Leffler wrote:
Maybe you don't have the xlc_r installed on your machine at all, or 
maybe it is not on your path when you are logged in as root.



try putting /usr/vac/bin in your PATH ...

$  /usr/vac/bin/xlc_r -qversion
IBM XL C/C++ for AIX, V11.1 (5724-X13)
Version: 11.01..0006


Do note, IBM XLC and/or XLCPP are licensed on a named user basis. At my 
work, only two of us have licenses to use it.




--
john r pierce  37N 122W
somewhere on the middle of the left coast