Multiplay Labs

tech hits and tips from Multiplay

Archive for the ‘perl’ tag

Building DBD::mysql under Cygwin with mysql 5.5

without comments

The following instructions will enable you to build DBD::mysql under Cygwin using mysql 5.5 sources.

1. First download the latest mysql source from
2. Expand the source and change into the directory e.g. tar -xzf mysql-5.5.21.tar.gz; cd mysql-5.5.21
3. Prepare the Makefiles using cmake, we need to disable shared libs to avoid having to mess with LD_LIBRARY_PATH.


4. Build the client and libs:

make mysqlclient libmysql

4.1. If the build errors with duplicate definition for dtoa, then you can fix it by commenting out the cygwin definition in: /usr/include/stdlib.h (dont forget to remove the comment when done)
5. Install mysql components

sh -c 'for dir in client libmysql scripts include; do cd $dir; make install; cd -; done'

6. Build and install DBD::mysql via CPAN, if you don’t have a running mysql instance you may need to “force” install

perl -MCPAN -e shell
cpan[1]> install DBD::mysql

Written by Dilbert

February 29th, 2012 at 9:29 pm

Posted in Cygwin,Perl

Tagged with , , ,

Perl problems with query strings under Apache

without comments

Ever had a problem with query strings causing strange behaviour in apache when using the CGI module?
If you have the patch below might just save you some time and effort hunting down the problem.

---	Sat Mar  1 16:58:19 2008
+++	Sat Mar  1 18:39:21 2008
@@ -2779,5 +2779,10 @@
    my $raw_script_name = $ENV{SCRIPT_NAME} || '';
    my $raw_path_info   = $ENV{PATH_INFO}   || '';
-   my $uri             = unescape($self->request_uri) || '';
+   my $uri             = $self->request_uri || '';
+   # ensure we dont get any query string as that can include escaped //
+   # e.g. a url parameter, which will break the apache bug fix
+   $uri =~ s/\?(.*)$//; 
+   $uri = unescape($uri);
    my $protected    = quotemeta($raw_path_info);

Written by Dilbert

February 21st, 2009 at 11:45 pm

Posted in Code,Hackery,Perl

Tagged with , , ,

Running perl scripts from rc.d under FreeBSD

without comments

If you have even tried to run a perl script under FreeBSD’s startup system rc.d then you’ll have hit upon a little problem where it doesnt correctly recognise the running process on shutdown. There’s a simple fix for this just apply the patch below and you’ll be good to go.

--- /etc/rc.subr.orig	Mon Oct  8 18:31:34 2007
+++ /etc/rc.subr	Mon Oct  8 18:32:31 2007
@@ -271,5 +271,5 @@
 		_fp_match='case "$_argv" in
-		    ${_interp}|"${_interp} "*|"${_interpbn}: ${_procname}"*)'
+		    ${_interp}|"${_interp} "*|"[${_interpbn}]"|"${_interpbn}: ${_procname}"*)'
 	else					# a normal daemon

Written by Dilbert

February 21st, 2009 at 11:40 pm

Posted in Hackery,Perl

Tagged with , , ,