Re: New to list, greetings and a (newbie)problem
Then, when, in the terminal, I typed: hw.pl while in the same directory, I got the following message. tcsh: hw.pl: Command not found. what happens if you type : perl hw.pl ? ./allan
Re: [BUG ?] sort/reverse or RegExp problem
Quoting Ken Williams [EMAIL PROTECTED]: hmm, ok so if i do one test that actually matches late in my string and later do a test that would match earlier, the latter will never match ? i didn't know that; to me it doesn't sound logical. to me i'm doing a complete fresh test in the regexp so if i had a match in a previous regexp test it shouldn't matter since the string doesn't change and even the pos() shouldn't change because to me both are completely fresh anyway, thats how it is ... ./a sounds Hi Allan, No bug; here's a simpler example that shows what's going on. $str = one two; if ($str =~ /one/g) { print Found one\n } print pos(\$str): , pos($str), \n; if ($str =~ /two/g) { print Found two\n } print pos(\$str): , pos($str), \n; $str = one two; if ($str =~ /two/g) { print Found two\n } print pos(\$str): , pos($str), \n; if ($str =~ /one/g) { print Found one\n } print pos(\$str): , pos($str), \n; -Ken On May 17, 2004, at 2:35 PM, allan juul wrote: hi i have some difficulty with a rather simple loop and simple RegExp: please try the following code two times - one with no command line arguments and one with a true argument [the latter call will reverse the sorting of the hash keys] for example: $ net.pl $ net.pl 1 the funny thing is that even that perl guarantees me that the two strings $str and str2 are equal (which they should be since i assign them to each other just before the eq test), the RegExp only match when the keys in the hash are alphabetically sorted can anybody explain this ? thanks ./allan ### use strict; my %maps = ( i = 'somestring', j = 'someother', ); my $str = q( I:somestring J:someother ); foreach my $key (sort by_str keys %maps ) { my $str2 = $str; if ($str eq $str2) { print \n\tGoing to testing the key $key\n\tApparently the varibale \$str is identical to \$str2\n\n; } print Testing \$str ...\n; if ($str =~ m/^$key.+/mig) { print \tA match for \$str\n; } else { print \tHmm no match in \$str\n; } print Testing \$str2 ...\n; if ($str2 =~ m/^$key.+/mig) { print \tA match for \$str2\n; } else { print \tHmm no match in \$str2\n; } } sub by_str { if ($ARGV[0]) { ($b cmp $a) } else { ($a cmp $b) } } --
[BUG ?] sort/reverse or RegExp problem
hi i have some difficulty with a rather simple loop and simple RegExp: please try the following code two times - one with no command line arguments and one with a true argument [the latter call will reverse the sorting of the hash keys] for example: $ net.pl $ net.pl 1 the funny thing is that even that perl guarantees me that the two strings $str and str2 are equal (which they should be since i assign them to each other just before the eq test), the RegExp only match when the keys in the hash are alphabetically sorted can anybody explain this ? thanks ./allan ### use strict; my %maps = ( i = 'somestring', j = 'someother', ); my $str = q( I:somestring J:someother ); foreach my $key (sort by_str keys %maps ) { my $str2 = $str; if ($str eq $str2) { print \n\tGoing to testing the key $key\n\tApparently the varibale \$str is identical to \$str2\n\n; } print Testing \$str ...\n; if ($str =~ m/^$key.+/mig) { print \tA match for \$str\n; } else { print \tHmm no match in \$str\n; } print Testing \$str2 ...\n; if ($str2 =~ m/^$key.+/mig) { print \tA match for \$str2\n; } else { print \tHmm no match in \$str2\n; } } sub by_str { if ($ARGV[0]) { ($b cmp $a) } else { ($a cmp $b) } }
DBI /SQL Server question []
hi rather OT i gather but maybe its a general case on all platforms/dbs i have an annoying problem with sql server, maybe someone have encountered something similar - it concerns special (danish) characters that im unable to insert correctly in the db table (they seem to be escaped with an even stranger char in the db) if i print the words that i want to insert to a txtfile i can see that they are correct at that point this works: -- my $word = 'hardcoded with special chars: æøå'; my $sql = insert into $table (word) values (?); my $sth = $dbh-prepare( $sql ); $sth-execute($word); this doesn't work: - foreach my $word (keys %hash) { my $sql = insert into $table (word) values (?); my $sth = $dbh-prepare( $sql ); $sth-execute($word); print OUT $sql ($word)\n; # looks correct }
sort/order by [perl or possibly postgres]
hi using a postgres db i have run into a sort order problem because i need to order by a varchar type field/column. im not aware of any function in postgres that might order the result set correctly beforehand so i guess i want to post-sort the result-set with perl. i'm looking for something pretty effecient as the datastructure could be potentially big [ so in the end i need this order: 1 2 3 9 10 11 11a 11b 110 ] i have got the following sql syntax and datastructure # sql, and data structure $sth = $dbh-prepare( SELECT id, name, team_no from DB order by team_no ); # etc. $sth-execute(); $sth-bind_columns( undef, \$id, \$name, \$team_no); while ( $sth-fetch ) { $tied_hash{$team_no} = [$id, $name]; } ... using tied_hash would currently sort something like this: 1 10 11 110 11a 11b 2 3 9 any suggestions most welcome thanks ./allan
dbi 1.35 on mac os x [10.2.4]
hi i wonder why i can't install DBI version 1.35. below is some stdout from a cpan session suggesting to send a bug report. i am quite sure that other people has done this before me at least with version 1.30. [i had no problem installing 1.25 by the way]. i have perl 5.8 with threads insatlled basically i wonder if the lines below makes sense for some on this list ? thanks ./allan -- cp lib/DBI/ProfileData.pm blib/lib/DBI/ProfileData.pm /usr/bin/perl -p -e s/~DRIVER~/Perl/g blib/arch/auto/DBI/Driver.xst Perl.xsi /usr/bin/perl /opt/perl/lib/5.8.0/ExtUtils/xsubpp -typemap /opt/perl/lib/5.8.0/ExtUtils/typemap Perl.xs Perl.xsc mv Perl.xsc Perl.c cc -c -pipe -fno-common -no-cpp-precomp -fno-strict-aliasing -I/usr/local/include -O3 -DVERSION=\1.35\ -DXS_VERSION=\1.35\ -I/opt/perl/lib/5.8.0/darwin-thread-multi/CORE -Wall -Wno-comment Perl.c cc1: warning: changing search order for system directory /usr/local/include cc1: warning: as it has already been specified as a non-system directory Perl.c: In function `dbixst_bounce_method': Perl.c:783: internal error: Bus error Please submit a full bug report, with preprocessed source if appropriate. See URL:http://developer.apple.com/bugreporter for instructions. {standard input}:5758:FATAL:.abort detected. Assembly stopping. make: *** [Perl.o] Error 1 /usr/bin/make -- NOT OK Running make test Can't test without successful make Running make install make had returned bad status, install seems impossible
getting $1, $2 etc. in evaled regexp
hi perl question eh, is not possible to get the values in parens when you do a reg match on an evaled string ? consider the snippt below, how do i get the values into $1, $2 etc ... my $str = /(.{11})(.{10})/i; my $line = test string etc etc test string; if ($line =~ eval(/ . $str . /)) { print id = $1\n; print pw = $2\n; } thanks ./allan
Re: getting $1, $2 etc. in evaled regexp
of course, you are right! ./allan Quoting Michael P. Wilson [EMAIL PROTECTED]: Allan, I'm pretty sure you don't have to go through the eval to do what you're trying to do. Can't you just build the regex straight like that, with the $str? if ($line =~ /$str/) {...} or am I just imagining things because it's 3:30 in the morning? - M On Tuesday, Feb 25, 2003, at 03:03 America/New_York, allan juul wrote: hi perl question eh, is not possible to get the values in parens when you do a reg match on an evaled string ? consider the snippt below, how do i get the values into $1, $2 etc ... my $str = /(.{11})(.{10})/i; my $line = test string etc etc test string; if ($line =~ eval(/ . $str . /)) { print id = $1\n; print pw = $2\n; } thanks ./allan - Thus nature has no love for solitude, and always leans, as it were, on some support; and the sweetest support is found in the most intimate friendship. - Cicero --
visual debugger ?
hi i tried the active state visual debugger the other day and found it extremely easy and rather convenient to use. does anyone know of a similar product that works under os x ? ./allan
Re: closing and opening a browser
Adam Wells wrote: At 14:02 -0800 12/10/02, bob ackerman wrote: On Tuesday, December 10, 2002, at 01:31 PM, Matt Morse wrote: also i'm interesed in opening a browser with a valid internet address as argument but i can't find out the syntax for mac os x - can anyone give a hand with that? You can use the open command (see the man page for details): open -a Internet\ Explorer http://www.cnn.com or, if you don't want to specify a particular app: open http://www.cnn.com neither worked for me. first example opened explorer w/o trying to access the url. 2nd example got 'No such file' prepended with current path. ditto, exactly the same happened to me Do you have a preferred browser set in the Web tab of the Internet control panel? I tried this and it worked for me, launching my preferred browser with the appropriate URL. i have a default browser (IE 5.2 /OS X). this will not launch unless i do open -a Internet\ Explorer.app http://www.cnn.com the url address won't load though thanks anyway ./allam
request: dyld explained
hi i have seen phrases like dyld: Undefined symbols many times mentioned on this list. trying to install Brocolage i'm encountering the showstopper from hell: Text::Iconv...dyld: perl Undefined symbols: _libiconv _libiconv_close _libiconv_open might sound ignorant, but can anyone in plain words explain exactly [more or less] what this dyld-business means ? if it sinks in, i reckon it'll be easier to undertand error-messages containg those phrases ;) thanks ../allan
Re: Bricolage Installation (was Re: request: dyld explained)
have you visited david wheeler's *excellent* website ? http://david.wheeler.net/ [i have but is stuck ob the dyld affair] ../allan Chris wrote: I am interested in Bricolage and things on which Bricolage depends (e.g., Mason). When you have success, could you kindly post what finally worked? Perl version, particular versions of Bricolage's dependencies I have got myself cornered at the moment on a non-critical development machine and I'd prefer to have a solution that did not involve a reinstall, as this will not be acceptable on my production box when I see a similar problem. Many thanks! --Chris
postgres - dbi
i have installed postgreSQl on osX. now im hoping to use the DBD::Pg having run Makefile.PL for DBD-Pg-1.01, i do: % make then i get this message: please set environment variables POSTGRES_INCLUDE and POSTGRES_LIB ! so i guess i have to: setenv POSTGRES_INCLUDE something_i_dont_know setenv POSTGRES_LIB something_i_dont_know can anyone please help me in how to set these environment variables? thanks ../allan
PDF - problems
hello, has anyone have had problems with the PDF module? these two are really annoying: 1) i have a folder mainly with pdf-files that are all strangely named and not ending woith the .pdf extension. if i traverse this folder and use the code below i get this message: % Can't read cross-reference section, according to trailer per file if i rename the files including the .pdf extension one by one i can see the code works? 2) if i use the code with the -w switch i get: % Use of uninitialized value in numeric ne (!=) at /Library/Perl/PDF.pm line 38. why is that? my $filename = whatever_found_in_this_dir; my $pdf=PDF-new ; $pdf=PDF-new($filename); next if ( $pdf-IsaPDF ) ; thanks allan
mod_perl installation (once again)
hello i have recenty posted a message to the mod_perl list regarding installation of mod_perl. apparently im not building mod_perl properly. from what i gather via posts to this list from Benjamin John Turner and John Siracusa i should: %cd mod_perl-1.26 %perl Makefile.PL APACHE_SRC=../apache_1.3.20/src DO_HTTPD=1 USE_APACI=1 PREP_HTTPD=1 EVERYTHING=1 PERL_TRACE=1 %make %sudo make install %cd ../apache_1.3.20 %./configure --enable-module=rewrite --enable-shared=rewrite --activate-module=src/modules/perl/libperl.a %make %sudo make install did not help - same situation. (ie - i am able to start apache but cab not include the perl-directives in the httpd.conf) then i tried to configure apache with --enable-rule=SHARED_CORE which first gave me some of those familiar dyld multiple definitions of symbol erros. and the second time i got too many errors in make to install at all. i simply dont get it - does it matter that im running perl 5.6? (im currently downloading 5.6.1) should i remove something in the base core? in fact how do i clean up this mess and do a clean installation of apache and or mode_perl? i have done things like make realclean but that doesnt remove old stuff like conf-files. again any help much appriciated thanks ./allan _ !--mod_perl-1.26 on apache_1.3.20 on mac osX (10.0.4)-- i am trying to get mod_perl up and running om mac osX. i am quite sure i have installed correctly, at least according to the 99.23% okay test-report (see below). asuming everything is installed ok (in fact how do i actually know wheter mod_perl is properly installed?) i must so something wrong in the configuration. i have followed Stas Bekmans slide-instructions for configuring and have in my httpd.conf file included the same kind of perl-directive lines which i am not 100% sure are correct (see below). this is the location of my cgi-bin: /library/webserver/cgi-executables this is the location of my usual web documnets: /library/webserver/documents so this is where i would think mod_perl material should go: /library/webserver/perl if i uncomment the perl-directive lines from the httpd.conf, i can run good old cgi-scripts no problem. and when i start apache i will get this message in the error-log: [Sat Aug 4 16:04:56 2001] [notice] Apache/1.3.20 (Darwin) PHP/4.0.4pl1 configured -- resuming normal operations i hope the above or below information is enough to one of you to solve this probably trivial problem:-) thanks ./allan testreport Failed Test Status Wstat Total Fail Failed List of failed --- modules/src.t 63 50.00% 3-5 6 tests skipped. httpd terminated Failed 1/34 test scripts, 97.06% okay. 3/390 subtests failed, 99.23% okay. make: *** [run_tests] Error 9 /testreport perldirective=on [localhost:/source/apache_1.3.20/mod_perl-1.26] allanjuu% sudo /usr/sbin/apachectl start Password: Syntax error on line 1029 of /etc/httpd/httpd.conf: Invalid command 'PerlModule', perhaps mis-spelled or defined by a module not included in the server configuration /usr/sbin/apachectl start: httpd could not be started /perldirective snippet =/etc/httpd/httpd.conf 1027 # for Apache:: Registry mode 1028 Alias /perl/ /library/webserver/perl 1029 PerlModule Apache::Registry 1030 Location /perl 1031 SetHandler perl-script 1032 PerlHandler Apache::Registry 1033 Options ExecCGI 1034 allow from all 1035 PerlSendHeader On 1036 /Location /snippet
Re: perl in bbedit - LC_ALL LANG
It's quite possible you're launching a new version of a shell, hence I'd guess to be sure your .cshrc (or-what-shell-have-you) should, mayhap have the environmental set (eg, setenv LANG en_US)... i did that (before i installed perl 5.6.1) setenv LC_ALL C setenv LANG en_US but the problem is still there (only from bbedit) thanks allan
mod_perl - head - HEAD - lwp
im also trying to get started with mod:perl on osX below is a qoute from the cpan testers: For a long time I couldn't get mod_perl to compile on Darwin. It turned out that when I installed LWP (a prerequisite for running the mod_perl tests) it created /usr/bin/HEAD, which clobbered /usr/bin/head, which is necessary during the build process. When I cleared this up, mod_perl built tested flawlessly. how do one clear this up? thanks allan
Re: mod_perl - head - HEAD - lwp
but of course i want - thanks!! Ken Williams wrote: [EMAIL PROTECTED] (allan) wrote: im also trying to get started with mod:perl on osX below is a qoute from the cpan testers: For a long time I couldn't get mod_perl to compile on Darwin. It turned out that when I installed LWP (a prerequisite for running the mod_perl tests) it created /usr/bin/HEAD, which clobbered /usr/bin/head, which is necessary during the build process. When I cleared this up, mod_perl built tested flawlessly. That's from me. You'll need to find someone with the proper 'head' binary (much easier than finding the source and compiling it yourself) and have them mail it to you as an attachment or whatever. Then move 'HEAD' into /usr/local/bin/ (along with GET and POST and a few lwp-* programs), and put the real 'head' into /usr/bin/. I can send you the 'head' binary if you want. ------ Ken Williams Last Bastion of Euclidity [EMAIL PROTECTED]The Math Forum
installing Msql-Mysql-modules-1.2216.tar.gz
hi sorry for the length of this mail - my basic question is just: how do you succesfully install the Msql-Mysql-modules-1.2216 on macosX? (i only need the mysql part of this module, and i already have the mysql database server running smoothly) please see extensive shell-dump below - commands seperated by newline. im not too fond of words like: warning, Unrecognized, undefined and error ... anyone got a clue? many thanks i nadvance allan _ [localhost:/applications] aju% cd Msql-Mysql-modules-1.2216 [localhost:/applications/Msql-Mysql-modules-1.2216] aju% ls ChangeLog MANIFEST.SKIP README libmysql tests MANIFEST Makefile.PLdbdmSQL nodbd [localhost:/applications/Msql-Mysql-modules-1.2216] aju% perl makefile.pl Which drivers do you want to install? 1) MySQL only 2) mSQL only (either of mSQL 1 or mSQL 2) 3) MySQL and mSQL (either of mSQL 1 or mSQL 2) 4) mSQL 1 and mSQL 2 5) MySQL, mSQL 1 and mSQL 2 Enter the appropriate number: [3] 1 Do you want to install the MysqlPerl emulation? You might keep your old Mysql module (to be distinguished from DBD::mysql!) if you are concerned about compatibility to existing applications! [n] Where is your MySQL installed? Please tell me the directory that contains the subdir 'include'. [/usr/local] Which database should I use for testing the MySQL drivers? [test] On which host is database test running (hostname, ip address or host:port) [localhost] User name for connecting to database test? [undef] Password for connecting to database test? [undef] Creating files for MySQL Checking if your kit is complete... Looks good Note (probably harmless): No library found for -lgz Unrecognized argument in LIBS ignored: 'libgcc.a' Using DBI 1.15 installed in /Library/Perl/darwin/auto/DBI Writing Makefile for DBD::mysql Writing Makefile for Msql-Mysql-modules [localhost:/applications/Msql-Mysql-modules-1.2216] aju% make mkdir blib mkdir blib/lib mkdir blib/arch mkdir blib/arch/auto mkdir blib/arch/auto/Msql-Mysql-modules mkdir blib/lib/auto mkdir blib/lib/auto/Msql-Mysql-modules mkdir blib/man1 /usr/bin/perl -Iblib/arch -Iblib/lib -I/System/Library/Perl/darwin \ -I/System/Library/Perl -Ilib -MExtUtils::PerlPP \ -e ppp dbd/dbimon.in dbimon lib/DBD/mysql/Install/Config.pm /usr/bin/pod2text mysql/lib/DBD/mysql.pm README mkdir ../blib/lib/DBD mkdir ../blib/arch/auto/DBD mkdir ../blib/arch/auto/DBD/mysql mkdir ../blib/lib/auto/DBD mkdir ../blib/lib/auto/DBD/mysql mkdir ../blib/man3 cp lib/DBD/mysql.pm ../blib/lib/DBD/mysql.pm cp lib/Mysql/Statement.pm ../blib/lib/Mysql/Statement.pm cp lib/Bundle/DBD/mysql.pm ../blib/lib/Bundle/DBD/mysql.pm cp lib/Mysql.pm ../blib/lib/Mysql.pm cc -c -I/Library/Perl/darwin/auto/DBI -I/usr/local/include/mysql -I../dbd -I/Library/Perl/darwin/auto/DBI -I/System/Library/Perl/darwin -g -pipe -pipe -fno-common -DHAS_TELLDIR_PROTOTYPE -fno-strict-aliasing -O3 -DVERSION=\2.0416\ -DXS_VERSION=\2.0416\ -I/System/Library/Perl/darwin/CORE -DDBD_MYSQL dbdimp.c /usr/bin/perl -p -e s/~DRIVER~/mysql/g /Library/Perl/darwin/auto/DBI/Driver.xst mysql.xsi /usr/bin/perl -I/System/Library/Perl/darwin -I/System/Library/Perl /System/Library/Perl/ExtUtils/xsubpp -typemap /System/Library/Perl/ExtUtils/typemap mysql.xs mysql.xsc mv mysql.xsc mysql.c Warning: duplicate function definition 'rows' detected in mysql.xs, line 381 cc -c -I/Library/Perl/darwin/auto/DBI -I/usr/local/include/mysql -I../dbd -I/Library/Perl/darwin/auto/DBI -I/System/Library/Perl/darwin -g -pipe -pipe -fno-common -DHAS_TELLDIR_PROTOTYPE -fno-strict-aliasing -O3 -DVERSION=\2.0416\ -DXS_VERSION=\2.0416\ -I/System/Library/Perl/darwin/CORE -DDBD_MYSQL mysql.c Running Mkbootstrap for DBD::mysql () chmod 644 mysql.bs LD_RUN_PATH=/usr/local/lib/mysql:/usr/lib cc -o ../blib/arch/auto/DBD/mysql/mysql.bundle -bundle -undefined suppress dbdimp.o mysql.o -L/usr/local/lib/mysql-L/usr/local/lib/mysql -lmysqlclient -lm -lz /usr/bin/ld: table of contents for archive: /usr/local/lib/mysql/libmysqlclient.a is out of date; rerun ranlib(1) (can't load from it) make[1]: *** [../blib/arch/auto/DBD/mysql/mysql.bundle] Error 1 make: *** [subdirs] Error 2 [localhost:/applications/Msql-Mysql-modules-1.2216] aju% make test LD_RUN_PATH=/usr/local/lib/mysql:/usr/lib cc -o ../blib/arch/auto/DBD/mysql/mysql.bundle -bundle -undefined suppress dbdimp.o mysql.o -L/usr/local/lib/mysql-L/usr/local/lib/mysql -lmysqlclient -lm -lz /usr/bin/ld: table of contents for archive: /usr/local/lib/mysql/libmysqlclient.a is out of date; rerun ranlib(1) (can't load from it) make[1]: *** [../blib/arch/auto/DBD/mysql/mysql.bundle] Error 1 make: *** [subdirs] Error 2 __
Re: installing Msql-Mysql-modules-1.2216.tar.gz
I have posted complete instructions for installing DBI::mysql under Mac OS X at http://duke.usask.ca/~dalglb/macosx/ thanks - i did manage to install it, however, about 91% of the tests still fail. these are mainly a problem with connecting to the mysql server, which is definetly running and visible in the processlist of the shell-inspector. my best guess is that it must have to with permissions somehow, but then again if im sudo'ing the make test, shouldnt i have access to everything more or less? another thing: when i try to rebuild the Msql-Mysql module i now dont get the prompt for a host, username and password - why is that? (when running the tests i can see it says using password:YES - does this litteraly means a password called YES or does it mean yes im using the password you entered somewhere when you initially build me?) in fact is it possible to do a clean install of this (or any module) that removes the old files? thanks once again -e allan
decompressing tar.gz
hi i wish to install the dbi, lwp modules from cpan. ive downloaded the two tar.gz files the problem is that i am unable to decompress them from within osX ive tried things like: gzip -dc module.tar.gz | tar -xof gnutar -xvf module.tar.gz tar -xvf module.tar.gz and others as well. obvoiusly not 100% sure of what im doing ... there are no decompressing them with stuffit exp. but i guess this leaves the relevant files in mac-format. can anyone point me in the right direction. thanks allam
Re: decompressing tar.gz
to everone who just, so quickly, replied - thanks it works brilliantly! allan
apache started (test page/cgi needed)
hello. i posted a queston regarding getting apache started/installed properly on OSX. thanks for all the replies! i did in fact get the server up and running and even got the apache test-page shown in internet explorer on the 127.0.0.1 addres then i wanted to test some simple cgi-scripts ... (which is the vague perl-relation to all this) 1) i guess i have to configure the httpd.conf file to accept cgi-programs in any directory, but even if i dont, how can i get a simple hello world in my browser? since then i have apparently messed too much about because now i have this strange problem: i can re-install apache from scratch, make a configtest syntactically ok, and do the usr/sbin/apachect1 start, restart or stop from the command line but im not able to hit any page from my browser window. so my question probably is: 2) can i properly uninstall apache (including old files like the httpd.file) and start afresh, or should i look elsewhere? any pointers appriciated. thanks allan