Re: Bizarre install behaviour
On Sat, Nov 22, 2008 at 11:41 PM, [EMAIL PROTECTED] wrote: The failed test is lib/Module/Build/t/tilde..# Failed test at ../lib/Module/Build/t/tilde.t line 49. # got: '/var/root' # expected: '/Users/robin' This failure is probably unrelated to your other ones - it's a test bug in Module::Build 0.30 (which we'll have a fix for in a few days). The workaround is to make sure you run cpan as your normal user, and only use 'sudo' for the 'install' phase. That's a safer way to operate anyway. -Ken
Re: Thanks Apple! You snubbed perl yet again!
On Oct 17, 2007, at 10:43 AM, [EMAIL PROTECTED] wrote: On Oct 17, 2007, at 5:25 PM, brian d foy wrote: In article [EMAIL PROTECTED], [EMAIL PROTECTED] wrote: It looks like I will have to stick with debian for developing my LAMP applications. If you want to work on the Mac, you still can. It doesn't sound like you want to though. It may sound like that to you, but if I didn't want to develop (in perl) on the Mac, why would I bother writing about this at all? Perhaps brian thought it was odd that you'd refuse to develop on a platform because of the wrong marketing statements, when all the right tools are there for both you and any target users. -Ken
Re: File::Path rmtree portability (works on OS X, fails on WinXP)
On Sep 28, 2007, at 5:52 PM, Jim wrote: # define build dir path if ($runOS eq win){ $buildDir = .PSF\\builds\\$version; } else { $buildDir = /builds/$version; } # test for dir and remove if it exists if ( -d $buildDir) { # using File::Path here for directory removal use File::Path; rmtree $buildDir,1,0; } Everything works as expected on OS X, but on WinXP, rmtree seems to fail with the following error... Can't call method rmtree without a package or object reference The problem is because of a different version of perl, not rmtree() itself. One version of perl is interpreting your code as $buildDir-rmtree, 1, 0; and the other as you intended: rmtree( $buildDir, 1, 0 ); If you add the parens explicitly, the problem should go away. -Ken
Re: XML - Attribute/Element names and XML::Simple module
On Jun 12, 2007, at 8:50 PM, Jim wrote: I'm having a bear of a time figuring out why XML::Simple seems to want to make both the attribute and child element of a specific element into their own elements. I'm starting to wonder if the XML supplied as input is illegally formatted? There's nothing wrong with your XML, there's of course no prohibition against attributes and children with the same names. You can run / usr/bin/xmllint on it to be sure. If XML::Simple is messing it up, that must be a bug. -Ken
Re: CamelBones - Does anyone still care about Jaguar?
On Apr 9, 2007, at 3:07 PM, Sherm Pendley wrote: Subject says it all. Would dropping Jaguar support bother anyone? Wouldn't bother me. For most of my modules I try to support 5.6 just because it makes me feel like a nice guy, but for CamelBones I think it's perfectly reasonable to require a recent perl. It's a complex beast. -Ken
Re: Interacting with other applications
On Mar 23, 2007, at 9:56 AM, David Cantrell wrote: Consider what happens if I'm busily typing away, and the dialogue box pops up and grabs focus, and then whatever its default is gets selected because i hit space or enter. That's exactly what a couple applications do on my machine (Backup.app and a shareware reminder for SideTrack), and I agree it's annoying. A better behavior would probably be a bouncing dock icon that defaults to yes after 30 seconds or whatever. Still annoying, but it wouldn't actually cause problems. -Ken
Re: Running a PERL script from a PERL CGI
On Feb 7, 2007, at 4:33 PM, Philippe de Rochambeau wrote: if (param()) { my $ret = ` perl script_that_retrieves_a_file_by_ftp_and_sends_it_by_email.pl `; Try losing the double quotes. Methinks that long-named script isn't even running. -Ken
Re: Strange problem with @INC
On Jan 9, 2007, at 6:25 PM, Jesse Engel wrote: i'm poking through man x to see if i can find something. That's a red herring. As Jay indicated, the only difference between your two environments is that under Terminal.app you've got $PERL5LIB set (to /sw/lib/perl5), but under X11 you don't. -Ken
Re: How to know if a module is installed
On Sep 27, 2006, at 10:25 AM, David Cantrell wrote: On Thu, Sep 28, 2006 at 12:00:34AM +0900, Nobumi Iyanaga wrote: This is a newbie question: how can I determine if a specific module is installed on a client machine? if(eval use Whatever::Module) { do this; } else { do that; } use() isn't documented to have a return value, so you need to do this: if(eval use Whatever::Module; 1) { do this; } else { do that; } -Ken
Script menu makes perl zombies?
Hi, For months I've been trying to figure out what's causing some perl zombie processes on my system. Looks like it might be the script menu. I have a script menu item called tunnels.pl that establishes some SSH tunnels, and it works fine. But after I run it, I see this: % ps auxww|grep '[p]erl' ken 14697 0.0 0.00 0 ?? Z31Dec69 0:00.00 (perl) Its parent process is 1982, which is /System/Library/CoreServices/ SystemUIServer.app/Contents/MacOS/S ystemUIServer -psn_0_786433 . Can other people confirm this? Any known bug covering this or something (not sure where to look)? -Ken
Re: Script menu makes perl zombies?
I'm talking about the script menu: http://www.apple.com/applescript/scriptmenu/ Did you run your script from the script menu? -Ken On Sep 8, 2006, at 11:16 AM, Michael Barto wrote: I am not quite sure how you mean to verify this.
Re: iCal modules
On Aug 10, 2006, at 4:30 PM, Christian Huldt wrote: sudo find / -name gluemac -print Heh - try this: locate gluemac and see how much faster it is. =) -Ken
Re: anyone know where i can get 10.3 Developers Tools?
Wasn't it included in /Applications/Installers/ on 10.3? Or was that just for certain hardware models? -Ken On Jul 28, 2006, at 7:41 AM, Adam Witney wrote: This may be slightly off topic, but I have just bought an iBook off eBay, and it comes with a fresh install of 10.3, however it doesn't have the Developers Tools installed. I will be using this for Perl development, so i need to be able to compile and install modules, do i need the whole Developers Tools? I can only seem to find these for 10.4 on the apple site... does anyone know if i can still download the Developer Tools for 10.3 or is there another way of getting the tool set i need for compiling custom modules?
Re: convert string to number?
On Jul 7, 2006, at 3:18 AM, Adam Witney wrote: then the error goes away, therefore i suspect this is a problem with the internal datatype. I have never worried about this in Perl before, but it appears to be more important now as R is more strict. I'd call this a bug in the RSPerl code, actually. If it's looking for a number, it should use the SvNV() or SvIV() macros (to get a double or integer, respectively). I suspect it's using SvIOK() or SvNOK(), which don't attempt to do any automatic coercion. This forces you, the caller, to do it. Check out the first couple pages of `perldoc perlguts` for the details. -Ken
Re: Mac::Carbon for Intel ... Done?
On Jun 19, 2006, at 9:40 PM, Paul McCann wrote: Hi Chris, Go play with it, if you have an Intel Mac. Let me know if you find anything wrong, and let me know soon, since I have less than a week left with this Intel Mac. The module (Mac-Carbon-0.75) was fine through make on my intel Mac (modulo all the deprecated warnings of course, which I imagine should be ignored). However make test failed with the following problem: AppleEvents/t/desc.NOK 2# Failed test 'require '$Bin/ helper.pl';' # in AppleEvents/t/desc.t at line 11. # Tried to require ''$Bin/helper.pl''. # Error: Can't locate $Bin/helper.pl in @INC Chris: it's not interpolating the $Bin variable and the quotes are literal quotes too. -Ken
Re: Storable problem on Intel Mac Mini
On May 12, 2006, at 6:05 AM, Joel Rees wrote: On 2006.5.12, at 10:01 AM, Mike Schienle wrote: Hi all - I just installed an Intel Mac Mini as a replacement for a dual 1.8 GHz G5 at my colocation place a couple days ago. Can I ask a silly question in public, or would off-list be more appropriate? Apparently you can! =) -Ken
Re: Storable problem on Intel Mac Mini
Yeah, any time you use Storable to move data from a big-endian machine to a little-endian machine, or vice versa, you need to use network format, i.e. the nstore() or nstore_fd() functions. The only way I know of to convert the existing files you've got is to find a G5 or another old-world mac and do a retrieve() nstore() cycle on the data. -Ken On May 11, 2006, at 8:01 PM, Mike Schienle wrote: Hi all - I just installed an Intel Mac Mini as a replacement for a dual 1.8 GHz G5 at my colocation place a couple days ago. All seems to be going fine with one exception so far. This error is showing up in my web error logs: [Thu May 11 19:21:18 2006] [error] [client 67.155.17.98] Byte order is not compatible at blib/lib/Storable.pm (autosplit into blib/lib/auto/Storable/_retrieve.al) line 331, DATA line 4, at /Library/Tenon/WebServer/WebSites/blosxom/plugins/calendar line 322, referer: http://www.customvisuals.com/ This is from the blosxom weblog program, so it was a simple matter of just turning off the calendar function for now. However, the issue with Storable.pm still remains. Has anyone run into this? Mike Schienle
Re: openning file...
On Apr 1, 2006, at 2:49 AM, kurtz le pirate wrote: hello, mac os x store file name in utf-8 format. so, how to open file with special characters in name ? a very simple exemple is a file name that begin with space. if i write : open(FILE, Read in a file), perl return an error: *** can't open [ Read in a file] : No such file or directory That's just because open() trims whitespace from the front of the argument. See the open() docs in perlfunc: -- ... The filename passed to 2-argument (or 1-argument) form of open() will have leading and trailing whitespace deleted, and the normal redirection characters honored. This property, known as magic open, can often be used to good effect. A user could specify a filename of Frsh cat file |, or you could change certain filenames as needed: $filename =~ s/(.*\.gz)\s*$/gzip -dc $1|/; open(FH, $filename) or die Can't open $filename: $!; Use 3-argument form to open a file with arbitrary weird characters in it, open(FOO, '', $file); otherwise it's necessary to protect any leading and trailing whitespace: $file =~ s#^(\s)#./$1#; open(FOO, $file\0); ... -- The 3-argument form of open() is definitely preferred. -Ken
Re: flock
On Feb 2, 2006, at 5:01 PM, James Reynolds wrote: As I understand it, in C, if I open (create) a file and want to lock it, I should pass in the O_EXLOCK flag at the same time, otherwise, I've got a race condition, another process could potentially lock the file after I've created it, but before I've locked it. Right. Does Perl have this problem if I use: open (FILE, data.txt); flock (FILE, 2); Well, there's no problem if you're just reading, because if you don't get the lock then you just abort (or wait). Only the flock() needs to be atomic by itself, not the open() and the flock() together. If you need to write too, then you need to acquire an exclusive lock, which I don't know any way to do in perl atomically with the open(). One way to be safe would be to open the file for both reading and writing, try to acquire the exclusive lock, and if you can't, then abort without doing any writing (or wait until you can). -Ken
Re: Newbie Q about vars sub-routines
It's fine if you think it's fine, but it might get difficult to manage in a large codebase. An alternative with more encapsulation would be this: { my $interact = 0; sub interact { $interact } } sub ask { return 1 unless interact(); # otherwise do user-prompt stuff } -Ken On Jan 3, 2006, at 6:16 AM, James Harvard wrote: I'm building a script that uses a sub-routine for user-interaction: if ( ask('Do you want to do this?') ) { # do stuff } I'd like to have a switch variable that allows me to toggle the user-interaction mode. In other words, if $interact is false then ask() will not prompt the user and will return true. I see that Perl does not complain if I do this ... my $interact = 0; sub ask { return 1 unless $interact; # otherwise do user-prompt stuff } ... but is that considered bad programming practice? It seems like unnecessary extra typing to pass $interact as an argument to the sub-routine every time, or to always do if ( (! $interact) || ask ). Many TIA, James Harvard
Re: CPAN modules ...
On Dec 31, 2005, at 7:43 PM, John Delacour wrote: At 6:49 pm -0500 31/12/05, Chris Devers wrote: On Sat, 31 Dec 2005, John Delacour wrote: print `/usr/bin/./printenv` ^^ Why the '/./' here? Isn't `/usr/bin/printenv` equivalent, clearer, and simpler? Sure, but I didn't get that far. printenv works in tcsh without the path but not in bash, so I tried that in bash, it worked and voilĂ . That's because in tcsh it's a built-in shell command, but in bash it invokes /usr/bin/printenv. For some reason you seem not to have /usr/bin in your path or something. -Ken
Re: CPAN modules not included with OS X
On Dec 29, 2005, at 7:03 PM, James Reynolds wrote: Grumble. That is exactly what I wanted to know! Thanks! Does CPAN install C libraries to /usr/local/lib or somewhere else? I could search for all new files right after a CPAN install. Anything that gets installed during 'make install' (or 'Build install' if you're using Module::Build) will be present in the blib/ directory after a 'make' (or a 'Build'). Precisely where the things from blib/ *go* during the install is a matter of how you've configured things, your system layout, etc. -Ken
Re: eval a string with a hash ref?
On Nov 13, 2005, at 12:16 AM, Boysenberry Payne wrote: On Nov 12, 2005, at 10:18 PM, Ken Williams wrote: The pretend you have methods instead of subroutines solution is just wishful thinking, Just out of curiosity, why is this wishful thinking? Because he doesn't have methods, he has functions. They're expecting one argument, the hash ref, not an additional $self or $class argument at the beginning. In order to use this solution he'd have to retool his entire code base of functions to make them methods instead. -Ken
Re: eval a string with a hash ref?
On Nov 13, 2005, at 1:22 AM, Sherm Pendley wrote: On Nov 12, 2005, at 11:18 PM, Ken Williams wrote: Yeah, I know, but I posted it because I didn't really like the other solutions; while they use better (and more complicated) techniques, they won't actually solve the OP's problem. The pretend you have methods instead of subroutines solution is just wishful thinking, and the dispatch tables solution seems overengineered and won't work unless the specific list of allowed functions (rather than just a naming-scheme pattern or similar) is known to the dispatcher. The subroutines have to be known anyway. Unless, of course, you're going to let the eval() just crash... They have to *exist*, but they don't have to be known to the dispatcher. When in doubt, benchmark it: [...] Benchmark: timing 10 iterations of Dispatch Table, Eval, Symref... Dispatch Table: 17 wallclock secs (14.77 usr + 0.29 sys = 15.06 CPU) @ 6640.11/s (n=10) Eval: 155 wallclock secs (139.45 usr + 3.23 sys = 142.68 CPU) @ 700.87/s (n=10) Symref: 18 wallclock secs (17.49 usr + 0.35 sys = 17.84 CPU) @ 5605.38/s (n=10) Yeah, that seems about right. The Eval results are no surprise - it has to compile the string for each iteration, which is a huge performance hit. The symref approach has some overhead too, I suppose because of the extra scoping block for no strict, but it's relatively small. Still, it's enough to make using symrefs a questionable idea. Well, symrefs do start out as a questionable idea in the first place. It's old-school programming reminiscent of goto and poke. But it seemed like exactly what James was looking for - he had the name of a function in a variable and wanted to call it. So rather than treat this as an x-y problem, I decided to just answer the question straightforwardly. -Ken
Re: eval a string with a hash ref?
On Nov 12, 2005, at 1:56 AM, James Reynolds wrote: Is there someway to execute this code like this: $subroutine_name = something; # can't change $hashref-{'key'}='value'; # can't change eval $subroutine_name($hashref); # how do I eval this? It doesn't eval. You want: eval $subroutine_name(\$hashref); -Ken
Re: eval a string with a hash ref?
On Nov 12, 2005, at 4:12 PM, Randal L. Schwartz wrote: Ken == Ken Williams [EMAIL PROTECTED] writes: Ken You want: Ken eval $subroutine_name(\$hashref); Only if you also want slow and dangerous'. See the other answers in this thread for safer faster solutions. Yeah, I know, but I posted it because I didn't really like the other solutions; while they use better (and more complicated) techniques, they won't actually solve the OP's problem. The pretend you have methods instead of subroutines solution is just wishful thinking, and the dispatch tables solution seems overengineered and won't work unless the specific list of allowed functions (rather than just a naming-scheme pattern or similar) is known to the dispatcher. James, if you don't want to use an eval, and you need to call functions by name this way, you can just use a symbolic reference: {$subroutine_name}($hashref); If use strict; is in effect (I'm guessing it's not ;-), then preface that line with no strict qw(refs); or else it'll blow up. Note that under the hood this is a dispatch table just like Sherm's solution, but it uses Perl's symbol tables for dispatch rather than a new hash. I'm assuming you're being careful enough in this code that someone can't come along and call some function that you don't want them to call. -Ken
Re: print 3 up labels
On Nov 10, 2005, at 2:46 PM, Jay Savage wrote: On 11/10/05, Joseph Alotta [EMAIL PROTECTED] wrote: Greetings, I want to print Avery 6140 labels with name and address from a mac. Is there a library. If not, does anyone know how to set a font and tab a certain number of inches to print 3 columns? Joe Alotta A CPAN search is your best friend here. Avery label turns up PostScript::MailLabels, labels, and Paper::Specs. Other search terms will undoubtedly turn up other results. Take a look and see what works for you. Or AddressBook can print mailing labels in lots of Avery formats natively. You could create some data in a format that it can import, then print there. -Ken
Re: Help Wanted: Testing CamelBones on Intel
On Oct 25, 2005, at 12:53 PM, Sherm Pendley wrote: On Oct 15, 2005, at 9:02 PM, Sherm Pendley wrote: What about if I built a universal binary for y'all to try? Done. As the announcement mentions, the recent release of ShuX, as well as the CamelBones framework itself, are built as universal binaries. So, of someone with an Intel Mac would download ShuX and give it a click, I'd be most appreciative. I feel bad seeing this entire thread Warnocked three times, but I'm afraid I'm unable to do anything substantive about it - perhaps Intel Macs are still so rare out there that nobody on this list actually has one. Maybe try p5p if you haven't already? -Ken
Re: Get/set file type/creator in plain Perl?
On Aug 3, 2005, at 10:22 AM, Sherm Pendley wrote: On Aug 3, 2005, at 10:35 AM, Iyanaga Nobumi wrote: But now I have it twice, once in /System/Library/Perl/Extras/5.8.6/darwin-thread-multi-2level/, and the other in /Library/Perl/5.8.6/darwin-thread-multi-2level. Does this make some conflict? No conflict. @INC is searched in order, and the first one found is used. /Library/Perl appears before /System/Library/Perl in @INC for precisely this reason, so that you can install newer versions of the modules that came with Perl, and they'll be used instead of the older ones. Unfortunately that's not true, unless it's changed recently: % perl -le 'print for @INC' /System/Library/Perl/5.8.1/darwin-thread-multi-2level /System/Library/Perl/5.8.1 /Library/Perl/5.8.1/darwin-thread-multi-2level /Library/Perl/5.8.1 /Library/Perl /Network/Library/Perl/5.8.1/darwin-thread-multi-2level /Network/Library/Perl/5.8.1 /Network/Library/Perl . So if you want to install a copy in /Library/Perl/ and use it rather than the built-in one, you have to delete the copy in /System/Library/Perl/ . -Ken
Re: problems with WWW::Curl, perl 5.8.7, Mac Mini, 10.4.2
On Jul 21, 2005, at 11:06 PM, Joel Rees wrote: I installed 5.8.7 on a Mac Mini running 10.4.2 under /usr/local, executables in /usr/local/bin, used .bash_profile to add /usr/local/bin to the front of my path (bleaugh). (Hesitated about installing gpg, but trying to build it gave me a huge bunch of integer precision errors with the sign bit so I decided to just move ahead. Does cpan use openssl if it doesn't find gpg? Or does it just not bother to check the checksums/signatures?) sudid cpan, with the .cpan file under /usr/local/share/perl. (Is that reasonable?) Tried to install WWW:Curl from the cpan prompt. At the make test stage, I get about twenty occurences of Bareword CURLOPT_MUTE not allowed while strict subs It looks like WWW::Curl isn't happy under 5.8.7. That's a compile-time error, so it's never even getting off the ground. Definitely not related to CPAN, or Mac Mini, or 10.4.2. Best bet is to report this to the author of WWW::Curl. -Ken
Re: psync backup problems: suggestions?
On Jul 13, 2005, at 1:56 PM, Joseph Alotta wrote: Hi Randall, How did you get it to work? I had trouble getting cpan to install File::MacOS and I put it out to the group and nobody offered a way to get it to compile. Look at the first message in this very thread - the one that says SOLVED in the subject. -Ken
Re: Cat and Dos2unix Command Line Utilities?
On Jul 8, 2005, at 9:57 PM, Joseph Alotta wrote: On Jul 8, 2005, at 9:26 PM, Chris Devers wrote: #!/bin/sh perl -pi -e tr/\r//d Hi Chris, I tried to call perl directly. But this does not work at all. Does anyone know why? #!/usr/bin/env perl -pi -e tr/\r//d Because using 'env' doesn't preserve switches. Personally, I use a tcsh alias: % which dos2unix dos2unix:aliased to perl -pi -e tr/\r//d But Chris' script could become: #!/usr/bin/perl -pi tr/\r//d which would save one level of processes but no longer search the $PATH. -Ken
Re: psync and MacOSX::File installing with cpan
On Jul 8, 2005, at 10:56 PM, Chris Devers wrote: The first failed test is: use MacOSX::File::Catalog; ... my $asked = askgetfileinfo(dummy); $asked eq avbstcLinmed ? ok(1) : ok(0); Dan, it would be helpful if you'd just write lines like this simply as: ok $asked, avbstcLinmed; because then people can turn on TEST_VERBOSE=1 and see how the output differs from the expected output. -Ken
Re: building 5.8.7 on 10.4
On Jul 7, 2005, at 5:57 AM, Joel Rees wrote: Just accepted all the defaults. sudo make gave one error: [...] cc -L/usr/local/lib -force_flat_namespace -o miniperl \ miniperlmain.o opmini.o libperl.a -ldl -lm -lc ./miniperl -w -Ilib -MExporter -e '?' || make minitest make: [extra.pods] Error 1 (ignored) [...] and make test You shouldn't run sudo make and then make test without sudo. The first step may create items that the second step can't deal with. In general the only step that you should use sudo for is sudo make install. All previous steps should be done as your regular non-privileged user. -Ken
Re: building 5.8.7 on 10.4
On Jul 7, 2005, at 6:04 PM, Joel Rees wrote: Anyway, I should be able to just install it, then? Yeah, it sounds like it - I wasn't familiar with that locale issue, but if Dominic says it's okay then it probably is. If you want more details about the failure, you might be able to run make test VERBOSE=1 TEST_FILES=lib/locale.t and look at the output. -Ken
Re: How to build 5.4.5 on OS X
On Jul 4, 2005, at 2:41 AM, Michael G Schwern wrote: With a hint from Jarkko I got 5.4.5 to build on OS X. Here's how. Do I hear a 5.4.6 in the future, then? ;-) -Ken
Re: [OT?] Dynamically loading Perl into C programs
Hi Wren, Probably the first place to look is perldoc perlembed, which describes in general how to embed a perl interpreter in C programs. There's no way that I know of for embedding chunks of perl (e.g. subroutines) in C without embedding the entire perl interpreter too. To do so would require compiling perl down to machine code, which isn't possible in any clean way. Apache2's libperl seems completely unrelated, except that it also happens to be another example of someone embedding a perl interpreter in a C program (the apache web server). -Ken On Jun 28, 2005, at 3:13 AM, wren argetlahm wrote: There's a project I'm working on (Paperboy RSS) that's written in C, the simplest part of which is basically applying XSLT to files with libxml2/libxslt. There's a separate but related project written in Perl that's going to use paperboy to do the heavy lifting but needs to be able to let users define their own XSLT/XPath functions. Since these functions are user-defined I need to find some way to dynamically load them into paperboy at runtime. So my question is, what's the best/easiest way to do this? Ideally paperboy would be dynamically loading another C object file so that we could have a number of these for writing xpath functions in different languages; though that's not strictly a requirement. I've had Apache2's libperl suggested to me, but my weak google-fu can seem to find anything relevant on that. Any guidance is appreciated. Live well, ~wren __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Re: Flat file being Scrambled
Hey Mark, I doubt any mortal brain could follow all the various permutations of clients hitting your files and trying to lock them while some other client is doing the same. But here's one way your data could get hosed: one client reads the file in between the time another client opened it for writing (thus blowing it away) and locked it. I'd suggest opening the file for both reading *and* writing, and not making any changes to the file until you can get your lock. Keep the file locked for the entire duration you've got the filehandle open. If you want, you can use a shared lock up until you start to write, at which point you can convert to an exclusive lock. How you get your data back, well, that's another matter. I suggest going back in time and using an SQLite or Berkeley DB database to begin with. -Ken On Jun 15, 2005, at 5:49 PM, Mark Wheeler wrote: Hi, Here's a quick question. This doesn't have anything to do with perl on my mac, but just a perl question. I have a a small script that simply increases a number by 1, when it is run, then writes the changes back to the file. I am using it to check how many people come to the site by way of an email. Everything seemed to work fine until I got here this morning and the file was only left with 1 row of 1 number verses 2 rows of 10 numbers each. Here is what the file should look like (The zeros would not necessarily be zeros, but could be any number. 0:0:0:0:0:0:0:0:0:0 0:0:0:0:0:0:0:0:0:0 What I have found is that when I click at a normal pace, everything works fine, BUT... when I click the reload button unmercifully, the data file gets rewritten to look like the following: 0 (or some other number - less then what it was previously) That's it! everything else is gone. Is is possible that if there are so many hits that it can't keep up with the opening and writing of the file? This simple database is potentially being alter by 2 million people, as the email went out to that many people. Any help would be greatly appreciated. Below is the script. Thanks, Mark Wheler Here is the script: -- #!/usr/local/bin/perl -w #=== # format for ab variable in html email: # # control(0)/test(1):week(1-10) # # So 0:5 would be control group, week 5 and 1:9 would be # test group, week 9 #=== use strict; use CGI ':standard'; if (!-e blastinfo-test.txt) { # Create blastinfo-test.txt file in not in place open (FILE, blastinfo-test.txt) || die (Cannot open file); flock (FILE, 2); print FILE 0:0:0:0:0:0:0:0:0:0\n0:0:0:0:0:0:0:0:0:0; close (FILE); } #=== # Set and get variables #=== my $pathtolandingpage='../email_blasts/carnival/carnival1.html'; my $pathtodatafile='blastinfo-test.txt'; my @blasts_split; my $ab = param('ab'); my @ab_split = split(/:/, $ab); $ab_split[1]--; #my $anchor = param('anchor'); open (FILE, $pathtodatafile) || die $!; flock (FILE, 2); my @blasts = FILE; close (FILE); if ($ab_split[0] eq 0) { chomp($blasts[0]); @blasts_split = split(/:/, $blasts[0]); $blasts_split[$ab_split[1]]++; $blasts[0] = join(:, @blasts_split).\n; } else { @blasts_split = split(/:/, $blasts[1]); $blasts_split[$ab_split[1]]++; $blasts[1] = join(:, @blasts_split); } # # Write changes back to file # open (FILE, $pathtodatafile) || die (Cannot open file); flock (FILE, 2); print FILE @blasts; close (FILE); # # Send to landing page at correct anchor # print Location: $pathtolandingpage\n\n; exit; --
Re: CamelBones on Intel? Maybe not.
On Jun 9, 2005, at 4:39 AM, wren argetlahm wrote: --- Edward Moy [EMAIL PROTECTED] wrote: So what is really needed at this point is for the CamelBones community to get together and innovate. Create some killer apps with CamelBones. Get developer excited about this technology. I'll bite. Dunno if it'd count as killer or not but I have a F/OSS project I've been working on that's been looking for a GUI for a while. We were going to go with Python for cross-platformability, but I've been thinking about learning Cocoa for a while and have really wanted to use CB for *something*. It seems like the Fink Commander application could also have been written well in CB. It's an example of a fairly broad category of applications: Cocoa interfaces to perl modules. What with the depth breadth of CPAN, that's seems like it would be a pretty broad category. -Ken
Re: Frickin' CPAN
I feel like nobody's listening... Look at your 'tar', 'unzip', 'lynx', and 'gzip' entries. They don't actually include the name of the program. Here are the equivalent ones from my config: 'gzip' = q[/usr/bin/gzip], 'lynx' = q[], 'tar' = q[/usr/bin/tar], 'unzip' = q[/usr/bin/unzip], -Ken On Jun 9, 2005, at 10:04 AM, John Mercer wrote: Hi guys, Firewall problems? Or config problems? Or both? I've found that CPAN works when I run sudo perl -MCPAN etc, but not when I run as root: macbox:/ root# perl -MCPAN. I find that very strange, but hey, if it works as sudo, it works and that's all I need. However, it doesn't work very well. When I run CPAN it take FOREVER to download modules, but then installs them pretty quickly (at least when there aren't any errors--and I often have plenty). Could my firewall by interfering with CPAN? I don't have anything fancy: just the OSX Tiger firewall and a Netgear router on a home-office network. Do I need to tweak some obscure config file so that CPAN can get in and out of the firewall. PPM also takes forever to download, if it downloads at all. In case it help, I've appended the sudo/root config file below. Please let me know if anything's wrong w/ it. Many thanks, John Mercer /System/Library/Perl/5.8.6/CPAN/Config.pm build_cache20 build_dir /var/root/.cpan/build cache_metadata 1 cpan_home /var/root/.cpan dontload_hash ftp/usr/bin/ftp ftp_proxy getcwd cwd gpg gzip /usr/bin histfile /var/root/.cpan/histfile histsize 100 http_proxy inactivity_timeout 0 index_expire 1 inhibit_startup_message 0 keep_source_where /var/root/.cpan/sources lynx /sw/bin make /usr/bin/make make_arg make_install_arg makepl_arg ncftpget /usr/bin/ncftpget no_proxy pager /usr/bin/less prerequisites_policy ask scan_cache atstart shell /bin/sh tar/usr/bin term_is_latin 1 unzip /usr/bin urllist ftp://ftp.sunsite.utk.edu/pub/CPAN/ ftp://ftp.theshell.com/pub/CPAN/ ftp://ftp.uwsg.iu.edu/pub/perl/CPAN/ ftp://linux.cs.lewisu.edu/pub/CPAN ftp://mirror.candidhosting.com/pub/CPAN ftp://mirror.cc.columbia.edu/pub/software/cpan/ ftp://mirror.datapipe.net/pub/CPAN/ ftp://mirror.hiwaay.net/CPAN/ ftp://mirror.sg.depaul.edu/pub/CPAN/ ftp://mirror.sit.wisc.edu/pub/CPAN/ ftp://mirror.xmission.com/CPAN/ ftp://mirrors.ibiblio.org/pub/mirrors/CPAN ftp://mirrors.jtlnet.com/CPAN/ ftp://mirrors.kernel.org/pub/CPAN ftp://mirrors.phenominet.com/pub/CPAN/ ftp://mirrors.rcn.net/pub/lang/CPAN/ ftp://perl.secsup.org/pub/perl/ http://cpan.belfry.net/ http://cpan.binarycompass.org http://cpan.mirrors.hoobly.com/ http://cpan.mirrors.nks.net/ wget /sw/bin/wget On Jun 8, 2005, at 9:56 PM, Ken Williams wrote: Hi John, The permissions thing is a red herring. Look more closely at the error message. It's trying to run a program called /usr/bin. Look at your CPAN configuration (o conf in the CPAN shell) to figure out why. -Ken On Jun 8, 2005, at 3:14 PM, John Mercer wrote: Hi all, CPAN is being a pain in the ass, and I don't know what the problem is. Here's an error message when I run install Bundle::XML. Can't exec /usr/bin: Permission denied at /System/Library/Perl/5.8.6/darwin-thread-multi-2level/IO/File.pm line 176, FIN line 1. Could not pipe[/usr/bin --decompress --stdout /var/root/.cpan/sources/authors/01mailrc.txt.gz |]: Permission denied at /System/Library/Perl/5.8.6/CPAN.pm line 5727, FIN line 1. When I try to run install XML::XPath I get about 20 repetitions of Subroutine AUTOLOAD redefined at /sw/lib/perl5/5.8.6/darwin-thread-multi-2level/Compress/Zlib.pm line 84, FIN line 2 Regarding the first error, I don't see how I can have a permissions error when I'm running CPAN as the root user. Root has--I checked--read, write, execute permissions in that directory (/System/Library/etc, etc). Regarding the second error, I have no idea what that's about. Could fink have somehow messed up my perl installation. In case this helps, I'm running Perl 5.8.6 under OSX 10.4 on Macmini. I'm running all the install scripts as root. Any help would really be appreciated. Thanks. --John M
Re: CamelBones on Intel? Maybe not.
On Jun 8, 2005, at 5:53 AM, Sherm Pendley wrote: There's been some discussion on the Perl 5 Porters' list as well, wondering if Apple could set up accounts on a 'net-accessible machine. Such a machine would be helpful to several others besides myself. The latest CB version supports standalone .pl scripts. So an account on a shared machine would be quite adequate to for me to run the CB self-tests. Yeah, I was thinking the same thing. Access to a compile test farm would be really nice for those of us who can do all of our testing in the shell environment. -Ken
Re: Frickin' CPAN
Hi John, The permissions thing is a red herring. Look more closely at the error message. It's trying to run a program called /usr/bin. Look at your CPAN configuration (o conf in the CPAN shell) to figure out why. -Ken On Jun 8, 2005, at 3:14 PM, John Mercer wrote: Hi all, CPAN is being a pain in the ass, and I don't know what the problem is. Here's an error message when I run install Bundle::XML. Can't exec /usr/bin: Permission denied at /System/Library/Perl/5.8.6/darwin-thread-multi-2level/IO/File.pm line 176, FIN line 1. Could not pipe[/usr/bin --decompress --stdout /var/root/.cpan/sources/authors/01mailrc.txt.gz |]: Permission denied at /System/Library/Perl/5.8.6/CPAN.pm line 5727, FIN line 1. When I try to run install XML::XPath I get about 20 repetitions of Subroutine AUTOLOAD redefined at /sw/lib/perl5/5.8.6/darwin-thread-multi-2level/Compress/Zlib.pm line 84, FIN line 2 Regarding the first error, I don't see how I can have a permissions error when I'm running CPAN as the root user. Root has--I checked--read, write, execute permissions in that directory (/System/Library/etc, etc). Regarding the second error, I have no idea what that's about. Could fink have somehow messed up my perl installation. In case this helps, I'm running Perl 5.8.6 under OSX 10.4 on Macmini. I'm running all the install scripts as root. Any help would really be appreciated. Thanks. --John M
Re: CamelBones on Intel? Maybe not.
Hey Sherm, I have two suggestions. Since I know you to be a very good programmer with a very good knowledge of how things work under OS X, I suggest going straight to Apple and pitching the idea of developing CamelBones for them. It could work out quite well if the arrangement is crafted well enough. Or, set up a storefront and start charging some money for a premium version of camelbones, or charging a specific amount of money for support licenses. But to be honest, I'm not surprised you haven't received enough donations yet to keep afloat. A google search for camelbones donate gives no useful results, nor did I see any invitation to donate by browsing on your site. But even if it were there, I don't think donations make a business model. Support licenses and premium products can, though. -Ken On Jun 6, 2005, at 4:51 PM, Sherm Pendley wrote: This is not a decision to be made lightly, nor quickly. I'm not writing this to announce the end. But really, something's got to give here - I need to pay the rent, and so far, CamelBones isn't doing it. If something doesn't change - a job, serious financial backing, something - the end may not be very far off.
Re: BBEdit/Interarchy
On Jun 3, 2005, at 7:34 AM, Ken Williams wrote: On Jun 2, 2005, at 10:16 AM, Bill Stephenson wrote: So I guess what I'm asking is if there a way to get either of these apps to upload a file with a new name and rename it after the upload is complete with one click. Obviously, this doesn't entirely solve the problem, but it does reduce the potential. Actually, it *would* entirely solve the problem. Renaming a file is an atomic operation, there's no point at which anybody could get a partial file. People still reading the old file would be fine too, even if the rename happened while they're in the middle of reading; the old file is readable until they close it. Peter pointed out in a private email that this isn't reliable using FTP's rename functionality (if your FTP even supports it) - what I meant in the above, though I wasn't clear, was to use /bin/mv on the server, not a rename through the FTP connection. -Ken
Re: keychain
Hi Joseph, In my address book, I've got several of those too. I believe they're certificates from people who have signed their messages. If you don't know them, they're probably on a list you're on. -Ken On Apr 19, 2005, at 11:31 PM, Joseph Alotta wrote: Hi Everyone, I looked at man security, just for kicks and I dumped the keychains. I was suprised to find email addresses for people who I do not know. I am a single user powerbook with dial up 56k access. Is this normal to have email keychain data for people I do not know? I could post those emails, but in case they're legitimate, I don't want them to get spammed. Any suggestions? Joe. On Apr 19, 2005, at 7:47 PM, Ken Williams wrote: Yeah, check out the 'security' command-line program. I use it in conjunction with Module::Release so that I don't have to type my PAUSE password every time I upload something to CPAN - it just fetches the password from my keychain. -Ken On Apr 19, 2005, at 5:01 PM, Larry Landrum wrote: I need to authenticate users in a perl CGI and was hoping to use the Keychain but can't find a perl way to do that. Has anybody done that before?
Re: Installing Mac::Carbon / gcc
On Apr 16, 2005, at 9:17 AM, Chris Nandor wrote: NB: Under Tiger, gcc 4 is in use, and Mac::Carbon will not build under gcc 4. One therefore also needs to set gcc to 3.3 under Tiger. Anyone who wants to take on this project of getting it to build under gcc 4 would be my own private hero. Wow. I didn't even know there *was* a gcc 4. Is 5 coming out, like, next week, then? And 6 the next day? -Ken
Re: character encoding on file upload name
On Apr 7, 2005, at 3:04 PM, John Delacour wrote: You're talking of file names, I suppose. I think you'll find that this is a function of the file system which stores file names in decomposed form, for what reason maybe someone else can tell you. So that the OS can quickly compare filenames in a case-independent fashion. -Ken
Re: GUI for Perl
On Mar 21, 2005, at 2:33 PM, john horner wrote: I'm new round here (just bought a new Mac with Mac OS 10.3.5). I want to build perl apps that can have things dropped on them and display alerts and file chooser dialogues. Nobody's mentioned Pashua yet, which I found very interesting. It will give you dialogs with all the normal options, radio buttons, checkboxes, drop menus etc but it's not a full application-creating tool. http://www.bluem.net/downloads/pashua_en/ There's also Mac::Carbon, which will give you access to a few basic file choosers and question dialogs. -Ken
Re: GUI for Perl
On Mar 21, 2005, at 9:51 PM, Sherm Pendley wrote: When you build a Perl from source, you specify a prefix. The default prefix is /usr/local. The installation doesn't necessarily have to conform to the PREFIX-oriented directory structure - the lib/ and arch/ and bin/ and man/ sections and so on can be spread out in various places (e.g. /System/Library/Perl/ and /Library/Perl/). It's not at all clear that a directory should be selected, for one thing. For another, choosing a directory and assuming the binary name is perl probably isn't the best choice anyway - if you want to choose /usr/local/bin/perl5.8.4, for instance, you're out of luck. A better solution would be to require a file selection, and only allow files that match either perl or perlx.y.z to be selected. I think there should be no restrictions on the filename. Some people compile debugging binaries and call them /usr/local/bin/perldb. Some people name their binaries after their dogs. Better to just let the user choose whatever binary or symlink they have, regardless of where it is or what it's called. If you need to find the other components of that installation, you can consult the %Config entries. -Ken
Re: Taint mode (was Re: Variables in external file)
On Feb 19, 2005, at 1:51 AM, wren argetlahm wrote: Which reminds me... I've been using the #!/usr/bin/env perl shebang for easier distribution, but env doesn't like switches. Is there a way to set taint mode via `use` or the like (ala use warnings; for -w). No. By definition, any switch in the script itself would be too late to set taint mode. Even a '-T' in the shebang line doesn't work if the script is invoked as perl foo.pl instead of ./foo.pl. In that case it'll just die with the error 'Too late for -T option'. See 'man perldiag'. -Ken
Re: Variables in external file
On Feb 18, 2005, at 10:39 AM, Mark Wheeler wrote: Hi, Just a quick question. Is it possible to have a bunch of variables in a separate file and then require that file in the script file? It's generally not a wise choice. Better to use something like Data::Dumper to write the data to a file, then load it back in the way the Data::Dumper manpage describes. Or YAML (as Rich pointed out), or Storable, etc. If you don't like that approach, consider at *least* wrapping it in a subroutine: -- Script file -- #!/usr/local/bin/perl -w use strict; require variables.conf print Content-type: text/html\n\n; foreach (list) { print; } exit; - variables.conf - my @list; $list[0] = '1'; $list[1] = '2'; $list[2] = '3'; $list[3] = '4'; $list[4] = '5'; sub list { @list } 1; -
Re: Next Problem...
On Feb 11, 2005, at 10:39 AM, Chris Nandor wrote: In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Kim Helliwell) wrote: When I type: kim% sudo gluemac /Applications/AddressBook.app I get: What is the glue name? [AddressBook]: ref is not a valid file specification at /Library/Perl/5.8.1/Mac/AETE/App.pm line 252, STDIN line 1. This didn't happen before. (that is, it worked on an older machine) I think you entered the filename incorrectly. There's a space: % sudo gluemac /Applications/Address\ Book.app Would be nice if the error was /Applications/AddressBook.app - no such file or directory then. -Ken
Re: TextWrangler
On Jan 21, 2005, at 4:45 AM, John Delacour wrote: At 9:34 pm -0800 20/1/05, Chris Nandor wrote: I think the only thing it cannot do that BBEdit does -- from what I can tell -- is that it doesn't talk directly to Affrus (the perl debugger for Mac OS X), like BBEdit can. There is an option in Preferences/UNIX scripting to use Affrus for debugging. See http://www.barebones.com/products/bbedit/threeway.shtml for a 3-way comparison between BBE, TW, and BBELite. -Ken
Re: stupid newbie question
On Jan 17, 2005, at 6:06 PM, John Delacour wrote: Apologies first of all for my original useless response. Here's how I would do it -- and it works. while () { /Contig([0-9]+)/i and $hash=$1 and eval my \%$hash; /CR05-C1-102|CR05-C1-103/i and eval \$$hash\{\$\} += 1; } A bit eval-y for my tastes. I'd translate that to: while () { ($n) = /Contig([0-9]+)/i; /CR05-C1-102|CR05-C1-103/i and $data{$n}{$}++; } and use a real two-level hash. -Ken
Re: Problems with Spidering Hack #56
On Jan 15, 2005, at 11:04 AM, David Cantrell wrote: Morbus Iff wrote: I'm working on my knowledge of Perl by working through Spidering Hacks (O'Reilly). Right now I'm stumped as to why this hack isn't working (code can be found at http://hacks.oreilly.com/pub/h/981#code. Besides this bug, how's the book? :) Judging by the random scattering of 'single' and double quotes in the original post - not worth buying. Man, you've gotta get yourself past the syntax layer and start concentrating on the semantics. I never would have noticed any quoting disparity if you hadn't called attention to it. Seems like such a silly thing to obsess over (and to publicly criticize the author for, which just seems a little mean) when the world is full of much more important things to criticize. -Ken
Re: Undoing/Fixing an installation of CPAN on Mac OS X 10.2.6
On Jan 10, 2005, at 4:39 PM, Sherm Pendley wrote: Start the CPAN shell and enter: o conf init That will repeat the question answer session. Pay attention this time - nuff said about that. Once you're done, enter: o conf commit Or, you can just do o conf and look at which value you messed up, then do o conf foo bar where 'foo' is the key you messed up on, and 'bar' is the value you should have entered. Then o conf commit will make sure your fix persists for your next CPAN session. -Ken
Re: Reading in a File
On Dec 26, 2004, at 4:34 AM, John Delacour wrote: At 10:44 pm -0500 25/12/04, Lola Lee wrote: This script has you count words in a file. The line where one is supposed to read in the file being counted is like so: while (defined($line = )) However, when I type this in: perl countwords.pl history.txt Nothing happens. The line you quote simply puts each line of a putative file into the scalar variable $line. What happens will depend on how you deal with $line and where you print your results. Supposing that countwords.pl is a script something like the one below and that history.txt is a file in the same directory (say your home directory), then you will get output in the terminal as below when you run your command. I personally would substitute for your line: foreach $line () which does the same thing and, to me at least, is simpler and clearer. It doesn't quite do the same thing. The 'while' loop will read one line, then process it, then read the next line, then process it, and so on. The 'foreach' loop will read all the lines into memory, then process each of them one by one. So if it's a large file, you'll have the whole thing in memory at once. The simplest, if you like using the default variable $_, is this: while () { ... } which is shorthand for: while (defined($_ = )) { ... } -Ken
Re: File::stat
On Dec 13, 2004, at 5:19 PM, Tom McDonough wrote: I've been getting no results from File::stat or a system call to stat. Finally I called stat from the command line and got Command not found. Indeed, it is neither in /usr/bin or /usr/sbin and I could not find a website to download it. I'm running OS X 3.5 Has anyone else had this problem? Any idea where I can get stat? 'stat' isn't a command you type in the shell, it's a C function call. Try man stat and you should see the manual page, in section 2. As for File::stat, it seems to be working fine for me (also on Panther): % perl -MFile::stat -le 'print for @{stat /etc/passwd}' 234881033 8782 33188 1 0 0 0 1374 1100754023 1063399301 1065492838 4096 8 -Ken
Re: Problems installing modules
On Dec 5, 2004, at 6:56 AM, William Ross wrote: On 5 Dec 2004, at 09:07, Marek Stepanek wrote: * installing blib/man1 to ?~name * with PERL_INSTALL_ROOT '' * mkpath(?~name) mkdir ?~name: Invalid argument at /usr/local/lib/perl5/5.8.5/ExtUtils/Install.pm line 115 make: *** [pure_site_install] Error 255 your perl configuration is slightly broken. If you look in (probably) /usr/local/lib/perl5/5.8.5/darwin-2level/Config.pm you should see a couple of lines like this: installman1dir='/usr/share/man/man1' installman3dir='/usr/share/man/man3' In mine they're around line 760. The value for installman1dir in yours is broken, I'm guessing. Others may be too. I'm guessing this happened because while installing perl, it asked you where you wanted to install your man pages, saying something like Where would you like to install manual pages for executables (~name ok)?, and you typed ?~name. What it meant was that you could type ~marek, or the name of some user's home directory, and it would expand it. But ?~name wasn't what it was looking for. =) -Ken
Re: Module regression
On Nov 17, 2004, at 3:38 AM, Phil Dobbin wrote: On 16/11/2004 @ 02:32 GMT, Ken Williams, [EMAIL PROTECTED], wrote: On Nov 16, 2004, at 3:47 PM, Phil Dobbin wrote: I need to step back a version in a module compliled from source (from v.3.0 - v.2.0). What's the best way to go about this (again compiling from source rather than cpan)? * The best way to do this is to have a backup of the previous system with v.2.0 installed, and revert to the backup. [snip excellent advice] My bad. I explained things very poorly. I've mistakenly installed v.3.0 of a module when the I should've installed v.2.0 (the particular script I'm trying to run will not work with v.3.0). So I need to expunge/override 3.0 and get the script to use v.2.0 which I haven't yet installed. Oh. =) In that case, removing based on the packlist is probably fairly reasonable (using a package manager would still be preferable, but admittedly almost nobody does that for installing perl modules). To see which files were installed as part of a certain module installation, you can use the following one-liner: perl -MExtUtils::Installed -le 'print foreach ExtUtils::Installed-new-files(Foo::Bar)' where Foo::Bar is the name of your module. Then you can remove all those files with 'sudo rm -f'. -Ken
Re: Module regression
On Nov 16, 2004, at 3:47 PM, Phil Dobbin wrote: I need to step back a version in a module compliled from source (from v.3.0 - v.2.0). What's the best way to go about this (again compiling from source rather than cpan)? * The best way to do this is to have a backup of the previous system with v.2.0 installed, and revert to the backup. * If you don't have a backup, the next best way is to use a package manager like RPM or DPKG to track your installed modules, remove the v.3.0 package and install the v.2.0 package. * If you don't have a backup, and you don't have a package manager, the next next best way is to go back in time and start using one or the other. * If you can't do any of the above, your only option is to brute-force remove v.3.0 using the packlist file (CPANPLUS provides some support for this) and then install v.2.0 again. This is not a great option because packlists can get out of sync, it can remove files that are required for some other thing you've installed, and so on. Incidentally, using CPAN *is* compiling from source. -Ken
Re: apple's system transfer tool
On Oct 18, 2004, at 5:52 AM, William Ross wrote: Incidentally, I've just used Apple's new system-transfer tool to start off the new powerbook, and noticed that it successfully copies /sw and the contents of /Library/Perl as well as the more obvious directories. Interesting - this is the new Setup Assistant? Is that available as a standalone, or just as part of a new system package? -Ken
Re: unlocking a file
On Oct 14, 2004, at 6:02 PM, jtownsen wrote: I have a hierarchy of folders that I'd like to delete. Normally I'd use rm -r. However, there folders contain at least one file that is locked. I'm familiar with using chmod to change permissions. However a locked file on a Mac, as I understand it, is a not a permission thing, but a Mac OS thing. I've heard that their is an Apple-provided tool to unlock files (e.g. in terminal). Anyone know what the tool is called? Or any other approach? It's /Developer/Tools/SetFile. There's a man page at `man SetFile`. -Ken
Re: [OT] Text Editor for OSX
On Oct 3, 2004, at 9:46 AM, wren argetlahm wrote: I apologize in advance for the off-topic nature of this posting. I've recently been lamenting the shortcomings of my current text editor for my purposes (SubEthaEdit since my copy of BBEdit is Classic and a new one costs way to much for my budget). I did a quick google search to try and find out what other options are out there, particularly in the F/OSS realm and with good support for XML/HTML/etc. And I couldn't find anything in particular. So, in my infinite (lack of) wisdom I've decided that it might be good to write my own. If you want to write one because you think it'll be fun, okay. But if you want to write one because you think you'll save money: suppose you earn about $40/hour. BBEdit upgrade costs about 60 bucks. Do you think it'll require more than one and a half hours of your time to write something better for your needs than BBEdit? -Ken
Re: Thunderbird
You might be interested in this page, entitled Import Address Book records into to Thunderbird : http://www.macosxhints.com/article.php?story=20040905025741769 When I googled for thunderbird and address, trying to learn what thunderbird was, this was the first link that came up. -Ken On Sep 21, 2004, at 7:21 PM, wren argetlahm wrote: I've recently started messing around with Thunderbird. I like it a bunch but I'm wondering if there's any good way to port over my Address Book, with perl or otherwise. I've tried exporting from AB (as .vcf, the only option) then importing in Thunderbird (.vcf isn't one of the formats listed that it can import, but it doesn't tell me I can't do it). A new address book list icon thing shows up, but so far as I can tell the information isn't actually imported. My second attempt was going to be through Mac::Glue, but Thunderbird doesn't appear to support AE (which makes sense). Any other suggestions?
Re: BBEdit 8.0
On Sep 9, 2004, at 8:54 PM, Doug McNutt wrote: I am told, by my son, that the best replacement for MPW in OS neXt is really emacs but it requires that I learn smalltalk or something similar and, though I have read the book, I just ain't there. X11 isn't that easy to use either with my four monitors. I think there are a few mismatches in that paragraph. I think MPW is most analogous to the shell itself, not to emacs. I'm a happy longtime power-user of emacs, though I've never taught myself Lisp (which is what you meant to say, not Smalltalk). I just use emacs for editing the text, and when I want to run commands I hit control-z and run a perl one-liner, or a 'wc' command, or whatever. Then, since I have bindkey ^Z run-fg-editor in my .login file, I just hit control-z again to drop me back into my editor. I almost never use emacs' shell integration, or write lisp functions, because I find the parent shell a more powerful tool. And this way I get the environment benefits you mentioned too. I'm not sure why X11 got mentioned there either, since you can use emacs the shell without X11 (it's probably been months since I used X11 under OS X). When I'm working with text that's heavily structured, like code or delimited data files, I usually plunge into the shell emacs. For other stuff I usually fire up BBEdit. Getting comfortable with both is really handy. =) -Ken
Re: [OT?] Shebang question
On Jul 26, 2004, at 12:26 AM, Rich Morin wrote: #!/usr/bin/env perl -wl Looking in the Camel, I'm not sure what the -l flag is supposed to be doing for you. You're not using it with -n or -p, so it isn't auto-chomping the input lines; you didn't give it an argument, so it isn't changing the output line terminator. So, what's it for? It adds a newline after each print(). -Ken
Re: XML::LibXML install on Mac?
On Jul 23, 2004, at 4:21 PM, Ingo Weiss wrote: Hi all, I am using XML::LibXML and so far did all the testing on my Linux web server (meaning that I had to be online to test). Now I would like to set my Mac up for local development - is it possible to install XML::LibXML on a Mac (Panther)? Can I just go ahead and install it from CPAN? If not, is there an easy way to check which CPAN modules work on a Mac? The easy way is to try to install it via CPAN and see whether it works. In principle most things work. -Ken
Re: Mac::Glue and Address Book
On Jul 18, 2004, at 8:54 PM, John Delacour wrote: At 5:24 pm -0700 18/7/04, Chris Nandor wrote: I can't see a way. If someone can tell me how to do it in AppleScript, I can convert it to Mac::Glue. But I can't see how to do it in AppleScript either. tell app Address Book to get the value of the first email of person 11 Ltd tell app Address Book to get the value of the first email of person 11 Ltd whose label is work etc. It's all clear in the dictionary. Those don't do what I'm talking about - look for a person who has a given email address. Your examples will show the email address for a person who has a given name. If I understand the dictionary correctly, I could find an email object with a given value ($glue-obj(email = whose(value = equals = '[EMAIL PROTECTED]'))), but I don't know how I'd go from that to its parent (the person object). Chris, I think at application startup I can build a map of lc($email) = $person. That will be faster than an app query anyway. Thanks for the suggestion. -Ken
Re: Mac::Glue and Address Book
Hi Chris, This is all working great. I just realized, though, that my initial email search isn't working - to find a person with the email $foo, I've tried: $person = $glue-obj(people = whose(email = equals = $foo)); Obviously this can't work, because email is an element, not a property. Is there a way to do this in a single query, or do I need to iterate through some result list? -Ken On Jul 14, 2004, at 3:54 PM, Chris Nandor wrote: Properties are simple enough. You get like this: $person-prop('last_name')-get; And similarly, set like this: $person-prop('last_name')-set(to = 'Baz'); In the case of the email elements, emails property returns a list, and each element of the list is an email object, which you can then get and set with the value property. for my $email ($person-prop('emails')-get) { print $email-prop('value')-get; } To set: for my $email ($person-prop('emails')-get) { my $value = $email-prop('value'); (my $text = $value-get) =~ s/\@/[EMAIL PROTECTED]/; print $value-set(to = $text); }
Re: Mac::Glue and Address Book
Thanks, Chris - this will give me enough info to do what I need to do, I'm sure. Hopefully my Mac::AddressBookMerger won't be too far behind... my wife needs it to merge the addresses from our various address lists into one place. -Ken On Jul 14, 2004, at 3:54 PM, Chris Nandor wrote: Hope that helps, [...]
Re: Mac::Glue and Address Book
Hey, Another question - to add new entries to the address book, I think I do something like this: my $person = $glue-make(new = 'person', with_properties = {first_name = 'Foo', last_name = 'Bar', email = '[EMAIL PROTECTED]'}); When I do this, the first_name and last_name entries show up fine in Address Book, but the email doesn't. I'm guessing this is because it's an 'element' of a person and not a 'property', whatever that means (what does that mean?). -Ken On Jul 2, 2004, at 6:06 PM, Ken Williams wrote: Hi, When I get a record from the Address Book like so: use Mac::Glue ':all'; my $ab = Mac::Glue-new('Address Book'); my $person = $ab-obj( people = whose(AND = [[ first_name = begins_with = 'Smorgasbord' ], [ last_name = equals = 'Milhouse']] ); I can't seem to tell the difference between someone who doesn't exist in the Address Book, and someone who exists but has no phone number (or address, or whatever). Any tips on how to do this? -Ken
Re: Mac::Glue and Address Book
Oh, and while I'm at it: I can't quite figure out how to change the values of an existing Address Book record. I guess there are two cases: changing 'property' values and changing 'element' values. Any examples I could get for that would be great. -Ken On Jul 10, 2004, at 11:16 PM, Ken Williams wrote: Hey, Another question - to add new entries to the address book, I think I do something like this: my $person = $glue-make(new = 'person', with_properties = {first_name = 'Foo', last_name = 'Bar', email = '[EMAIL PROTECTED]'}); When I do this, the first_name and last_name entries show up fine in Address Book, but the email doesn't. I'm guessing this is because it's an 'element' of a person and not a 'property', whatever that means (what does that mean?). -Ken
Krazy Mac::Glue entities
Um, When I do the following: use Mac::Glue ':all'; my $ab = Mac::Glue-new('Address Book'); my $person = $ab-obj( people = whose(AND = [[ first_name = begins_with = 'Smorgasbord' ], [ last_name = equals = 'Milhouse']] ); the $person object is absolutely nuts. It's got about a million key-value pairs that look like this: bless( { 'GLUE' = bless( { 'IDS' = { 'mbox' = { 'name' = 'mailbox_url' }, 'JPEG' = { 'name' = 'jpeg_picture' }, 'left' = { 'name' = 'left' }, ... 'sqkm' = { 'name' = 'square_kilometers' }, ... 'ednb' = { 'name' = 'nubus_card' }, ... 'ksb^@' = { 'name' = 'f7_key' }, ... and so on and so forth. Among other highlights: 'kilometers', 'ovals', 'arrow_at_both_ends', 'degrees_kelvin', and 'as_taught_in_school'. Is this, like, every four-letter Apple ID that has ever lived? Or can I really find out how many degrees Kelvin my friends are? -Ken
Re: Mac::Glue and Address Book
On Jul 4, 2004, at 1:23 PM, Chris Nandor wrote: In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Ken Williams) wrote: When I get a record from the Address Book like so: use Mac::Glue ':all'; my $ab = Mac::Glue-new('Address Book'); my $person = $ab-obj( people = whose(AND = [[ first_name = begins_with = 'Smorgasbord' ], [ last_name = equals = 'Milhouse']] ); I can't seem to tell the difference between someone who doesn't exist in the Address Book, and someone who exists but has no phone number (or address, or whatever). Any tips on how to do this? I am not sure what you're asking. Are you saying someone who exists but doesn't have any contact info -- just a name -- won't be returned by this? I works for me (modifying your parens/brackets slightly): print my $person = $ab-obj( people = whose(AND = [ first_name = begins_with = 'S' ], [ last_name = equals = 'Wonder'] ))-get; That returns for a card for the name Stevie Wonder, with no other info. If I change it to Sn Wonder, I get an uninitialized value warning in the print. Ah, I see - I was trying to tell the difference between a hit and a miss, i.e. a search that found someone and a search that didn't. Looks like I can use defined($person-get) for it, thanks. -Ken
Re: Curses trouble
I couldn't install it either. I note on http://testers.cpan.org/show/Curses.html that the failures greatly outweigh the passes, FWIW. However, how come in your example it's libCurses.dylib instead of libcurses.dylib? -Ken On Jul 1, 2004, at 2:02 PM, Mike Lemmon wrote: I've gotten Curses.pm off of CPAN, but any program I try to run with it fails to compile, saying that libcurses.dylib is not a recognisable object file. Anyone know what I need to do to fix this? Thanks! % perl -e 'use Curses' Can't load '/usr/lib/libCurses.dylib' for module Curses: /usr/lib/libCurses.dylib(2): Not a recognisable object file at -e line 1 Compilation failed in require at -e line 1. BEGIN failed--compilation aborted at -e line 1. % perl /Library/Perl/Curses.pm Can't load '/usr/lib/libCurses.dylib' for module Curses: /usr/lib/libCurses.dylib(2): Not a recognisable object file DynaLoader::croak('Can\'t load \'/usr/lib/libCurses.dylib\' for module Curses: /...') called at /System/Library/Perl/5.8.1/darwin-thread-multi-2level/DynaLoader.pm line 229 DynaLoader::bootstrap('Curses') called at /Library/Perl/Curses.pm line 64
Re: n00b needs help with file arguments
On May 31, 2004, at 4:13 PM, Ian Ferguson wrote: I program AppleScript as well. In fact, this is what introduced me to Perl and Ruby. Since Perl can handle many of the things I need faster and more efficiently, I started digging into Perl to do things like sort arrays, etc. In AppleScript, If I have a script and I need to call on a shell script to run with specific parameters, I have to issue a quoted form of ... to make sure that the argumetn is quoted to prevent the shell from seeing various arguments as you noted. This is what led me to ask the question regarding quoting. The key difference here is that AppleScript is calling the shell to perform its actions, whereas Perl is calling native system routines. So no protection from the shell is necessary. I asked a question about quoting an argument prior to removing a directory to learn something about how the language handles things. I don't know if the rmdir method is recursive and/or forced in Perl.. Telling me to try and see is a BS answer to give. Of course I could create a directory and try, but what is the need for a community of experts if I can't ask a simple question? Well, in Perl there's more of a culture that tries things - just because it's so much easier to write one-off simple Perl programs than one-off Java or C or AppleScript or whatever. So I suspect Ricardo, in his terse way, had that in mind. However, using the try it and see approach can get you in trouble too, since people should really rely on the documentation (and a real understanding thereof) to achieve true enlightenment. Also... Read perldoc this and that... Most people new to a language will have no clue what you are talking about. Keep this in mind for the future. Do you tell a person who can't drive standard ... Hey it's a car. Just drive it!? Of course not. Right, but I don't think you're going to run over any little old ladies with a test perl script. ;-) -Ken
Re: [BUG ?] sort/reverse or RegExp problem
On May 18, 2004, at 3:37 AM, allan juul wrote: 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 Well then, don't use the /g flag - that's what it's for. =) -Ken
Re: [BUG ?] sort/reverse or RegExp problem
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) } }
Re: Sort by Mod Date
On May 13, 2004, at 6:19 PM, [EMAIL PROTECTED] wrote: #!/usr/bin/perl my $dir = /Users/jay/Desktop/Other Stuff/old stuff 4; opendir FOLDER, $dir or die Cannot open $dir: $!; foreach $file (readdir FOLDER) { next if $file =~ /^\./; $path = $dir/$file; next unless -f $path and -r $path; push @files, (stat $path)[9].chr(1).$path.\n; } @files = sort @files; foreach (@files) { push @sortedList, (split(chr(1), $_))[1]; } Instead of using string-munging, you can use a real data structure: #!/usr/bin/perl my $dir = /Users/jay/Desktop/Other Stuff/old stuff 4; opendir FOLDER, $dir or die Cannot open $dir: $!; foreach $file (readdir FOLDER) { next if $file =~ /^\./; $path = $dir/$file; next unless -f $path and -r $path; push @files, [(stat $path)[9], $path]; } @files = map $_-[1], sort {$a-[0] = $b-[0]} @files; print $_\n foreach @files; -Ken
Re: [slightlyOT] reading logs with long urls
On May 2, 2004, at 8:17 PM, Joel Rees wrote: My apache log files show that I'm getting two or more of those long url attacks every day, and access_log grows to over 4Mb in just a week, in spite of the fact that there are less than ten valid accesses in any particular day. How about configuring Apache to disregard (and not log) any URL longer than a predefined length? Also, what are those long url attacks, I haven't heard of them. -Ken
Re: backing up using DejaVu
On May 3, 2004, at 6:37 PM, Jerry LeVan wrote: Hmmm, maybe it will work... I started the following shell script #!/bin/sh i=1 while true do echo $i i=`expr $i + 1 ` done I forced the system to sleep for a few seconds, woke it up and the script kept on trucking... Oh, certainly - you can interrupt basically anything at all on the computer with sleep, and it will simply continue where it left off. I do this all the time with compilations, long-running scientific experiments, regression tests, etc. on my PowerBook. The wake-from-sleep functionality is very robust and fast. The only trouble you're likely to see is when an external resource (like a network or a printer) doesn't like you pausing in the middle of something you're doing to it, and then some operations involving that resource might not just continue where you left off. -Ken
Re: backing up using DejaVu
On May 3, 2004, at 5:18 PM, Joseph Alotta wrote: Hi Jerry, I used sudo psync -d / /Volumes/backup and it worked real nice. I kind of like watching it work while I do other things. If my powerbook were to sleep in the middle of it, would it break something or would it just pick up where it left off? I think it depends how /Volumes/backup is mounted. If it's a local drive connected by USB or Firewire or whatever, everything should be fine. If it's a remote drive, it might not be happy. -Ken
Re: Copying files
On Apr 28, 2004, at 2:11 AM, Mark Wheeler wrote: Ok, It's working great, now. Thank you Ken and Bruce and anyone else I am forgetting. Now the to finish the ride, all I have to do now is figure out how to get the file from my PC and copy to an external hard drive. I'm resuming all I need are the paths to the PC and the drive. Does that sound right? Yup, sounds right. By the way, I note that you've switched from using rename() to using copy(), so your new script is doing something different than your old script. Make sure it's what you want. =) -Ken
Re: hi
On Apr 27, 2004, at 11:52 PM, devulapally krishna wrote: Hi all i'm working on perl. i need to download webpages from the internet and analyze them,which i'm unable to do with perl. Please help me. I highly recommend WWW::Mechanize. It's got a little bit of a learning curve (I'll probably get flamed for saying so, but it took me a couple tries before I really understood it), but once you understand it, it's REALLY easy to write download-and-analyze, or crawl-the-web scripts with it. For instance, here's something I wrote that logs into the New York Times web site, inputs my username password, gets the crossword puzzle from whatever date is specified on the command line, and opens that puzzle using the AcrossLite application - all in 24 lines of code: -- use WWW::Mechanize; use Date::Manip; use Path::Class; (my $date = UnixDate(shift || 'today', '%A, %B %d')) =~ s/ 0/ /g; my $m = WWW::Mechanize-new; $m-get('http://nytimes.com/pages/crosswords/index.html'); $m-follow_link( text_regex = qr/Click here to enter/ ); $m-form_number(1); $m-set_visible( username = 'password' ); $m-click; $m-follow_link( text_regex = qr/$date/ ); (my $filename = $m-uri) =~ s{.*/}{}; my $out = file('', 'tmp', $filename); my $fh = $out-openw; print $fh $m-content; close $fh; system(open = $out); -- Notice that the web-interaction portion of it is only 7 lines. If you need to do some HTML analysis that WWW::Mechanize can't do, check out the book Perl LWP: http://www.amazon.com/exec/obidos/tg/detail/-/0596001789/ -Ken
Re: Copying files
On Apr 28, 2004, at 11:48 AM, Mark Wheeler wrote: Hi Ken, I switched that because it was suggested that writing files over system boundaries might be a problem. What is the difference between the two? It sounds like, from your comment, that they do very different things. Yeah - rename() moves the file, and copy() makes a copy of it. -Ken
Re: Copying files
On Apr 27, 2004, at 11:59 AM, Wiggins d Anconia wrote: The script is as follows: #!/usr/bin/perl -w use strict; my @files = db1.txt, db2.txt, db3.txt, db4.txt; foreach (@files) { rename /path/to/pc/file/$_, /Users//Documents/$_..bak; You should always check that 'rename' succeeded (as apparently it isn't). rename $oldfile, $newfile or warn Can't rename file: $!; $! will then provide you more information as to why its not working. I'd be willing to bet that it will be because there's no file called /path/to/pc/file/db1.txt, db2.txt, db3.txt, db4.txt on your system. Perhaps you mean: my @files = (db1.txt, db2.txt, db3.txt, db4.txt); or just my @files = qw(db1.txt db2.txt db3.txt db4.txt); Anyway, Wiggins is right - if you'd checked the error status, $! would have told you... -Ken
Re: Copying files
On Apr 27, 2004, at 5:07 PM, Mark Wheeler wrote: Yup. You're right. I missed that one. Here's what I did to simplify the testing of the script. #!/usr/bin/perl -w use strict; use File::Copy; copy(/Users/xx/Documents/db1.txt, /Users/xx/Documents/db1.txt.bak) or warn Can't copy file: $!; print Backup Completed.; exit; - I know the cron is firing off the request, because when first tried it, I got Permission Denied in my email box. So I changed the permission to 755 and it still doesn't copy the file. And I get nothing in my email box. I'm a little confused. What am I missing? First rule when it looks like a script isn't doing anything on OS X: check the line endings. Make sure they're unix-style. If they're Mac-Classic style, running the script won't actually do anything. First rule when setting up cron jobs: make sure cron itself is running. Set up a job with the same timings as the script in question, but make its action echo foo or something like that. You should get an email when it runs. If not, then cron's the problem, not perl. I know you said it worked before, but just to make sure... -Ken
Re: Copying files
On Apr 27, 2004, at 5:46 PM, Bruce Van Allen wrote: On 4/27/04 Mark Wheeler wrote: Good question. Here are the results. The permissions for the /Users/xx/Documents directory is: drwx-- 7 xx xx 238 27 Apr 15:08 Documents The permission for the /Users/xx/Library/Scripts directory is: drwxr-xr-x 3 xx xx 102 27 Apr 14:22 Scripts Does that look right? Or should the Documents directory be the same as Most likely your script is not running as owner, so you probably want drwxrwxrwx for the Documents directory ( chmod 0777, '/Users/xx/Documents' ). That's a bad idea. I wouldn't want *my* Documents directory world-writable. The cron script is going to run as the user who sets it up, so it's not necessary either. -Ken
Re: Merging into Address Book
On Apr 21, 2004, at 9:11 AM, Chris Nandor wrote: Did you look at the Address Book example in ex/ ? It uses whose() to find entries. YOU SIR ARE A GEM K. Yeah, I'd seen it, but I forgot about it when I saw the other example you mailed to the list. Thanks. -Ken
Re: Merging into Address Book
On Apr 14, 2004, at 2:57 PM, Chris Nandor wrote: I've been called out! ;-) Here's a version with Mac::Glue. ... Say, I built the Address_Book glue and looked through its docs, but I don't see methods to search the database for entries that have certain properties. Do you know of any way to use the Find functionality, or specify required properties, using the applescript/glue interface? -Ken
Re: Merging into Address Book
Excellent. So maybe I'll make a little command-line app to do a merge (with prompting) from a tab-delimited file into Address Book. Or maybe I won't, but I bet I will. -Ken On Apr 14, 2004, at 2:57 PM, Chris Nandor wrote: I've been called out! ;-) Here's a version with Mac::Glue. #!/usr/local/bin/perl use strict; use warnings; use Mac::Glue ':all'; my $ab = new Mac::Glue 'Address Book'; my $person = $ab-make(new = 'person', with_properties = { first_name = 'Stevie', last_name = 'Wonder', } ); $ab-make(new = 'email', at = location(end = $person-prop('emails')), with_properties = { value = '[EMAIL PROTECTED]', label = 'work', } ); $ab-make(new = 'phone', at = location(end = $person-prop('phones')), with_properties = { value = '555-123-4567', label = 'work', } ); $ab-make(new = 'phone', at = location(end = $person-prop('phones')), with_properties = { value = '555-890-1234', label = 'home', } ); $ab-make(new = 'address', at = location(end = $person-prop('addresses')), with_properties = { street = '123 Main St.', city = 'New York', state = 'NY', label = 'home', } ); __END__ -- Chris Nandor [EMAIL PROTECTED]http://pudge.net/ Open Source Development Network[EMAIL PROTECTED] http://osdn.com/
Re: Merging into Address Book
On Apr 8, 2004, at 1:33 AM, Jason Fleetwood-Boldt wrote: At 8:51 PM -0500 4/7/04, Ken Williams wrote: Yeah, that's probably a good way to go. Perhaps I should just synchronize directly from Palm Desktop to Address Book, rather than exporting to vCards. -Ken Unless you mean syncrhronize Palm with your PDA, then switch over to Apple Address Book and sync again with Address Book -- I don't know what you mean. There's no script that syncs Address Book to Palm desktop that I know of. If anyone knows of such a script please send info my way. Drat. So it looks like there's really know way to do an automated *merge*, just an *import*, i.e. It'll create duplicates of any people that exist in there already. Is this your understanding too? Sounds like I may need to create my own heuristic merge tool, then use the Address Book Importer to do the final import. -Ken
Re: Merging into Address Book
On Apr 7, 2004, at 9:11 AM, Bill Jastram wrote: Ken: Although it's not a Perl soultion, here's a link which might give you just what you need: http://www.macosxhints.com/article.php? story=20030831221023355query=vcard Hmm - I'm a little hesitant to use that (or a perl equivalent), as it doesn't seem like it handles any of the complexities of the vCard format. -Ken
Re: Merging into Address Book
On Apr 6, 2004, at 10:18 PM, Chris Devers wrote: On Tue, 6 Apr 2004, Ken Williams wrote: For my wedding Congratulations! I made an AppleWorks database containing the names of all the wedding guests, their addresses, emails, and so on. Now I want to merge that info back into Address Book. Anyone have recommendations for how to do this nicely? I thought about creating vCards and merging them somehow, but none of the CPAN vCard modules seem to actually be able to create them. Also, I'm not exactly clear on how I'd do the merge anyway. Is there some way to tap into iSync or something? Err, this may be a more annoying than helpful suggestion, but have you considered using Palm Desktop as an intermediary? It can import data in a variety of formats, including CSV. If you can get your AppleWorks database to make a report in a CSV format that Palm Desktop can use, then Palm Desktop can in turn export the data in a format that Address Book can import (e.g. vCard). Yeah, that's probably a good way to go. Perhaps I should just synchronize directly from Palm Desktop to Address Book, rather than exporting to vCards. -Ken
Merging into Address Book
Hey, For my wedding, I made an AppleWorks database containing the names of all the wedding guests, their addresses, emails, and so on. Now I want to merge that info back into Address Book. Anyone have recommendations for how to do this nicely? I thought about creating vCards and merging them somehow, but none of the CPAN vCard modules seem to actually be able to create them. Also, I'm not exactly clear on how I'd do the merge anyway. Is there some way to tap into iSync or something? -Ken
Re: Preview.app opening multiple files
On Mar 31, 2004, at 6:53 PM, Bohdan Peter Rekshynskyj wrote: I still would try to do something such as (rough script here) open COMMAND ls *.files |; # Don't forget to code a die here if unsuccessful in opening. Defensive programming! while COMMAND { $theParms .= $_; # you may or may not need to cho(m)p ! } $theCommand = system open ' . $theParms . '; system (or eval) ($theCommand); # and check for RC... Something like that, as above in Perlese, I think, should do the trick! No, that won't work. As explained earlier by Chris, you cannot do anything with perl system() that you couldn't just do at a shell prompt. The other Chris posted an example with Mac::Glue which solves the original problem, have you tried that? -Ken
Re: Trying to understand signals and restartable system calls
On Mar 19, 2004, at 11:34 AM, Mark Alldritt wrote: Hello, I'm trying to understand how signals and restartable system calls interact. Take this example: #!/usr/bin/perl $SIG{USR2} = sub { print Here I Am\n; }; print Starting...\n; my $abc; while (read STDIN, $abc, 20) { print $abc\n; } print Done\n; If I run this script and then send a USR2 signal with kill -31 while the script is blocked in the read call, the read returns 0, and the script exits. It seems to return not 0, but undef. And $! is set to Interrupted system call. Does this help? Perhaps you could just restart the loop in such cases. -Ken
Re: Getting the size of a folder with Mac::Glue
On Tuesday, March 16, 2004, at 12:48 AM, Rick Measham wrote: I'm trying to get the size of a folder and figure Mac::Glue would be the way to go. However I'm getting back a 0: [...] (If there's a better way to get the size of a folder, please let me know!) You can use `du -sk $folder` to get the size in Kbytes. For the options taken, look at 'man du' in the terminal. I'm not sure how this deals with resource forks, though. -Ken
Re: Affrus PLUS Perl/TK
On Thursday, March 11, 2004, at 04:38 PM, Bohdan Peter Rekshynskyj wrote: On Mar 11, 2004, at 17:21, Chris Nandor wrote: Affrus is an excellent product. I hate using the Perl debugger on the command line, it gives me the willies. Affrus makes it much easier to find problems in your perl code, especially when it goes through many modules and files. I only wish I had more bugs in my code so I could use it more! ;-) Great! This is good stuff to know. I'm a Unix command line Perl coder but wouldn't mind checking out IDE's and debuggers as this! Yeah, and actually Affrus comes with a command-line tool so that you can initiate debugging from the command line. It's nice for people like me, who do all development from the shell emacs, but sometimes want to switch quickly to Affrus for debugging in a nice environment. I was a beta tester for Affrus and I was really glad when the command-line tool was added. -Ken