From wolfm at pobox.alaska.net Wed Feb 2 03:16:32 2000 From: wolfm at pobox.alaska.net (Michael Fowler) Date: Wed Aug 4 23:56:45 2004 Subject: one-liners Message-ID: <20000202001632.C5687@shoebox.net> I just had a few one-liners I found useful as of late, and wanted to share. Recently, I decided to change from 8-space tabs using a tab character to 4-space tabs using spaces. Needing to convert some pre-existing code I was editing, I wrote a small script. The script in actually written in sh, and does the following (basically): mv $1 $1.bak expand $1.bak | unexpand | expand --initial -t 4 > $1 Given a filename as an argument, it renames the file, converts all tabs into 8 spaces (using tabstops, so alignment is kept), then converts all leading whitespace to tabs (thus internal whitespace is maintained), then re-converts any leading tabs to 4 spaces. The extra steps are required to maintain formatting; often I use tabs to line things up, e.g. my $foo = "bar"; my $bar = "foo"; If those are tab characters, and all tabs are arbitrarily converted to 4 spaces, things no longer properly line up. Here's the Perl equivalent: perl -MText::Tabs -i.bak -pnwe '$tabstop = 8; $_ = expand($_); s/^(\s+)/unexpand($1)/e; $tabstop = 4; $_ = expand($_);' filename This has the advantage of being able to process multiple files listed on the command-line, with no extra work. The shell script, on the other hand, would require modification. Recently, I was messing around with Apache logfiles, and needed to check what domains were in a given logfile. perl -anwe '$domains{$F[1]}++; END { while (my($domain, $count) = each(%domains)) { printf("%4d %s\n", $count, $domain) } }' This prints out a list of the domains in the logfile, and how many occurrences there were. Michael -- Administrator www.shoebox.net Programmer, System Administrator www.gallanttech.com -- ================================================= Mailing list info: If at any time you wish to (un|re)subscribe to the list send the request to majordomo@hfb.pm.org. All requests should be in the body, and look like such subscribe anchorage-pm-list unsubscribe anchorage-pm-list From corliss at alaskapm.org Thu Feb 10 01:49:46 2000 From: corliss at alaskapm.org (corliss@alaskapm.org) Date: Wed Aug 4 23:56:45 2004 Subject: New Book Review Message-ID: Greetings: My apologies to Josh Borroughs, as he sent me a week or two ago his review of Learning Perl, 2nd Edition. It took me all of this time to convert to HTML and get it on the site. :-P Can you believe that Star Office doesn't have an import filter for Word Perfect? Anyway, it's a great review, and I'm glad to say that it's available for all of your perusal at http://www.alaskapm.org/reviews/learning.mtml . :-) Anyone else have a book they'd like to review? If you'll read and write on them, I'll get them for you for free. . . --Arthur Corliss Perl Monger/Alaska Perl Mongers http://www.alaskapm.org/ ================================================= Mailing list info: If at any time you wish to (un|re)subscribe to the list send the request to majordomo@hfb.pm.org. All requests should be in the body, and look like such subscribe anchorage-pm-list unsubscribe anchorage-pm-list From wolfm at pobox.alaska.net Thu Feb 10 03:49:23 2000 From: wolfm at pobox.alaska.net (Michael Fowler) Date: Wed Aug 4 23:56:45 2004 Subject: New Book Review In-Reply-To: ; from corliss@alaskapm.org on Wed, Feb 09, 2000 at 10:49:46PM -0900 References: Message-ID: <20000210004923.X14925@shoebox.net> On Wed, Feb 09, 2000 at 10:49:46PM -0900, corliss@alaskapm.org wrote: > Anyway, it's a great review, and I'm glad to say that it's available for > all of your perusal at http://www.alaskapm.org/reviews/learning.mtml . It is a great review. I must compliment both you and John for a well-worded, glowing review of a great book. Michael -- Administrator www.shoebox.net Programmer, System Administrator www.gallanttech.com -- ================================================= Mailing list info: If at any time you wish to (un|re)subscribe to the list send the request to majordomo@hfb.pm.org. All requests should be in the body, and look like such subscribe anchorage-pm-list unsubscribe anchorage-pm-list From corliss at alaskapm.org Thu Feb 10 03:54:43 2000 From: corliss at alaskapm.org (corliss@alaskapm.org) Date: Wed Aug 4 23:56:45 2004 Subject: New Book Review In-Reply-To: <20000210004923.X14925@shoebox.net> Message-ID: On Thu, 10 Feb 2000, Michael Fowler wrote: > On Wed, Feb 09, 2000 at 10:49:46PM -0900, corliss@alaskapm.org wrote: > > > Anyway, it's a great review, and I'm glad to say that it's available for > > all of your perusal at http://www.alaskapm.org/reviews/learning.mtml . > > It is a great review. I must compliment both you and John for a > well-worded, glowing review of a great book. Don't give me any credit, Josh did all the work. I just converted to HTML. --Arthur Corliss Perl Monger/Alaska Perl Mongers http://www.alaskapm.org/ ================================================= Mailing list info: If at any time you wish to (un|re)subscribe to the list send the request to majordomo@hfb.pm.org. All requests should be in the body, and look like such subscribe anchorage-pm-list unsubscribe anchorage-pm-list From corliss at odinicfoundation.org Sat Feb 12 06:58:38 2000 From: corliss at odinicfoundation.org (Arthur Corliss) Date: Wed Aug 4 23:56:45 2004 Subject: Curses::Forms Message-ID: Greetings: I'm not too sure how many of you are still creating console applications, but for those of us who are, I've just released the first alpha release of Curses::Forms. This module builds upon the foundation provided by Curses and Curses::Widgets, to provide even higher level access to complete forms and collections of widgets. This can relieve you of coding widget/form navigation, leaving you only with special function/key bindings. The initial release is feature-incomplete, but functional, and combined with the test script, provides a proof-of-concept. You can get it via CPAN or its homepage of http://www.odinicfoundation.org/arthur/computing/scripts/curses_forms/ . :-) Happy hacking. --Arthur Corliss Bolverk's Lair -- http://www.odinicfoundation.org/arthur/ "Live Free or Die, the Only Way to Live" -- NH State Motto ================================================= Mailing list info: If at any time you wish to (un|re)subscribe to the list send the request to majordomo@hfb.pm.org. All requests should be in the body, and look like such subscribe anchorage-pm-list unsubscribe anchorage-pm-list From wolfm at pobox.alaska.net Sat Feb 19 06:05:03 2000 From: wolfm at pobox.alaska.net (Michael Fowler) Date: Wed Aug 4 23:56:45 2004 Subject: Module: Parse::PerlConfig Message-ID: <20000219030503.A613@shoebox.net> I just completed a module that parses (and I use the term loosely) symbols from a Perl script. What it basically does is read in a specified file, evals the file inside a specific namespace, then examines the namespace for symbols and extracts the various things (or datatypes, if you prefer) into a hash. The only defined function (the module is used procedurally) is parse(), exported as parse_perl_config(), which takes a list of key-value pairs as its argument. Currently I'm calling the module Parse::PerlConfig. I notice the Parse:: hierarchy is taken up entirely by parser generators, and I'm beginning to wonder about the appropriateness of the name. Would Config::Perl be better? Is this module of general interest? I was thinking of uploading it as my first module on CPAN, and wanted to get a little feedback first. It can be obtained at http://shoebox.net/software/archive/Parse-PerlConfig-0.01.tar.gz if anyone is interested. I recently posted the above message to comp.lang.perl.modules and got absolutely -no- response. I would appreciate any feedback, be it regarding the usefullness of the module itself, difficulty in understanding my description, anything. Michael -- Administrator www.shoebox.net Programmer, System Administrator www.gallanttech.com -- ================================================= Mailing list info: If at any time you wish to (un|re)subscribe to the list send the request to majordomo@hfb.pm.org. All requests should be in the body, and look like such subscribe anchorage-pm-list unsubscribe anchorage-pm-list From corliss at alaskapm.org Sat Feb 19 15:55:57 2000 From: corliss at alaskapm.org (corliss@alaskapm.org) Date: Wed Aug 4 23:56:45 2004 Subject: Module: Parse::PerlConfig In-Reply-To: <20000219030503.A613@shoebox.net> Message-ID: On Sat, 19 Feb 2000, Michael Fowler wrote: > Currently I'm calling the module Parse::PerlConfig. I notice the Parse:: > hierarchy is taken up entirely by parser generators, and I'm beginning to > wonder about the appropriateness of the name. Would Config::Perl be better? > > Is this module of general interest? I was thinking of uploading it as my > first module on CPAN, and wanted to get a little feedback first. Don't know about the name, but I wouldn't worry about it too much. As long as the module is unique in fuction, then they'll accept it to CPAN, and Andreas Koenig (andreas.koenig@anima.de), one of the lead coordinators for CPAN will make any recommendations necessary for namespace. > I recently posted the above message to comp.lang.perl.modules and got > absolutely -no- response. I would appreciate any feedback, be it regarding > the usefullness of the module itself, difficulty in understanding my > description, anything. Are you sure that your message made it onto the board? I read that group, I honestly don't recall seeing it on my end. . . --Arthur Corliss Perl Monger/Alaska Perl Mongers http://www.alaskapm.org/ ================================================= Mailing list info: If at any time you wish to (un|re)subscribe to the list send the request to majordomo@hfb.pm.org. All requests should be in the body, and look like such subscribe anchorage-pm-list unsubscribe anchorage-pm-list