Subject: | Problemns when using IO::Promter with DBI |
#!/usr/bin/env perl
use warnings;
use 5.16.2;
use DBI;
use IO::Prompter;
say $DBI::VERSION;
say $IO::Prompter::VERSION;
my $user = prompt( 'Enter username: ' );
my $passwd = prompt( 'Enter password: ', -echo => '' );
my $dbh = DBI->connect( "DBI:mysql:dbname=information_schema", $user,
$passwd, {} ) or die DBI->errstr;
#my $dbh = DBI->connect( "DBI:Pg:dbname=postgres", $user, $passwd, {} )
or die DBI->errstr;
say "Hello World";
Outputs:
1.623
0.004003
Enter username: testuser
Enter password:
Usage: $class->connect([$dsn [,$user [,$passwd [,\%attr]]]]) at
./perl.pl line 13.
When I enter the username and the password with a normal "readline" I
get no error message.
Summary of my perl5 (revision 5 version 16 subversion 2) configuration:
Platform:
osname=linux, osvers=3.4.11-2.16-desktop, archname=x86_64-linux
uname='linux linux1 3.4.11-2.16-desktop #1 smp preempt wed sep 26
17:05:00 utc 2012 (259fc87) x86_64 x86_64 x86_64 gnulinux '
config_args='-de'
hint=recommended, useposix=true, d_sigaction=define
useithreads=undef, usemultiplicity=undef
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=define, use64bitall=define, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc', ccflags ='-fno-strict-aliasing -pipe -fstack-protector
-I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
optimize='-O2',
cppflags='-fno-strict-aliasing -pipe -fstack-protector
-I/usr/local/include'
ccversion='', gccversion='4.7.1 20120723 [gcc-4_7-branch revision
189773]', gccosandvers=''
intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='cc', ldflags =' -fstack-protector -L/usr/local/lib'
libpth=/usr/local/lib /lib/../lib64 /usr/lib/../lib64 /lib /usr/lib
/lib64 /usr/lib64 /usr/local/lib64
libs=-lnsl -lndbm -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lgdbm_compat
perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
libc=/lib/libc-2.15.so, so=so, useshrplib=false, libperl=libperl.a
gnulibc_version='2.15'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
cccdlflags='-fPIC', lddlflags='-shared -O2 -L/usr/local/lib
-fstack-protector'
Characteristics of this binary (from libperl):
Compile-time options: HAS_TIMES PERLIO_LAYERS PERL_DONT_CREATE_GVSV
PERL_MALLOC_WRAP PERL_PRESERVE_IVUV USE_64_BIT_ALL
USE_64_BIT_INT USE_LARGE_FILES USE_LOCALE
USE_LOCALE_COLLATE USE_LOCALE_CTYPE
USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF
Built under linux
Compiled at Nov 6 2012 11:05:56
@INC:
/usr/local/lib/perl5/site_perl/5.16.2/x86_64-linux
/usr/local/lib/perl5/site_perl/5.16.2
/usr/local/lib/perl5/5.16.2/x86_64-linux
/usr/local/lib/perl5/5.16.2
.