Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / Perl / November 2004



Tip: Looking for answers? Try searching our database.

DBD-MySQL problem with Panther

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Tom McDonough - 19 Nov 2004 20:34 GMT
I'm setting up a new iMac running Panther.

I downloaded MySQL, DBI and DBD-MySQL from fink but
removed it because it did not include mysqld_safe.

Then I downloaded MySQL and DBI (which installed
fine).  I downloaded DBD_MySQL and tried to install it
- from the desktop and via cpan -  after reading (and
implementing) the env hack published on this list on
Oct 15, 2003 and the Bundle::mysql download from cpan.

In both cases, the "make test" hangs at

t/00base...........ok                                
                     
t/10dsnlist........

and makefile.PL can't seem to find mysql_config which
is at

/usr/local/mysql-standard-4.1.7-apple-darwin7.5.0-powerpc/bin

This gets me way far from anything I know about.  

Here is a my install log for cpan and manual + the
contents of Makefile:

http://www.stantonwoods.com/after_env_hack

Sorry to bring up this old issue.
Tom McDonough

       

Sherm Pendley - 19 Nov 2004 21:46 GMT
> and makefile.PL can't seem to find mysql_config

Tell it where to find it. Instructions for that are in the INSTALL.html
document that came with the module.

While you're there, tell it what database, username, and password it
can use when running its self-tests. Otherwise they'll fail.

sherm--
Tom McDonough - 22 Nov 2004 18:13 GMT
Sherm,
I've read the INSTALL.html but I'm a stranger to
making files.  I  thought I could "tell it where to
find it" by following the instructions from your post
of 26 Feb 2004 but it still didn't find mysql_config.
A few more hints would be appreciated.  Thanks.
Tom

> > and makefile.PL can't seem to find mysql_config
>
[quoted text clipped - 8 lines]
>
> sherm--

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Sherm Pendley - 22 Nov 2004 19:01 GMT
> I've read the INSTALL.html but I'm a stranger to
> making files.  I  thought I could "tell it where to
> find it" by following the instructions from your post
> of 26 Feb 2004 but it still didn't find mysql_config.
> A few more hints would be appreciated.

Sorry, I misremembered the process. I thought you could tell  
Makefile.PL where to find mysql_config, but you can't. You need to run  
mysql_config yourself, and pass the options it lists to Makefile.PL.  
:-(

The post you're referring to is correct:

> So, you might try running 'mysql_config --libs' and 'mysql_config  
> --cflags' yourself, and passing the options it shows you to  
[quoted text clipped - 6 lines]
>     --cflags='-I/usr/local/mysql/include -O3 -fno-omit-frame-pointer' \
>     --libs='-L/usr/local/mysql/lib -lmysqlclient -lz -lm'

So, like I said, run "mysql_config --cflags":

    root#  
/usr/local/mysql-standard-4.0.21-apple-darwin7.5.0-powerpc/bin/
mysql_config --cflags

And take note of what it prints out:

     
-I/usr/local/mysql-standard-4.0.21-apple-darwin7.5.0-powerpc/include  
-fno-omit-frame-pointer

Then use that in the --cflags option you pass to "perl Makefile.PL".  
Repeat to get the "--libs" option.

sherm--
Tom McDonough - 22 Nov 2004 20:09 GMT
Sherm,
Sorry to be such a PIA but something is not working.
Here is the output of mysql_config:

TomMcDonough:local/mysql/bin] tom% sh mysql_config
--cflags
-I/usr/local/mysql/include/mysql
-fno-omit-frame-pointer
[TomMcDonough:local/mysql/bin] tom% sh mysql_config
--libs
-L/usr/local/mysql/lib/mysql -lmysqlclient -lm
../zlib/libz.la

mysql_config is here:

/usr/local/mysql-standard-4.1.7-apple-darwin7.5.0-powerpc/bin
or more simply
/usr/local/mysqlc/bin

And here is my makefile.pl command:

[TomMcDonough:~/desktop/dbd-mysql-2.9004] tom% perl
makefile.pl --cflags='-I/usr/local/mysql/include/mysql
-fno-omit-frame-pointer'
--libs='-L/usr/local/mysql/lib/mysql -lmysqlclient -lm
../zlib/libz.la'

And the results:
Can't exec "mysql_config": No such file or directory
at makefile.pl line 174.
readline() on closed filehandle PIPE at makefile.pl
line 176.

line 174 reads:

open(PIPE, "mysql_config --$param |");

I've never opened a shell script in a perl program but
to get results from mysql_config I have to do this:

% sh /usr/local/mysql/bin/mysql_config --cflags

Calling mysql_config from the command line does not
work.

Do I have to go into Makefile.PL and make a change?
Heaven forbid!

Tom

> > I've read the INSTALL.html but I'm a stranger to
> > making files.  I  thought I could "tell it where
[quoted text clipped - 34 lines]
>
>      root#  

/usr/local/mysql-standard-4.0.21-apple-darwin7.5.0-powerpc/bin/

> mysql_config --cflags
>
> And take note of what it prints out:
>
>      

