Skip to content

Instantly share code, notes, and snippets.

Created October 4, 2014 19:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/d69f5b0cee13102a9167 to your computer and use it in GitHub Desktop.
Save anonymous/d69f5b0cee13102a9167 to your computer and use it in GitHub Desktop.
~$ cpan
CPAN.pm requires configuration, but most of it can be done automatically.
If you answer 'no' below, you will enter an interactive dialog for each
configuration option instead.
Would you like to configure as much as possible automatically? [yes]
<install_help>
Warning: You do not have write permission for Perl library directories.
To install modules, you need to configure a local Perl library directory or
escalate your privileges. CPAN can help you by bootstrapping the local::lib
module or by configuring itself to use 'sudo' (if available). You may also
resolve this problem manually if you need to customize your setup.
What approach do you want? (Choose 'local::lib', 'sudo' or 'manual')
[local::lib] sudo
Autoconfigured everything but 'urllist'.
Now you need to choose your CPAN mirror sites. You can let me
pick mirrors for you, you can select them from a list or you
can enter them by hand.
Would you like me to automatically choose some CPAN mirror
sites for you? (This means connecting to the Internet) [yes]
Trying to fetch a mirror list from the Internet
Fetching with LWP:
http://www.perl.org/CPAN/MIRRORED.BY
Looking for CPAN mirrors near you (please be patient)
.......................... done!
New urllist
http://cpan.knowledgematters.net/
http://mirrors.syringanetworks.net/CPAN/
http://cpan.netnitco.net/
Autoconfiguration complete.
commit: wrote '/Users/nknight/.cpan/CPAN/MyConfig.pm'
You can re-run configuration any time with 'o conf init' in the CPAN shell
Terminal does not support AddHistory.
cpan shell -- CPAN exploration and modules installation (v1.9800)
Enter 'h' for help.
cpan[1]> install DBD::mysql
Fetching with LWP:
http://cpan.knowledgematters.net/authors/01mailrc.txt.gz
Reading '/Users/nknight/.cpan/sources/authors/01mailrc.txt.gz'
............................................................................DONE
Fetching with LWP:
http://cpan.knowledgematters.net/modules/02packages.details.txt.gz
Reading '/Users/nknight/.cpan/sources/modules/02packages.details.txt.gz'
Database was generated on Sat, 04 Oct 2014 06:41:02 GMT
..............
New CPAN.pm version (v2.05) available.
[Currently running version is v1.9800]
You might want to try
install CPAN
reload cpan
to both upgrade CPAN.pm and run the new version without leaving
the current session.
..............................................................DONE
Fetching with LWP:
http://cpan.knowledgematters.net/modules/03modlist.data.gz
Reading '/Users/nknight/.cpan/sources/modules/03modlist.data.gz'
DONE
Writing /Users/nknight/.cpan/Metadata
Running install for module 'DBD::mysql'
Running make for C/CA/CAPTTOFU/DBD-mysql-4.028.tar.gz
Fetching with LWP:
http://cpan.knowledgematters.net/authors/id/C/CA/CAPTTOFU/DBD-mysql-4.028.tar.gz
Fetching with LWP:
http://cpan.knowledgematters.net/authors/id/C/CA/CAPTTOFU/CHECKSUMS
Checksum for /Users/nknight/.cpan/sources/authors/id/C/CA/CAPTTOFU/DBD-mysql-4.028.tar.gz ok
Scanning cache /Users/nknight/.cpan/build for sizes
DONE
CPAN.pm: Building C/CA/CAPTTOFU/DBD-mysql-4.028.tar.gz
Usage: /usr/local/bin/mysql_config [OPTIONS]
Options:
--cflags [-I/usr/local/Cellar/mariadb/10.0.13/include/mysql -I/usr/local/Cellar/mariadb/10.0.13/include/mysql/.. -g -DNDEBUG]
--include [-I/usr/local/Cellar/mariadb/10.0.13/include/mysql -I/usr/local/Cellar/mariadb/10.0.13/include/mysql/..]
--libs [-L/usr/local/Cellar/mariadb/10.0.13/lib -lmysqlclient -lz -lssl -lcrypto]
--libs_r [-L/usr/local/Cellar/mariadb/10.0.13/lib -lmysqlclient_r -lz -lssl -lcrypto]
--plugindir [/usr/local/Cellar/mariadb/10.0.13/lib/plugin]
--socket [/tmp/mysql.sock]
--port [0]
--version [10.0.13]
--libmysqld-libs [-L/usr/local/Cellar/mariadb/10.0.13/lib -lmysqld]
--variable=VAR VAR is one of:
pkgincludedir [/usr/local/Cellar/mariadb/10.0.13/include/mysql]
pkglibdir [/usr/local/Cellar/mariadb/10.0.13/lib]
plugindir [/usr/local/Cellar/mariadb/10.0.13/lib/plugin]
Usage: /usr/local/bin/mysql_config [OPTIONS]
Options:
--cflags [-I/usr/local/Cellar/mariadb/10.0.13/include/mysql -I/usr/local/Cellar/mariadb/10.0.13/include/mysql/.. -g -DNDEBUG]
--include [-I/usr/local/Cellar/mariadb/10.0.13/include/mysql -I/usr/local/Cellar/mariadb/10.0.13/include/mysql/..]
--libs [-L/usr/local/Cellar/mariadb/10.0.13/lib -lmysqlclient -lz -lssl -lcrypto]
--libs_r [-L/usr/local/Cellar/mariadb/10.0.13/lib -lmysqlclient_r -lz -lssl -lcrypto]
--plugindir [/usr/local/Cellar/mariadb/10.0.13/lib/plugin]
--socket [/tmp/mysql.sock]
--port [0]
--version [10.0.13]
--libmysqld-libs [-L/usr/local/Cellar/mariadb/10.0.13/lib -lmysqld]
--variable=VAR VAR is one of:
pkgincludedir [/usr/local/Cellar/mariadb/10.0.13/include/mysql]
pkglibdir [/usr/local/Cellar/mariadb/10.0.13/lib]
plugindir [/usr/local/Cellar/mariadb/10.0.13/lib/plugin]
Usage: /usr/local/bin/mysql_config [OPTIONS]
Options:
--cflags [-I/usr/local/Cellar/mariadb/10.0.13/include/mysql -I/usr/local/Cellar/mariadb/10.0.13/include/mysql/.. -g -DNDEBUG]
--include [-I/usr/local/Cellar/mariadb/10.0.13/include/mysql -I/usr/local/Cellar/mariadb/10.0.13/include/mysql/..]
--libs [-L/usr/local/Cellar/mariadb/10.0.13/lib -lmysqlclient -lz -lssl -lcrypto]
--libs_r [-L/usr/local/Cellar/mariadb/10.0.13/lib -lmysqlclient_r -lz -lssl -lcrypto]
--plugindir [/usr/local/Cellar/mariadb/10.0.13/lib/plugin]
--socket [/tmp/mysql.sock]
--port [0]
--version [10.0.13]
--libmysqld-libs [-L/usr/local/Cellar/mariadb/10.0.13/lib -lmysqld]
--variable=VAR VAR is one of:
pkgincludedir [/usr/local/Cellar/mariadb/10.0.13/include/mysql]
pkglibdir [/usr/local/Cellar/mariadb/10.0.13/lib]
plugindir [/usr/local/Cellar/mariadb/10.0.13/lib/plugin]
PLEASE NOTE:
For 'make test' to run properly, you must ensure that the
database user 'nknight' can connect to your MySQL server
and has the proper privileges that these tests require such
as 'drop table', 'create table', 'drop procedure', 'create procedure'
as well as others.
mysql> grant all privileges on test.* to 'nknight'@'localhost' identified by 's3kr1t';
You can also optionally set the user to run 'make test' with:
perl Makefile.PL --testuser=username
Usage: /usr/local/bin/mysql_config [OPTIONS]
Options:
--cflags [-I/usr/local/Cellar/mariadb/10.0.13/include/mysql -I/usr/local/Cellar/mariadb/10.0.13/include/mysql/.. -g -DNDEBUG]
--include [-I/usr/local/Cellar/mariadb/10.0.13/include/mysql -I/usr/local/Cellar/mariadb/10.0.13/include/mysql/..]
--libs [-L/usr/local/Cellar/mariadb/10.0.13/lib -lmysqlclient -lz -lssl -lcrypto]
--libs_r [-L/usr/local/Cellar/mariadb/10.0.13/lib -lmysqlclient_r -lz -lssl -lcrypto]
--plugindir [/usr/local/Cellar/mariadb/10.0.13/lib/plugin]
--socket [/tmp/mysql.sock]
--port [0]
--version [10.0.13]
--libmysqld-libs [-L/usr/local/Cellar/mariadb/10.0.13/lib -lmysqld]
--variable=VAR VAR is one of:
pkgincludedir [/usr/local/Cellar/mariadb/10.0.13/include/mysql]
pkglibdir [/usr/local/Cellar/mariadb/10.0.13/lib]
plugindir [/usr/local/Cellar/mariadb/10.0.13/lib/plugin]
Usage: /usr/local/bin/mysql_config [OPTIONS]
Options:
--cflags [-I/usr/local/Cellar/mariadb/10.0.13/include/mysql -I/usr/local/Cellar/mariadb/10.0.13/include/mysql/.. -g -DNDEBUG]
--include [-I/usr/local/Cellar/mariadb/10.0.13/include/mysql -I/usr/local/Cellar/mariadb/10.0.13/include/mysql/..]
--libs [-L/usr/local/Cellar/mariadb/10.0.13/lib -lmysqlclient -lz -lssl -lcrypto]
--libs_r [-L/usr/local/Cellar/mariadb/10.0.13/lib -lmysqlclient_r -lz -lssl -lcrypto]
--plugindir [/usr/local/Cellar/mariadb/10.0.13/lib/plugin]
--socket [/tmp/mysql.sock]
--port [0]
--version [10.0.13]
--libmysqld-libs [-L/usr/local/Cellar/mariadb/10.0.13/lib -lmysqld]
--variable=VAR VAR is one of:
pkgincludedir [/usr/local/Cellar/mariadb/10.0.13/include/mysql]
pkglibdir [/usr/local/Cellar/mariadb/10.0.13/lib]
plugindir [/usr/local/Cellar/mariadb/10.0.13/lib/plugin]
Usage: /usr/local/bin/mysql_config [OPTIONS]
Options:
--cflags [-I/usr/local/Cellar/mariadb/10.0.13/include/mysql -I/usr/local/Cellar/mariadb/10.0.13/include/mysql/.. -g -DNDEBUG]
--include [-I/usr/local/Cellar/mariadb/10.0.13/include/mysql -I/usr/local/Cellar/mariadb/10.0.13/include/mysql/..]
--libs [-L/usr/local/Cellar/mariadb/10.0.13/lib -lmysqlclient -lz -lssl -lcrypto]
--libs_r [-L/usr/local/Cellar/mariadb/10.0.13/lib -lmysqlclient_r -lz -lssl -lcrypto]
--plugindir [/usr/local/Cellar/mariadb/10.0.13/lib/plugin]
--socket [/tmp/mysql.sock]
--port [0]
--version [10.0.13]
--libmysqld-libs [-L/usr/local/Cellar/mariadb/10.0.13/lib -lmysqld]
--variable=VAR VAR is one of:
pkgincludedir [/usr/local/Cellar/mariadb/10.0.13/include/mysql]
pkglibdir [/usr/local/Cellar/mariadb/10.0.13/lib]
plugindir [/usr/local/Cellar/mariadb/10.0.13/lib/plugin]
Usage: /usr/local/bin/mysql_config [OPTIONS]
Options:
--cflags [-I/usr/local/Cellar/mariadb/10.0.13/include/mysql -I/usr/local/Cellar/mariadb/10.0.13/include/mysql/.. -g -DNDEBUG]
--include [-I/usr/local/Cellar/mariadb/10.0.13/include/mysql -I/usr/local/Cellar/mariadb/10.0.13/include/mysql/..]
--libs [-L/usr/local/Cellar/mariadb/10.0.13/lib -lmysqlclient -lz -lssl -lcrypto]
--libs_r [-L/usr/local/Cellar/mariadb/10.0.13/lib -lmysqlclient_r -lz -lssl -lcrypto]
--plugindir [/usr/local/Cellar/mariadb/10.0.13/lib/plugin]
--socket [/tmp/mysql.sock]
--port [0]
--version [10.0.13]
--libmysqld-libs [-L/usr/local/Cellar/mariadb/10.0.13/lib -lmysqld]
--variable=VAR VAR is one of:
pkgincludedir [/usr/local/Cellar/mariadb/10.0.13/include/mysql]
pkglibdir [/usr/local/Cellar/mariadb/10.0.13/lib]
plugindir [/usr/local/Cellar/mariadb/10.0.13/lib/plugin]
Usage: /usr/local/bin/mysql_config [OPTIONS]
Options:
--cflags [-I/usr/local/Cellar/mariadb/10.0.13/include/mysql -I/usr/local/Cellar/mariadb/10.0.13/include/mysql/.. -g -DNDEBUG]
--include [-I/usr/local/Cellar/mariadb/10.0.13/include/mysql -I/usr/local/Cellar/mariadb/10.0.13/include/mysql/..]
--libs [-L/usr/local/Cellar/mariadb/10.0.13/lib -lmysqlclient -lz -lssl -lcrypto]
--libs_r [-L/usr/local/Cellar/mariadb/10.0.13/lib -lmysqlclient_r -lz -lssl -lcrypto]
--plugindir [/usr/local/Cellar/mariadb/10.0.13/lib/plugin]
--socket [/tmp/mysql.sock]
--port [0]
--version [10.0.13]
--libmysqld-libs [-L/usr/local/Cellar/mariadb/10.0.13/lib -lmysqld]
--variable=VAR VAR is one of:
pkgincludedir [/usr/local/Cellar/mariadb/10.0.13/include/mysql]
pkglibdir [/usr/local/Cellar/mariadb/10.0.13/lib]
plugindir [/usr/local/Cellar/mariadb/10.0.13/lib/plugin]
Usage: /usr/local/bin/mysql_config [OPTIONS]
Options:
--cflags [-I/usr/local/Cellar/mariadb/10.0.13/include/mysql -I/usr/local/Cellar/mariadb/10.0.13/include/mysql/.. -g -DNDEBUG]
--include [-I/usr/local/Cellar/mariadb/10.0.13/include/mysql -I/usr/local/Cellar/mariadb/10.0.13/include/mysql/..]
--libs [-L/usr/local/Cellar/mariadb/10.0.13/lib -lmysqlclient -lz -lssl -lcrypto]
--libs_r [-L/usr/local/Cellar/mariadb/10.0.13/lib -lmysqlclient_r -lz -lssl -lcrypto]
--plugindir [/usr/local/Cellar/mariadb/10.0.13/lib/plugin]
--socket [/tmp/mysql.sock]
--port [0]
--version [10.0.13]
--libmysqld-libs [-L/usr/local/Cellar/mariadb/10.0.13/lib -lmysqld]
--variable=VAR VAR is one of:
pkgincludedir [/usr/local/Cellar/mariadb/10.0.13/include/mysql]
pkglibdir [/usr/local/Cellar/mariadb/10.0.13/lib]
plugindir [/usr/local/Cellar/mariadb/10.0.13/lib/plugin]
Usage: /usr/local/bin/mysql_config [OPTIONS]
Options:
--cflags [-I/usr/local/Cellar/mariadb/10.0.13/include/mysql -I/usr/local/Cellar/mariadb/10.0.13/include/mysql/.. -g -DNDEBUG]
--include [-I/usr/local/Cellar/mariadb/10.0.13/include/mysql -I/usr/local/Cellar/mariadb/10.0.13/include/mysql/..]
--libs [-L/usr/local/Cellar/mariadb/10.0.13/lib -lmysqlclient -lz -lssl -lcrypto]
--libs_r [-L/usr/local/Cellar/mariadb/10.0.13/lib -lmysqlclient_r -lz -lssl -lcrypto]
--plugindir [/usr/local/Cellar/mariadb/10.0.13/lib/plugin]
--socket [/tmp/mysql.sock]
--port [0]
--version [10.0.13]
--libmysqld-libs [-L/usr/local/Cellar/mariadb/10.0.13/lib -lmysqld]
--variable=VAR VAR is one of:
pkgincludedir [/usr/local/Cellar/mariadb/10.0.13/include/mysql]
pkglibdir [/usr/local/Cellar/mariadb/10.0.13/lib]
plugindir [/usr/local/Cellar/mariadb/10.0.13/lib/plugin]
I will use the following settings for compiling and testing:
cflags (mysql_config) = -I/usr/local/Cellar/mariadb/10.0.13/include/mysql -I/usr/local/Cellar/mariadb/10.0.13/include/mysql/.. -g -DNDEBUG
embedded (mysql_config) =
ldflags (mysql_config) =
libs (mysql_config) = -L/usr/local/Cellar/mariadb/10.0.13/lib -lmysqlclient -lz -lssl -lcrypto
mysql_config (guessed ) = mysql_config
nocatchstderr (default ) = 0
nofoundrows (default ) = 0
ssl (guessed ) = 1
testdb (default ) = test
testhost (default ) =
testpassword (default ) =
testport (default ) =
testsocket (default ) =
testuser (guessed ) = nknight
To change these settings, see 'perl Makefile.PL --help' and
'perldoc DBD::mysql::INSTALL'.
Checking if your kit is complete...
Looks good
Using DBI 1.622 (for perl 5.016002 on darwin-thread-multi-2level) installed in /System/Library/Perl/Extras/5.16/darwin-thread-multi-2level/auto/DBI/
Writing Makefile for DBD::mysql
Writing MYMETA.yml and MYMETA.json
cp lib/DBD/mysql.pm blib/lib/DBD/mysql.pm
cp lib/DBD/mysql/GetInfo.pm blib/lib/DBD/mysql/GetInfo.pm
cp README.pod blib/lib/DBD/README.pod
cp lib/DBD/mysql/INSTALL.pod blib/lib/DBD/mysql/INSTALL.pod
cp lib/Bundle/DBD/mysql.pm blib/lib/Bundle/DBD/mysql.pm
cc -c -I/System/Library/Perl/Extras/5.16/darwin-thread-multi-2level/auto/DBI -I/usr/local/Cellar/mariadb/10.0.13/include/mysql -I/usr/local/Cellar/mariadb/10.0.13/include/mysql/.. -g -DNDEBUG -DDBD_MYSQL_WITH_SSL -DDBD_MYSQL_INSERT_ID_IS_GOOD -g -arch x86_64 -arch i386 -g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing -fstack-protector -I/usr/local/include -Os -DVERSION=\"4.028\" -DXS_VERSION=\"4.028\" "-I/System/Library/Perl/5.16/darwin-thread-multi-2level/CORE" dbdimp.c
/usr/bin/perl -p -e "s/~DRIVER~/mysql/g" /System/Library/Perl/Extras/5.16/darwin-thread-multi-2level/auto/DBI/Driver.xst > mysql.xsi
/usr/bin/perl /System/Library/Perl/5.16/ExtUtils/xsubpp -typemap /System/Library/Perl/5.16/ExtUtils/typemap mysql.xs > mysql.xsc && mv mysql.xsc mysql.c
Warning: duplicate function definition 'do' detected in mysql.xs, line 242
Warning: duplicate function definition 'rows' detected in mysql.xs, line 754
cc -c -I/System/Library/Perl/Extras/5.16/darwin-thread-multi-2level/auto/DBI -I/usr/local/Cellar/mariadb/10.0.13/include/mysql -I/usr/local/Cellar/mariadb/10.0.13/include/mysql/.. -g -DNDEBUG -DDBD_MYSQL_WITH_SSL -DDBD_MYSQL_INSERT_ID_IS_GOOD -g -arch x86_64 -arch i386 -g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing -fstack-protector -I/usr/local/include -Os -DVERSION=\"4.028\" -DXS_VERSION=\"4.028\" "-I/System/Library/Perl/5.16/darwin-thread-multi-2level/CORE" mysql.c
Running Mkbootstrap for DBD::mysql ()
chmod 644 mysql.bs
rm -f blib/arch/auto/DBD/mysql/mysql.bundle
LD_RUN_PATH="/usr/local/Cellar/mariadb/10.0.13/lib:/usr/lib" /usr/bin/perl myld cc -mmacosx-version-min=10.9 -arch x86_64 -arch i386 -bundle -undefined dynamic_lookup -L/usr/local/lib -fstack-protector dbdimp.o mysql.o -o blib/arch/auto/DBD/mysql/mysql.bundle \
-L/usr/local/Cellar/mariadb/10.0.13/lib -lmysqlclient -lz -lssl -lcrypto \
chmod 755 blib/arch/auto/DBD/mysql/mysql.bundle
cp mysql.bs blib/arch/auto/DBD/mysql/mysql.bs
chmod 644 blib/arch/auto/DBD/mysql/mysql.bs
Manifying blib/man3/DBD::mysql.3pm
Manifying blib/man3/DBD::README.3pm
Manifying blib/man3/DBD::mysql::INSTALL.3pm
Manifying blib/man3/Bundle::DBD::mysql.3pm
CAPTTOFU/DBD-mysql-4.028.tar.gz
/usr/bin/make -- OK
'YAML' not installed, will not store persistent state
Running make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/00base.t ........................... ok
t/10connect.t ........................ ok
t/15reconnect.t ...................... ok
t/20createdrop.t ..................... ok
t/25lockunlock.t ..................... ok
t/29warnings.t ....................... ok
t/30insertfetch.t .................... ok
t/31insertid.t ....................... ok
t/32insert_error.t ................... ok
t/35limit.t .......................... ok
t/35prepare.t ........................ ok
t/40bindparam.t ...................... ok
t/40bindparam2.t ..................... ok
t/40blobs.t .......................... ok
t/40catalog.t ........................ ok
t/40keyinfo.t ........................ ok
t/40listfields.t ..................... ok
t/40nulls.t .......................... ok
t/40nulls_prepare.t .................. ok
t/40numrows.t ........................ ok
t/40server_prepare.t ................. ok
t/40server_prepare_error.t ........... ok
t/40types.t .......................... ok
t/41bindparam.t ...................... ok
t/41blobs_prepare.t .................. ok
t/42bindparam.t ...................... ok
t/43count_params.t ................... ok
t/50chopblanks.t ..................... ok
t/50commit.t ......................... ok
t/51bind_type_guessing.t ............. ok
t/52comment.t ........................ ok
t/53comment.t ........................ ok
t/55utf8.t ........................... ok
t/60leaks.t .......................... skipped: Skip $ENV{EXTENDED_TESTING} is not set
t/65segfault.t ....................... ok
t/65types.t .......................... ok
t/70takeimp.t ........................ ok
t/71impdata.t ........................ ok
t/75supported_sql.t .................. ok
t/76multi_statement.t ................ 1/25 # Testing multicall against SQL_DBMS_VER: 10.0.13-MariaDB
t/76multi_statement.t ................ ok
t/80procs.t .......................... skipped: Your test user does not have ALTER_ROUTINE privileges.
t/81procs.t .......................... skipped: Your test user does not have ALTER_ROUTINE privileges.
t/85init_command.t ................... ok
t/86_bug_36972.t ..................... ok
t/87async.t .......................... ok
t/88async-multi-stmts.t .............. ok
t/89async-method-check.t ............. ok
t/90no-async.t ....................... skipped: Async support was built into this version of DBD::mysql
t/91errcheck.t ....................... ok
t/99_bug_server_prepare_blob_null.t .. ok
t/manifest.t ......................... skipped: these tests are for release testing
t/pod.t .............................. ok
t/rt25389-bin-case.t ................. ok
t/rt50304-column_info_parentheses.t .. ok
t/rt83494-quotes-comments.t .......... ok
t/rt85919-fetch-lost-connection.t .... ok
t/rt86153-reconnect-fail-memory.t .... skipped: Skip $ENV{EXTENDED_TESTING} is not set
t/rt91715.t .......................... ok
All tests successful.
Files=58, Tests=1254, 27 wallclock secs ( 0.23 usr 0.09 sys + 2.24 cusr 0.34 csys = 2.90 CPU)
Result: PASS
CAPTTOFU/DBD-mysql-4.028.tar.gz
/usr/bin/make test -- OK
Running make install
Files found in blib/arch: installing files in blib/lib into architecture dependent library tree
Installing /Library/Perl/5.16/darwin-thread-multi-2level/auto/DBD/mysql/mysql.bs
Installing /Library/Perl/5.16/darwin-thread-multi-2level/auto/DBD/mysql/mysql.bundle
Installing /Library/Perl/5.16/darwin-thread-multi-2level/Bundle/DBD/mysql.pm
Installing /Library/Perl/5.16/darwin-thread-multi-2level/DBD/mysql.pm
Installing /Library/Perl/5.16/darwin-thread-multi-2level/DBD/README.pod
Installing /Library/Perl/5.16/darwin-thread-multi-2level/DBD/mysql/GetInfo.pm
Installing /Library/Perl/5.16/darwin-thread-multi-2level/DBD/mysql/INSTALL.pod
Installing /usr/local/share/man/man3/Bundle::DBD::mysql.3pm
Installing /usr/local/share/man/man3/DBD::mysql.3pm
Installing /usr/local/share/man/man3/DBD::mysql::INSTALL.3pm
Installing /usr/local/share/man/man3/DBD::README.3pm
Appending installation info to /Library/Perl/Updates/5.16.2/darwin-thread-multi-2level/perllocal.pod
CAPTTOFU/DBD-mysql-4.028.tar.gz
sudo /usr/bin/make install -- OK
cpan[2]> Terminal does not support GetHistory.
Lockfile removed.
~$
~$ cat mysqltest.pl
#!/usr/bin/perl
# From http://search.cpan.org/~capttofu/DBD-mysql-4.028/lib/DBD/mysql.pm#EXAMPLE
use strict;
use DBI();
# Connect to the database.
my $dbh = DBI->connect("DBI:mysql:database=test;host=localhost",
"test", "",
{'RaiseError' => 1});
# Drop table 'foo'. This may fail, if 'foo' doesn't exist.
# Thus we put an eval around it.
eval { $dbh->do("DROP TABLE foo") };
print "Dropping foo failed: $@\n" if $@;
# Create a new table 'foo'. This must not fail, thus we don't
# catch errors.
$dbh->do("CREATE TABLE foo (id INTEGER, name VARCHAR(20))");
# INSERT some data into 'foo'. We are using $dbh->quote() for
# quoting the name.
$dbh->do("INSERT INTO foo VALUES (1, " . $dbh->quote("Tim") . ")");
# Same thing, but using placeholders
$dbh->do("INSERT INTO foo VALUES (?, ?)", undef, 2, "Jochen");
# Now retrieve data from the table.
my $sth = $dbh->prepare("SELECT * FROM foo");
$sth->execute();
while (my $ref = $sth->fetchrow_hashref()) {
print "Found a row: id = $ref->{'id'}, name = $ref->{'name'}\n";
}
$sth->finish();
# Disconnect from the database.
$dbh->disconnect();
~$ perl mysqltest.pl
DBD::mysql::db do failed: Unknown table 'test.foo' at mysqltest.pl line 15.
Dropping foo failed: DBD::mysql::db do failed: Unknown table 'test.foo' at mysqltest.pl line 15.
Found a row: id = 1, name = Tim
Found a row: id = 2, name = Jochen
~$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment