A Net::Config problem
I have never been able to set up Net::Config properly, and, for the life of me, I can't figure out what I am doing wrong. According to the Net::Config manual: Net::Config holds configuration data for the modules in the libnet distribuion. During installation you will be asked for these values. The configuration data is held globally in a file in the perl installation tree, but a user may override any of these values by providing their own. This can be done by having a .libnetrc file in their home directory. This file should return a reference to a HASH containing the keys described below. For example .libnetrc { nntp_hosts = [ my_prefered_host ], ph_hosts = [ my_ph_server ], } I've got a .libnetrc file in my home directory. It reads { 'nntp_hosts' = [ news.dacor.net ], 'smtp_hosts' = [ mail.dacor.net ], 'pop3_hosts' = [ mail.dacor.net, mailstore.bgsu.edu ], } and the test script %mylibnet = %{do $ENV{HOME}/.libnetrc}; for (keys %mylibnet) { print $_ = @{$mylibnet{$_}}\n; } produces just what it should, namely smtp_hosts = mail.dacor.net pop3_hosts = mail.dacor.net mailstore.bgsu.edu nntp_hosts = news.dacor.net Nevertheless, use Net::Config qw(%NetConfig); always produces the, more or less empty, hash %NetConfig = ( 'ftp_int_passive' = 0, 'test_exist' = 1, 'time_hosts' = [], 'ftp_testhost' = undef, 'inet_domain' = undef, 'test_hosts' = 1, 'nntp_hosts' = [], 'smtp_hosts' = [], 'pop3_hosts' = [], 'snpp_hosts' = [], 'ph_hosts' = [], 'daytime_hosts' = [], ); contained in /System/Library/Perl/5.8.1/Net/libnet.cfg. What am I doing wrong here? At this point Net::Config is useless (unless I decide to rewrite libnet.cfg). Thanks for any help you can give me! Vic
Re: DBD-MySQL problem with Panther
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 --- Sherm Pendley [EMAIL PROTECTED] wrote: On Nov 19, 2004, at 3:34 PM, Tom McDonough wrote: 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-- __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Re: DBD-MySQL problem with Panther
On Nov 22, 2004, at 1:13 PM, Tom McDonough wrote: 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 Makefile.PL. On my system the result is something like this: perl Makefile.PL \ --testdb=test \ --testuser= \ --testpassword= \ --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--
Re: DBD-MySQL problem with Panther
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 --- Sherm Pendley [EMAIL PROTECTED] wrote: On Nov 22, 2004, at 1:13 PM, Tom McDonough wrote: 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 Makefile.PL. On my system the result is something like this: perl Makefile.PL \ --testdb=test \ --testuser= \ --testpassword= \ --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-- __ Do you Yahoo!? Meet the all-new My Yahoo! - Try it today! http://my.yahoo.com
Re: DBD-MySQL problem with Panther
On Nov 22, 2004, at 3:09 PM, Tom McDonough wrote: 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--
Re: DBD-MySQL problem with Panther
That did it Sherm. Thanks. __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Options for control of output in Terminal?
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
Re: Options for control of output in Terminal?
On Nov 22, 2004, at 5:20 PM, Dan Buettner wrote: How could I put information into a static display like this? Have a look at the Curses module on CPAN. sherm--
Re: Options for control of output in Terminal?
On 2004-11-22 Dan Buettner wrote: 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] || 1; 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__
Re: Options for control of output in Terminal?
--- Bruce Van Allen [EMAIL PROTECTED] wrote: 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 \bx$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 __ Do you Yahoo!? Meet the all-new My Yahoo! - Try it today! http://my.yahoo.com
Re: A Net::Config problem
Hi Vic, you wrote... I've got a .libnetrc file in my home directory. It reads { 'nntp_hosts' = [ news.dacor.net ], 'smtp_hosts' = [ mail.dacor.net ], 'pop3_hosts' = [ mail.dacor.net, mailstore.bgsu.edu ], } I've thrown that file into my home directory as .libnetrc, and then try to use it with Net::Config via -- #!/usr/bin/perl use strict; use Net::Config qw(%NetConfig); use Data::Dumper::Simple; warn Dumper(%NetConfig); -- And out she comes... %NetConfig = ( 'pop3_hosts' = [ 'mail.dacor.net', 'mailstore.bgsu.edu' ], 'ftp_firewall' = undef, 'ph_hosts' = [], 'time_hosts' = [], 'inet_domain' = undef, 'smtp_hosts' = [ 'mail.dacor.net' ], 'daytime_hosts' = [], 'test_exist' = 1, 'test_hosts' = 1, 'nntp_hosts' = [ 'news.dacor.net' ], 'snpp_hosts' = [], 'ftp_ext_passive' = 0, 'ftp_int_passive' = 0 ); I don't know if this is more help than hindrance, but at least it's another data point! Cheers, Paul