-I/usr/local/mysql-standard-4.0.21-apple-darwin7.5.0-powerpc/include
>  
> -fno-omit-frame-pointer
[quoted text clipped - 4 lines]
>
> sherm--

       

Sherm Pendley - 22 Nov 2004 20:36 GMT
> TomMcDonough:local/mysql/bin] tom% sh mysql_config --cflags

You didn't follow directions. I didn't say anything about cd-ing to  
/usr/local/mysql/bin, nor did my example use sh to run the script. To  
paraphrase a popular saying - "you can't just make stuff up and hope it  
works."

> mysql_config is here:
>
> /usr/local/mysql-standard-4.1.7-apple-darwin7.5.0-powerpc/bin

Don't cd to that directory, don't use "sh" to run it, just run it:

/usr/local/mysql-standard-4.1.7-apple-darwin7.5.0-powerpc/bin/
mysql_config --cflags

A couple other things:

It's "Makefile.PL", not "makefile.pl". HFS+ is case-insensitive; most  
filesystems are not.

You need to use the "--testdb", "--testuser", and "--testpassword"  
options too.

sherm--
Tom McDonough - 22 Nov 2004 21:48 GMT
That did it Sherm.
Thanks.

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Dan Buettner - 22 Nov 2004 22:20 GMT
I'm working on a multithreaded perl script that will have a group of
threads uploading files via FTP.

I'd like to have each thread display status information in the
Terminal window, e.g.:

--------------------------------Terminal---------------------------------

Thr1  16:12:07: Uploading 'mysamplefile' (890.0 KB) to 'myhost.com'
##################################
Thr2  16:10:07: Uploading 'myBIGsamplefile' (99.1 MB) to 'myhost.com'
#################
Thr3  16:05:08: Uploaded 'lastfile' (5.1 MB) to 'ftpserver.com'

Thr4  16:13:06: Uploading littlefile' (44.8 KB) to 'anotherhost.com'
##########################

-------------------------------------------------------------------------

The # symbols above would be the hash output from Net::FTP as it uploads ...

Ideally, I'd like to have the window have a fixed display (no
scrolling) and always output the information from a specific thread
in a specific position.  In other words, Thread 1 gets the first 2
lines, Thread 2 gets lines 3 and 4, etc.

The script right now is not threaded, and using the hash output from
Net::FTP works great - divide filesize by 100 and set that to your
hash value to get a great text-based progress bar.

How could I put information into a static display like this?  And
could I still use the Net::FTP progress bar?

Suggestions appreciated.

Thanks,
Dan
Sherm Pendley - 22 Nov 2004 23:37 GMT
> How could I put information into a static display like this?

Have a look at the Curses module on CPAN.

sherm--
Bruce Van Allen - 22 Nov 2004 23:46 GMT
>Ideally, I'd like to have the window have a fixed display (no
>scrolling) and always output the information from a specific thread in
>a specific position.  In other words, Thread 1 gets the first 2 lines,
>Thread 2 gets lines 3 and 4, etc.

Maybe you could extrapolate from this, a simplified version of a
subroutine in my own local ::Utils module. The subroutine make_counter()
takes two arguments, a fixed initial part, here called $label, and a
starting number. It returns a closure that you use inside your loop.

Note the $|++, which assures immediate output (to the terminal screen).

For your use, what you especially want to get from this example is the
use of the Perl character "\b", which outside of regular expressions
means "backspace". The point is to print "\b" the same number of times
as the number of characters you want to back up before printing the
updated output. I believe you should be able to stack fixed and varying
lines with a little practice...

#!/usr/bin/perl

# trivial_count.pl

use strict;
use warnings;

$|++;

my $max     = $ARGV[0] || 10000;

print "Searching...\n";

my $counter = make_counter("Here's how many I've found: ");

for (1..$max) {
   print $counter->()
}

print "\n";

sub make_counter {
   my ($label,$start)  = @_;
   $label              ||= 'Count:';
   my $count           = $start ||= 1;
   my $flag            = 1;
   return sub {
       $flag ?
          $flag-- && "$label  " . $count :
              "\b" x length($count) . ++$count;
   }
}
__END__

bva$ perl /Volumes/Programming/trivial_count.pl 678
Searching...
Here's how many I've found:   678
bva$

HTH

- Bruce

__bruce__van_allen__santa_cruz__ca__
Wren Argetlahm - 23 Nov 2004 01:05 GMT
> For your use, what you especially want to get from
> this example is the use of the Perl character "\b",
> which outside of regular expressions means "
> backspace". The point is to print "\b" the same
> number of times as the number of characters you
> want to back up before printing the updated output.

Just an FYI if using this process (print
"\b"x$length), it's frequently good to put a sleep(1)
in there. Otherwise I've found that some glitchiness
can occour (with things not being completely deleted
before printing starts and vice-versa). I haven't
tested the specific code given which may be better
than a similar thing I have used, and sleep() may not
suit your purposes, but just figured I'd give a heads
up.

live well,
~wren

       

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.