From doom at kzsu.stanford.edu Wed Mar 1 00:56:14 2006 From: doom at kzsu.stanford.edu (Joseph Brenner) Date: Wed, 01 Mar 2006 00:56:14 -0800 Subject: [sf-perl] perlnow (emacs as a perl ide) Message-ID: <200603010856.k218uFr61056@mail0.rawbw.com> Some folks were nice enough to ask about where to get perlnow.el and such... this is the place: http://obsidianrook.com/perlnow In the next day or so I'll put up a web page version of my talk. From fred at redhotpenguin.com Wed Mar 1 10:56:41 2006 From: fred at redhotpenguin.com (Fred Moyer) Date: Wed, 1 Mar 2006 10:56:41 -0800 (PST) Subject: [sf-perl] perlnow (emacs as a perl ide) In-Reply-To: <200603010856.k218uFr61056@mail0.rawbw.com> References: <200603010856.k218uFr61056@mail0.rawbw.com> Message-ID: On Wed, 1 Mar 2006, Joseph Brenner wrote: > > Some folks were nice enough to ask about where to get perlnow.el > and such... this is the place: > > http://obsidianrook.com/perlnow > > In the next day or so I'll put up a web page version of my talk. Just got this up and (mostly) running. After RTFM'ing, can you suggest a list or some other resource for small questions? From extasia at extasia.org Wed Mar 1 11:56:00 2006 From: extasia at extasia.org (David Alban) Date: Wed, 1 Mar 2006 11:56:00 -0800 Subject: [sf-perl] Debugger goodness Message-ID: <4c714a9c0603011156y143b1dedv3806732629bae06c@mail.gmail.com> Greetings, In the spirit of last night's discussion, I'd like to offer some perl debugger goodies. These are documented, but if you use the debugger and you don't know about them, the cause of Badness in the Universe is strengthened (and a kitten is probably killed). The first goodie is the ability to page debugger output. Use of the pipe character ('|') before a debugger command achieves this. E.g.: DB<1> |x $foo The pipe character causes the debugger to pipe the output through a pager. So if you have a variable that creates pages and pages and pages of output with the debugger's 'x' command, you can page that output. Or if you want to page something that's very complicated. I use less(1) as my pager, so not only can I page the output, but I can operate on it in any way that less allows, like piping it through another command (think shell command, not debugger command) or like saving it to a file for further study/preservation. >From perldebug: Configurable Options The debugger has numerous options settable using the "o" command, either interactively or from the environment or an rc file. (./.perldb or ~/.perldb under Unix.) [...] "pager" Program to use for output of pager-piped commands (those beginning with a "|" character.) By default, $ENV{PAGER} will be used. Because the debugger uses your current terminal characteristics for bold and underlining, if the chosen pager does not pass escape sequences through unchanged, the output of some debugger commands will not be readable when sent through the pager. Another debugger goodie is the ability to run shell commands from within the debugger: DB<2> !!date Wed Mar 1 11:18:45 PST 2006 by preceding them with "!!". Sure you could run them in a different window, but the option to run them in the debugger session is there. Another goodie: gnu readline support. In my shell environment I have: export EDITOR=vim And executing 'o Readline?' in the debugger shows the value for the Readline option is 1. As a result, the debugger command line is a one line vim window (similar to the effect on the command line of "set -o vi" in ksh or bash). That is, I can use vim commands to do debugger command history recall and debugger command line editing. I'm assuming the debugger would do the right thing for: export EDITOR=emacs A prerequisite for this, however, is that you install Term::ReadKey and Term::ReadLine from CPAN. Curiously, the perldebug man page says: These do not support normal vi command-line editing, however. But I get normal vi(m) command line editing. Strange... The perl debugger kicks serious boo-tay, and is essential to my personal "ide" (bash/vim/perl debugger/RCS/perldoc). David P.S. The other day I stumbled across wikipedia's metasyntactic variable page (http://en.wikipedia.org/wiki/Metasyntactic_variable). That's what foo, bar, bat, baz, etc. are called. Very entertaining page. I encourage Joe to add Garbagio::Fantastico to the page. :-D -- Live in a world of your own, but always welcome visitors. From qw at sf.pm.org Wed Mar 1 12:49:30 2006 From: qw at sf.pm.org (Quinn Weaver) Date: Wed, 1 Mar 2006 12:49:30 -0800 Subject: [sf-perl] perlnow (emacs as a perl ide) In-Reply-To: <200603010856.k218uFr61056@mail0.rawbw.com> References: <200603010856.k218uFr61056@mail0.rawbw.com> Message-ID: <20060301204930.GA36580@cfcl.com> On Wed, Mar 01, 2006 at 12:56:14AM -0800, Joseph Brenner wrote: > Some folks were nice enough to ask about where to get perlnow.el > and such... this is the place: > > http://obsidianrook.com/perlnow > > In the next day or so I'll put up a web page version of my talk. Sweet! I've added a link to this page from the talk announcement ( http://sf.pm.org/weblog/archives/00000031.html ). Joe, will you please post my Class::Std-base templates in the same place? -- qw (Quinn Weaver); #President, San Francisco Perl Mongers =for information, visit http://sf.pm.org/weblog =cut From qw at sf.pm.org Wed Mar 1 21:38:29 2006 From: qw at sf.pm.org (Quinn Weaver) Date: Wed, 1 Mar 2006 21:38:29 -0800 Subject: [sf-perl] Debugger goodness In-Reply-To: <4c714a9c0603011156y143b1dedv3806732629bae06c@mail.gmail.com> References: <4c714a9c0603011156y143b1dedv3806732629bae06c@mail.gmail.com> Message-ID: <20060302053829.GA30326@cfcl.com> On Wed, Mar 01, 2006 at 11:56:00AM -0800, David Alban wrote: > [Useful debugger tips] > export EDITOR=vim Just to be pedantic, some BSD systems expect you to use VISUAL instead of editor (and commands like 'crontab -e' don't honor EDITOR). So you should always do something like this in your .bash_profile: export EDITOR=whatever export VISUAL=$EDITOR Silly, huh? -- qw (Quinn Weaver); #President, San Francisco Perl Mongers =for information, visit http://sf.pm.org/weblog =cut From extasia at extasia.org Thu Mar 2 16:45:52 2006 From: extasia at extasia.org (David Alban) Date: Thu, 2 Mar 2006 16:45:52 -0800 Subject: [sf-perl] Debugger goodness In-Reply-To: <20060302053829.GA30326@cfcl.com> References: <4c714a9c0603011156y143b1dedv3806732629bae06c@mail.gmail.com> <20060302053829.GA30326@cfcl.com> Message-ID: <4c714a9c0603021645l4970facfxecbf26fb2fa1ce0d@mail.gmail.com> On 3/1/06, Quinn Weaver wrote: > Just to be pedantic, some BSD systems expect you to use VISUAL instead > of editor (and commands like 'crontab -e' don't honor EDITOR). > So you should always do something like this in your .bash_profile: > > export EDITOR=whatever > export VISUAL=$EDITOR Not pedantic at all. I do this for all of my logins. I've run into this with other programs. Some heed the value of $EDITOR, some the value of $VISUAL (some even check both). And I actually set them to "vim -X" rather than "vim" to prevent vim from trying to launch the graphical version of itself. -- Live in a world of your own, but always welcome visitors. From doom at kzsu.stanford.edu Sat Mar 4 00:10:01 2006 From: doom at kzsu.stanford.edu (Joseph Brenner) Date: Sat, 04 Mar 2006 00:10:01 -0800 Subject: [sf-perl] perlnow (emacs as a perl ide) Message-ID: <200603040810.k248A2u93944@mail0.rawbw.com> Joseph Brenner wrote: > Some folks were nice enough to ask about where to get perlnow.el > and such... this is the place: > > http://obsidianrook.com/perlnow > > In the next day or so I'll put up a web page version of my talk. Here we go: http://obsidianrook.com/perlnow/emacs_as_perl_ide.html From doom at kzsu.stanford.edu Sat Mar 4 00:22:12 2006 From: doom at kzsu.stanford.edu (Joseph Brenner) Date: Sat, 04 Mar 2006 00:22:12 -0800 Subject: [sf-perl] Debugger goodness In-Reply-To: <20060302053829.GA30326@cfcl.com> References: <4c714a9c0603011156y143b1dedv3806732629bae06c@mail.gmail.com> <20060302053829.GA30326@cfcl.com> Message-ID: <200603040822.k248MDu00559@mail0.rawbw.com> Quinn Weaver wrote: > David Alban wrote: > > > [Useful debugger tips] > > > export EDITOR=vim > > Just to be pedantic, some BSD systems expect you to use VISUAL instead > of editor (and commands like 'crontab -e' don't honor EDITOR). > So you should always do something like this in your .bash_profile: > > export EDITOR=whatever > export VISUAL=$EDITOR > > Silly, huh? The emacs-way of doing this is more like: export EDITOR=emacsclient And in your .emacs you put the line: (server-start) Then when something tries to invoke an editor, it pops open a window in your existing emacs, rather than starting another one. This is particularly convienient if the command that invoked an editor was issued in an emacs subshell. E.g. say you're running your database shell inside an emacs subshell, and you use the "edit" command to modify the last SQL you typed in: it should appear right where you're working. (Note: there's a newer substitute for "emacsclient" called "gnu-client". I don't know what the advantage is supposed to be.) From david at fetter.org Sat Mar 4 12:13:01 2006 From: david at fetter.org (David Fetter) Date: Sat, 4 Mar 2006 12:13:01 -0800 Subject: [sf-perl] Debugger goodness In-Reply-To: <200603040822.k248MDu00559@mail0.rawbw.com> References: <4c714a9c0603011156y143b1dedv3806732629bae06c@mail.gmail.com> <20060302053829.GA30326@cfcl.com> <200603040822.k248MDu00559@mail0.rawbw.com> Message-ID: <20060304201301.GB22246@fetter.org> On Sat, Mar 04, 2006 at 12:22:12AM -0800, Joseph Brenner wrote: > > Quinn Weaver wrote: > > > David Alban wrote: > > > > > [Useful debugger tips] > > > > > export EDITOR=vim > > > > Just to be pedantic, some BSD systems expect you to use VISUAL > > instead of editor (and commands like 'crontab -e' don't honor > > EDITOR). So you should always do something like this in your > > .bash_profile: > > > > export EDITOR=whatever > > export VISUAL=$EDITOR > > > > Silly, huh? > > The emacs-way of doing this is more like: > > export EDITOR=emacsclient > > And in your .emacs you put the line: > > (server-start) How could I have missed it?!? ;) http://amadeo.blog.com/repository/2/602242.p.jpg Cheers, D -- David Fetter david at fetter.org http://fetter.org/ phone: +1 415 235 3778 Remember to vote! From doom at kzsu.stanford.edu Sat Mar 4 18:21:56 2006 From: doom at kzsu.stanford.edu (Joseph Brenner) Date: Sat, 04 Mar 2006 18:21:56 -0800 Subject: [sf-perl] Debugger goodness In-Reply-To: <20060304201301.GB22246@fetter.org> References: <4c714a9c0603011156y143b1dedv3806732629bae06c@mail.gmail.com> <20060302053829.GA30326@cfcl.com> <200603040822.k248MDu00559@mail0.rawbw.com> <20060304201301.GB22246@fetter.org> Message-ID: <200603050221.k252Luu21887@mail0.rawbw.com> David Fetter wrote: > Joseph Brenner wrote: > > The emacs-way of doing this is more like: > > > > export EDITOR=emacsclient > > > > And in your .emacs you put the line: > > > > (server-start) > > How could I have missed it?!? ;) > > http://amadeo.blog.com/repository/2/602242.p.jpg Now David, I'm sure if you studied emacs for a decade or so you'd begin to appreciate it. But this isn't even one of the obscure points: in this case the words "client" and "server" mean what you'd expect them to (that is, in the possibly unlikely event that the X windows terminology makes sense to you): emacs becomes a server supplying "editing services" to other applications via the "emacsclient" program. The plethora of silly little tweaks like this are one of the things that makes me fantasize about beginning to work on that "Oyster" linux distro idea. From rdm at cfcl.com Sat Mar 4 19:33:25 2006 From: rdm at cfcl.com (Rich Morin) Date: Sat, 4 Mar 2006 19:33:25 -0800 Subject: [sf-perl] Debugger goodness In-Reply-To: <200603050221.k252Luu21887@mail0.rawbw.com> References: <4c714a9c0603011156y143b1dedv3806732629bae06c@mail.gmail.com> <20060302053829.GA30326@cfcl.com> <200603040822.k248MDu00559@mail0.rawbw.com> <20060304201301.GB22246@fetter.org> <200603050221.k252Luu21887@mail0.rawbw.com> Message-ID: At 6:21 PM -0800 3/4/06, Joseph Brenner wrote: > via the "emacsclient" program. Now I understand. Feeling lost in emacs is a sign of emacsculation... -r -- Technical editing and writing, programming, and web development: http://www.cfcl.com/rdm/resume Contact information: rdm at cfcl.com, +1 650-873-7841 From chris at noncombatant.org Sat Mar 4 21:24:41 2006 From: chris at noncombatant.org (Chris Palmer) Date: Sat, 4 Mar 2006 21:24:41 -0800 Subject: [sf-perl] perlnow (emacs as a perl ide) In-Reply-To: <200603040810.k248A2u93944@mail0.rawbw.com> References: <200603040810.k248A2u93944@mail0.rawbw.com> Message-ID: <20060305052441.GA22454@nodewarrior.org> Joseph Brenner writes: > http://obsidianrook.com/perlnow/emacs_as_perl_ide.html Thanks for sending this. I got a kick out if it. -- http://www.noncombatant.org/ http://www.boshuda.com/ From mehryar at mehryar.com Sat Mar 4 21:58:55 2006 From: mehryar at mehryar.com (mehryar) Date: Sat, 4 Mar 2006 21:58:55 -0800 (PST) Subject: [sf-perl] perlnow (emacs as a perl ide) In-Reply-To: <20060301204930.GA36580@cfcl.com> References: <200603010856.k218uFr61056@mail0.rawbw.com> <20060301204930.GA36580@cfcl.com> Message-ID: I didn't attend the last talk and Im sure this was mentioned in the talk, but if not I wanted to point out that you can tie a mod_perl debugging session to emacs. The first time I did this I got a real kick out of walking through my perl code, step by step within emacs (i.e. in the editor not just a perl debugger command line) while it was still running in mod_perl! It was like watching your cgi run in slow motion while you could play with its internals to your hearts content. How to achieve this documented here: http://mail-archives.apache.org/mod_mbox/perl-modperl/200405.mbox/%3Copr7nfpqz50jqqqv at pgweiss.sytes.net%3E ------------------------------------------------------- ... with proper design, the features come cheaply. This approach is arduous, but continues to succeed. ---Dennis Ritchie From rdm at cfcl.com Sat Mar 4 23:48:31 2006 From: rdm at cfcl.com (Rich Morin) Date: Sat, 4 Mar 2006 23:48:31 -0800 Subject: [sf-perl] PHP line-ending question Message-ID: I have some PHP code that looks like this: This is . This is That's enough... I would expect the output to look like this: This is some text. This is more text. That's enough... Instead, it looks like this: This is some text. This is more text. That's enough... FYI: % php -v PHP 4.4.1 (cli) (built: Feb 7 2006 06:26:45) ... Is this a bug or a feature? -r -- Technical editing and writing, programming, and web development: http://www.cfcl.com/rdm/resume Contact information: rdm at cfcl.com, +1 650-873-7841 From doom at kzsu.stanford.edu Sun Mar 5 00:43:07 2006 From: doom at kzsu.stanford.edu (Joseph Brenner) Date: Sun, 05 Mar 2006 00:43:07 -0800 Subject: [sf-perl] perlnow (emacs as a perl ide) In-Reply-To: References: <200603010856.k218uFr61056@mail0.rawbw.com> <20060301204930.GA36580@cfcl.com> Message-ID: <200603050843.k258h7u23926@mail0.rawbw.com> mehryar wrote: > I didn't attend the last talk and Im sure this was mentioned in the talk, No, this wasn't covered. Didn't have time to get into it. > but if not I wanted to point out that you can tie a mod_perl debugging > session to emacs. The first time I did this I got a real kick out of > walking through my perl code, step by step within emacs (i.e. in the > editor not just a perl debugger command line) while it was still running > in mod_perl! > It was like watching your cgi run in slow motion while you could play with > its internals to your hearts content. > How to achieve this documented here: > http://mail-archives.apache.org/mod_mbox/perl-modperl/200405.mbox/%3Copr7nfpqz50jqqqv at pgweiss.sytes.net%3E Looks like some good instructions... they've cleaned up the procedure since the last time I looked at this. From david at fetter.org Sun Mar 5 08:17:21 2006 From: david at fetter.org (David Fetter) Date: Sun, 5 Mar 2006 08:17:21 -0800 Subject: [sf-perl] PHP line-ending question In-Reply-To: References: Message-ID: <20060305161721.GG22246@fetter.org> On Sat, Mar 04, 2006 at 11:48:31PM -0800, Rich Morin wrote: > I have some PHP code that looks like this: > > $b = 'more text.'; > ?> > > This is . > This is > That's enough... > > I would expect the output to look like this: > > This is some text. > This is more text. > That's enough... > > Instead, it looks like this: > > This is some text. > This is more text. That's enough... I tried to reproduce this at and got something different, i.e. all on the same line. Could you post an self-contained PHP file that reproduces the problem as you see it? > > FYI: > > % php -v > PHP 4.4.1 (cli) (built: Feb 7 2006 06:26:45) > ... > > Is this a bug or a feature? Yes ;) PHP is training wheels without the bike. Cheers, D -- David Fetter david at fetter.org http://fetter.org/ phone: +1 415 235 3778 Remember to vote! From rdm at cfcl.com Sun Mar 5 09:51:47 2006 From: rdm at cfcl.com (Rich Morin) Date: Sun, 5 Mar 2006 09:51:47 -0800 Subject: [sf-perl] PHP line-ending question In-Reply-To: <20060305161721.GG22246@fetter.org> References: <20060305161721.GG22246@fetter.org> Message-ID: At 8:17 AM -0800 3/5/06, David Fetter wrote: > I tried to reproduce this at > and got something different, i.e. all on the same line. Could you > post an self-contained PHP file that reproduces the problem as you > see it? Sure! > PHP is training wheels without the bike. I cheerfully admit that PHP is inconsistent, quirky, etc. OTOH, it is often available in places where Ruby isn't and it can be used as a macro processor (like Erb) in various useful places and manners: Using PHP as a Macro Pre-processor http://www.cfcl.com/~rdm/weblog/archives/000910.html Polyglot Programming http://www.cfcl.com/~rdm/weblog/archives/000998.html BTW, I've actually found some things in PHP that Perl should have. For example, it allows hashes to have a default sort order. In Perl, I have to simulate this by doing: foreach my $key (sort(keys(%hash))) { ... -r Here's the requested code and output... rdm at cerberus [~/Work/PHP] 16: cat plex #!/usr/bin/env php # # plex - PHP line-ending example This is . This is That's enough... rdm at cerberus [~/Work/PHP] 17: plex # # plex - PHP line-ending example This is some text. This is more text. That's enough... rdm at cerberus [~/Work/PHP] 18: -- Technical editing and writing, programming, and web development: http://www.cfcl.com/rdm/resume Contact information: rdm at cfcl.com, +1 650-873-7841 From paul at makepeace.net Sun Mar 5 10:32:27 2006 From: paul at makepeace.net (Paul Makepeace) Date: Sun, 5 Mar 2006 18:32:27 +0000 Subject: [sf-perl] PHP line-ending question In-Reply-To: References: <20060305161721.GG22246@fetter.org> Message-ID: <20060305183227.GE20596@mythix.realprogrammers.com> Je 2006-03-05 17:51:47 +0000, Rich Morin skribis: > BTW, I've actually found some things in PHP that Perl should have. > For example, it allows hashes to have a default sort order. Tie::IxHash? `` This Perl module implements Perl hashes that preserve the order in which the hash elements were added. The order is not affected when values corresponding to existing keys in the IxHash are changed. The elements can also be set to any arbitrary supplied order. The familiar perl array operations can also be performed on the IxHash.'' Paul -- Paul Makepeace .............................. http://paulm.com/inchoate/ "What is sugar cube? My god is human kindness." -- http://paulm.com/toys/surrealism/ From qw at sf.pm.org Sun Mar 5 11:43:40 2006 From: qw at sf.pm.org (Quinn Weaver) Date: Sun, 5 Mar 2006 11:43:40 -0800 Subject: [sf-perl] Debugger goodness In-Reply-To: <20060304201301.GB22246@fetter.org> References: <4c714a9c0603011156y143b1dedv3806732629bae06c@mail.gmail.com> <20060302053829.GA30326@cfcl.com> <200603040822.k248MDu00559@mail0.rawbw.com> <20060304201301.GB22246@fetter.org> Message-ID: <20060305194340.GB14776@cfcl.com> On Sat, Mar 04, 2006 at 12:13:01PM -0800, David Fetter wrote: > How could I have missed it?!? ;) > > http://amadeo.blog.com/repository/2/602242.p.jpg Y'all laugh, but this is actually one of the things I like about emacs: it grows with you. You can start with a few simple commands: C-k kill (cut) lines C-y yank (paste) lines [arrow keys] navigate Ctrl-S interactive search (as you type, starts searching in file) Ctrl-R isearch backwards C-x C-s Save ... but then you'll eventually think, "I want to do x. There should be a feature to do that". So you'll run M-x apropos and search for a name that sounds reasonable (like "compile"), and, sure enough, there's a hook for running a compile process. The complete documentation for the command pops up, as Joe demo'ed, and you can run it or even jump to the source. Pretty much any esoteric feature you could want is already implemented, probably in the code that ships with Emacs, and it stays out of your face until you reach for it... but when you do, it's just there. I consider this a sane reason to like Emacs (as opposed to my possibly insane reasons such as liking LISP). Don't get me wrong; I'm not promoting emacs over other editors or saying it's the one true religion. I'm just trying to explain why people like it. There's a lot more to it than weird Ctrl-key sequences. -- qw (Quinn Weaver); #President, San Francisco Perl Mongers =for information, visit http://sf.pm.org/weblog =cut From duane.obrien at gmail.com Sun Mar 5 11:55:33 2006 From: duane.obrien at gmail.com (Duane Obrien) Date: Sun, 5 Mar 2006 11:55:33 -0800 Subject: [sf-perl] PHP line-ending question In-Reply-To: References: <20060305161721.GG22246@fetter.org> Message-ID: > rdm at cerberus [~/Work/PHP] 16: cat plex > #!/usr/bin/env php > # > # plex - PHP line-ending example > > $b = 'more text.'; > ?> > > This is . > This is > That's enough... Quirky and weird. But if you put a space or any character after the the line breaks normally. By design. http://bugs.php.net/bug.php?id=13954 http://www.php.net/manual/en/language.basic-syntax.php#language.basic-syntax.phpmode -- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Don't ever tell anybody anything. If you do, you start missing everybody. From qw at sf.pm.org Sun Mar 5 12:03:21 2006 From: qw at sf.pm.org (Quinn Weaver) Date: Sun, 5 Mar 2006 12:03:21 -0800 Subject: [sf-perl] [politics] WIPO strikes again Message-ID: <20060305200321.GA20525@cfcl.com> I don't normally forward political stuff, but this is important, imminent, and under-publicized. In short, WIPO is looking to apply broadcasting rules to Internet content, pretty much across the board. (Whether the Internet needs more regulation, I leave to you to decide.) It's a complicated issue, but that is exactly why it needs airing before an elected body. The WIPO "bill" would compel signing nations to pass legislation enforcing it, just as with the infamous DMCA. There is a call for Congress to take up the issue with a suitable public comment period, rather than just letting WIPO make the call. That's what this petition is about. You must sign by Monday or Tuesday to have an effect. Read on if you're interested... ----- Forwarded message from Seth Johnson ----- Delivered-To: funkspiel.org-quinn at funkspiel.org Mailing-List: contact fsb-help at crynwr.com; run by ezmlm Precedence: bulk X-No-Archive: yes List-Post: List-Help: List-Unsubscribe: List-Subscribe: Delivered-To: mailing list fsb at crynwr.com Date: Thu, 02 Mar 2006 08:38:29 -0500 From: Seth Johnson Organization: Real Measures X-Mailer: Mozilla 4.79 [en] (Win98; U) X-Accept-Language: en To: fsb at crynwr.com Subject: Important Statement to Review for Signing X-MDaemon-Deliver-To: fsb at crynwr.com X-Return-Path: seth.johnson at realmeasures.dyndns.org X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on mail01.beigetower X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable version=3.0.2 Hello folks, Please review the important joint statement below, related to the WIPO Broadcaster's Treaty, and consider adding your signature if you are an American citizen. Also make sure those you know who should sign are also given the opportunity. Andy Oram has written a good letter to the US Delegation to WIPO on the subject: > http://www.oreillynet.com/pub/a/etel/2006/01/13/the-problem-with-webcasting.html?page=2 CPTech Links on the Treaty: > http://www.cptech.org/ip/wipo/bt/index.html#Coments Electronic Frontier Foundation Links: > http://www.eff.org/IP/WIPO/broadcasting_treaty/ IP Justice Links: > http://www.ipjustice.org/WIPO/broadcasters.shtml Union for the Public Domain Links: > http://www.public-domain.org/?q=node/47 The Latest Draft of the Treaty: > http://www.cptech.org/ip/wipo/sccr12.2rev2.doc A survey of relevant links: > http://www.hyperorg.com/blogger/mtarchive/wipo_and_the_war_against_the_i.html If you choose to sign, please send your name along with an affiliation or appropriate short phrase to attach to your name for identification purposes, to mailto:seth.p.johnson at gmail.com. If your organization endorses the statement, please indicate that separately, so your organization will be listed under that header. Thank you for consideration. Seth Johnson Corresponding Secretary New Yorkers for Fair Use Joint Statement to Congress: Dear (Relevant Congressional Committees) (cc the WIPO Delegation): Negotiations are currently underway at the World Intellectual Property Organization (WIPO) to develop a treaty giving broadcasters power to suppress currently lawful communications. The United States delegation is also advocating similar rights for "webcasters" through which the authors of new works communicate them to the public. Some provisions of the proposed "Treaty on the Protection of Broadcasting Organizations" would merely update and standardize existing legal norms, but several proposals would require Congress to enact sweeping new laws that give private parties control over information, communication, and even copyrighted works of others, whenever they have broadcast or "webcast" the work. The novel policy areas addressed by this treaty go beyond ordinary treaty-making that seeks worldwide adherence to U.S. policy. Instead, this initiative invades Congress? prerogative to develop and establish national policy. Indeed, even as Congress is debating how best to protect network neutrality, treaty negotiators are debating how to eliminate it. The threat to personal liberties presented by this treaty is too grave to allow these new policy initiatives be handed over to an unelected delegation to negotiate with foreign countries, leaving Congress with the sole option whether to acquiesce. When dealing with policies that are related to copyright and communications, Congress's assigned powers and responsibility under Article I, Section 8 of the Constitution become particularly important. We urge two important steps. First, the new proposed regulations should be published in the Federal Register, with an invitation to the public to comment. Second, the appropriate House and Senate committees should hold hearings to more fully explore the impact of these novel legal restrictions on commerce, freedom of speech, copyright holders, network neutrality, and communications policy. Americans currently enjoy substantial freedoms with respect to broadcast and webcast communications. Under the proposed treaty, the existing options available to commercial enterprises and entrepreneurs as well as the general public to communicate news, information and entertainment would be limited by a new private gatekeeper who adds nothing of value to the content. Communications policies currently under discussion at the FCC would be impacted. Individuals and small businesses would be limited in their freedom of speech. Copyright owners would find their freedom to license their works limited by whether the work had been broadcast or webcast. The principle of network neutrality, already the subject of congressional hearings, would be all but destroyed. As able as the staff of the United States Patent and Trademark Office and the Library of Congress may be, it was never intended that they alone should stake out the United States national policy to be promoted before an unelected international body in entirely new areas abridging civil liberties. Congress should be the first to establish America?s national policies in this new area so that our WIPO delegation will have sufficient guidance to achieve legitimate objectives without impairing Constitutional principles such as freedom of speech and assembly, without impairing the value of copyrights, and without granting to private parties arbitrary power to suppress existing freedoms or burden new technologies. We cannot afford for Congress to wait for the Senate to be presented with a fully formed treaty calling for the enacting of domestic law at odds with fundamental American liberties foreign to American and international legal norms, and that would bring to a close many of the benefits of widespread personal computing and the end-to-end connectivity brought by the Internet. We ask Congress to use its authority now to shape these important communications policies impacting constitutionally based copyright laws and First Amendment liberties. Signed, (Affiliations for individual signers are for identification only. Endorsing organizations are listed separately.) William Abernathy, Independent Technical Editor Scottie D. Arnett, President, Info-Ed, Inc. Jonathan Askin, Pulver.com John Bachir, Ibiblio.org Tom Barger, DMusic.com Fred Benenson, FreeCulture.org Daniel Berninger, VON Coalition Eric Blossom, GNU Radio Joshua Breitbart, Media Tank Dave Burstein, Editor, DSL Prime Michael Calabrese, Vice President, New America Foundation Dave A. Chakrabarti, Community Technologist, CTCNet Chicago Steven Cherry, Senior Associate Editor, IEEE Spectrum Steven Clift, Publicus.Net Roland J. Cole, J.D., Ph.D., Executive Director, Software Patent Institute Gordon Cook, Editor, Publisher and Owner since 1992 of the COOK Report on Internet Protocol Walt Crawford, Editor/Publisher, Cites & Insights Cynthia H. de Lorenzi, Washington Bureau for ISP Advocacy Cory Doctorow, Author, journalist, Fulbright Chair, EFF Fellow Marshall Eubanks, CEO, AmericaFree.tv Harold Feld, Senior Vice President, Media Access Project Miles R. Fidelman, President, The Center for Civic Networking Richard Forno (bio: http://www.infowarrior.org/rick.html) Laura N. Gasaway, Professor of Law, University of North Carolina Paul Gherman, University Librarian, Vanderbilt University Shubha Ghosh, Professor of Law, Southern Methodist University Paul Ginsparg, Cornell University Fred R. Goldstein, Ionary Consulting Robin Gross, IP Justice Michael Gurstein, New Jersey Institute for Technology Jon Hall, President, Linux International Chuck Hamaker, Atkins Library, University of North Carolina - Charlotte Charles M. Hannum, consultant, founder of The NetBSD Project Dewayne Hendricks, CEO, Dandin Group David R Hughes, CEO, Old Colorado City Communications, 1993 EFF Pioneer Award Paul Hyland, Computer Professionals for Social Responsibility David S. Isenberg, Ph.D., Founder & CEO, isen.com, LLC Seth Johnson, New Yorkers for Fair Use Paul Jones, School of Information and Library Science, University of North Carolina - Chapel Hill Peter D. Junger, Professor of Law Emeritus, Case Western Reserve University Brewster Kahle, Internet Archive Jerry Kang, Professor of Law, UCLA School of Law Dennis S. Karjala, Jack E. Brown Professor of Law, Arizona State University Dan Krimm, Independent Musician Michael J. Kurtz, Astronomer and Computer Scientist, Harvard- Smithsonian Center for Astrophysics Michael Maranda, President, Association For Community Networking Kevin Marks, mediAgora Anthony McCann, www.beyondthecommons.com Sascha Meinrath, Champaign-Urbana Community Wireless Network, Free Press Edmund Mierzwinski, Consumer Program Director, U.S. Public Interest Research Group Lee N. Miller, Ph.D., Editor Emeritus, Ecological Society of America John Mitchell, InteractionLaw Tom Moritz, Chief, Knowledge Managment, Getty Research Institute Andrew Odlyzko, University of Minnesota Ken Olthoff, Advisory Board, EFF Austin Andy Oram, Editor, O'Reilly Media Bruce Perens (bio at http://perens.com/Bio.html) Ian Peter, Senior Partner, Ian Peter and Associates Pty Ltd Malla Pollack, Law Professor, American Justice School of Law Jeff Pulver, Pulver.com Tom Raftery, PodLeaders.com David P. Reed, contributor to original Internet Protocol design Jerome H. Reichman, Bunyan S. Womble Professor of Law Lawrence Rosen, Rosenlaw & Einschlag; Stanford University Lecturer in Law Bruce Schneier, security technologist and CTO, Counterpane David J. Smith, Specialist of Distributed Content Distribution and Protocols, Michigan State University Michael E. Smith, LXNY Richard Stallman, President, Free Software Foundation Fred Stutzman, Ph.D. Student, UNC Chapel Hill Peter Suber, Open Access Project Director, Public Knowledge Jay Sulzberger, New Yorkers for Fair Use Aaron Swartz, infogami Stephen H. Unger, Professor, Computer Science Department, Columbia University Eric F. Van de Velde, Ph.D., Director, Library Information Technology, California Institute of Technology Tom Vogt, independent computer security researcher David Weinberger, Harvard Berkman Center Frannie Wellings, Free Press Adam Werbach, President, Ironweed Films Stephen Wolff, igewolff.net Brett Wynkoop, Wynn Data Ltd. John Young, Cryptome.org Endorsing Organizations: Association For Community Networking (AFCN) The Center for Civic Networking Computer Professionals for Social Responsibility Contact Communications The COOK Report on Internet Protocol Cryptome.org Champaign-Urbana Community Wireless Network Dandin Group FreeCulture.org Free Press Free Software Foundation Illinois Community Technology Coalition Internet Archive Ionary Consulting IP Justice isen.com, LLC mediAgora New Yorkers for Fair Use Old Colorado City Communications Podleaders.com Pulver.com Rosenlaw & Einschlag U.S. Public Interest Research Group Washington Bureau for ISP Advocacy Wyoming.com -- [separate one-page attachment] WHY PUBLIC SCRUTINY OF THE PROPOSED BROADCASTER TREATY IS NEEDED If Congress were to hold public hearings, or if the US delegation to WIPO were to publish the current proposal for public review and comment, myriad voices from various segments of society could come forward to show that the proposed Broadcaster's Treaty: * Is written to look like existing copyright treaties, but it is not based on the constitutional requirements for copyright protection, such as originality, and in fact is antagonistic to copyrights * Is promoted as a way of standardizing existing signal protection, but in fact extends well beyond signal protection by giving broadcasters and webcasters a monopoly, for 50 years, over the content created by others the moment it is broadcast or transmitted over the Internet * Gives broadcasters greater rights than producers of original works * Accords exclusive rights to non-authors in direct violation of fundamental rights guaranteed by the Constitution * Attacks the principle of network neutrality which serves as the basis by which the Internet has fostered a profound expansion in human capacities and innovation * Grants privileges that extend beyond broadcast signals to actually give broadcasters control over works conveyed within a broadcast -- including copyrighted and public domain works * Blocks fair use and other copyright provisions that enable the public to make use of and benefit from published information * Chills freedom of expression by extending unwarranted controls over broadcast publication * Benefits broadcasters at the expense of the web, the public and future innovation * Creates a de facto tax on copyrights, freedom of speech, communications and technological progress, all for the benefit of broadcasters and webcasters who have added nothing to deserve such a windfall. ----- End forwarded message ----- From herbr at pfinders.com Sun Mar 5 12:09:59 2006 From: herbr at pfinders.com (Herb Rubin) Date: Sun, 05 Mar 2006 12:09:59 -0800 Subject: [sf-perl] PHP line-ending question In-Reply-To: References: Message-ID: <1141589399.7756.25.camel@fred.sf.pfinders.com> The output in the browser would look like that without
in between. Try print $a . "\n"; to get what you want. Herb On Sat, 2006-03-04 at 23:48, Rich Morin wrote: > I have some PHP code that looks like this: > > $b = 'more text.'; > ?> > > This is . > This is > That's enough... > > I would expect the output to look like this: > > This is some text. > This is more text. > That's enough... > > Instead, it looks like this: > > This is some text. > This is more text. That's enough... > > FYI: > > % php -v > PHP 4.4.1 (cli) (built: Feb 7 2006 06:26:45) > ... > > Is this a bug or a feature? > > -r -- Herb Rubin Pathfinders Software herbr at pfinders.com http://www.pfinders.com phone: 650-343-4571 fax: 650-343-4675 From rdm at cfcl.com Sun Mar 5 12:40:11 2006 From: rdm at cfcl.com (Rich Morin) Date: Sun, 5 Mar 2006 12:40:11 -0800 Subject: [sf-perl] PHP line-ending question In-Reply-To: <1141589399.7756.25.camel@fred.sf.pfinders.com> References: <1141589399.7756.25.camel@fred.sf.pfinders.com> Message-ID: At 12:09 PM -0800 3/5/06, Herb Rubin wrote: > The output in the browser would look like that > without
in between. Who said anything about a browser? The output, in this case, is a stream of YAML (with embedded SQL) that is being loaded by a Perl script! For details, see: Polyglot Programming http://www.cfcl.com/~rdm/weblog/archives/000998.html -r -- Technical editing and writing, programming, and web development: http://www.cfcl.com/rdm/resume Contact information: rdm at cfcl.com, +1 650-873-7841 From doom at kzsu.stanford.edu Mon Mar 6 00:18:51 2006 From: doom at kzsu.stanford.edu (Joseph Brenner) Date: Mon, 06 Mar 2006 00:18:51 -0800 Subject: [sf-perl] Debugger goodness In-Reply-To: <20060305194340.GB14776@cfcl.com> References: <4c714a9c0603011156y143b1dedv3806732629bae06c@mail.gmail.com> <20060302053829.GA30326@cfcl.com> <200603040822.k248MDu00559@mail0.rawbw.com> <20060304201301.GB22246@fetter.org> <20060305194340.GB14776@cfcl.com> Message-ID: <200603060818.k268Ipu39114@mail0.rawbw.com> Quinn Weaver wrote: > ... but then you'll eventually think, "I want to do x. There should > be a feature to do that". So you'll run > > M-x apropos > > and search for a name that sounds reasonable (like "compile"), and, > sure enough, there's a hook for running a compile process. Compare to using perl, where CPAN almost always has several modules that do (something like) what you want. > The complete documentation for the command pops up, as Joe demo'ed, > and you can run it or even jump to the source. As far as documentation goes, elisp got one thing right that perl didn't: there's a documentation string that's part of the function definition. That's what you see when you ask for help on a function. One thing that perl got right though, is the way it's so easy to write documentation for an entire package using pod. In the emacs world you're supposed to learn the "texinfo" format, which is just enough of a hassle that many things go undocumented. (The solution that I use, I picked up from Ilya Zakerevich, the author of cperl-mode: create some dummy variables with *really long* documentation strings. Essentially we abuse the "help" system, and get it play the role of the emacs "info" system.) There are a lot of comparisons that can be made between emacs and perl. Both use interpeter/runtime engines, executing a dynamic language with built-in garbage collection. Emacs defaults to interactive use, and perl defaults to non-interactive, but there are ways that either of them can cross that line. > Pretty much any esoteric feature you could want is already > implemented, probably in the code that ships with Emacs, and it stays > out of your face until you reach for it... but when you do, it's just > there. Well sort of. One of my slogans is "With emacs, every typo is a learning experience." From doom at kzsu.stanford.edu Mon Mar 6 00:22:10 2006 From: doom at kzsu.stanford.edu (Joseph Brenner) Date: Mon, 06 Mar 2006 00:22:10 -0800 Subject: [sf-perl] perlnow (emacs as a perl ide) In-Reply-To: <20060301204930.GA36580@cfcl.com> References: <200603010856.k218uFr61056@mail0.rawbw.com> <20060301204930.GA36580@cfcl.com> Message-ID: <200603060822.k268MBu40888@mail0.rawbw.com> Quinn Weaver wrote: > Joe, will you please post my Class::Std-base templates in the same > place? Okay, now those are up at http://obsidianrook.com/perlnow From josh at agliodbs.com Mon Mar 6 13:48:23 2006 From: josh at agliodbs.com (Josh Berkus) Date: Mon, 6 Mar 2006 13:48:23 -0800 Subject: [sf-perl] P3 (PHP/Perl/Postgres) geek wanted for dot-com Message-ID: <200603061348.24140.josh@agliodbs.com> Folks, My employer, GreenPlum Inc., is looking for someone with moderate levels of experience in 3 P's (Perl, PHP and PostgreSQL) to help maintain and expand our web-based CRM/support infrastructure. Contract or employment available. Occasional travel to company HQ in San Mateo is required; frequent or full-time on-site presense would be preferred. Ability to handle rapidly changing specifications and short deadlines is a must. Pay is competitive. E-mail me if interested. Feel free to forward to friends. -- --Josh Josh Berkus Aglio Database Solutions San Francisco From bart at solozone.com Mon Mar 6 15:22:19 2006 From: bart at solozone.com (Bart Alberti) Date: Mon, 06 Mar 2006 15:22:19 -0800 Subject: [sf-perl] randomize particular lines Message-ID: <440CC42B.8000109@solozone.com> here is a simple question: How do I randomize (completely scramble) every third ("n") line of a text file (and not the whole file)? Alternative: export every 3rd line, scramble these and merge the result? Simple stuff, but for an ex-user of awk... etc (:-) Bart Alberti From bart at solozone.com Mon Mar 6 16:05:47 2006 From: bart at solozone.com (Bart Alberti) Date: Mon, 06 Mar 2006 16:05:47 -0800 Subject: [sf-perl] randomize particular lines Message-ID: <440CCE5B.8000408@solozone.com> Here is the idea I am working on. Bart Alberti ------------------------>>>>>>>>>> #!/usr/bin/perl #use warnings; use strict; my $dictionary = "textfile"; my ($word); open (DICT, $dictionary) or die "Cannot open $dictionary: $!"; my @words = ; foreach (@words) { chomp($_); # print "$_,\n"; #for debug reason } if ($_ % 3 == 1){ $word = $words[rand @words]; my @scramble = split(//, $word); @scramble = sort { (-1,1)[rand 2] } @scramble; $word = $scramble; #if this line omitted, prints the whole file unchanged } foreach (@words) {print "$_\n"}; __END__ From qw at sf.pm.org Mon Mar 6 16:50:08 2006 From: qw at sf.pm.org (Quinn Weaver) Date: Mon, 6 Mar 2006 16:50:08 -0800 Subject: [sf-perl] randomize particular lines In-Reply-To: <440CCE5B.8000408@solozone.com> References: <440CCE5B.8000408@solozone.com> Message-ID: <20060307005008.GA74323@cfcl.com> On Mon, Mar 06, 2006 at 04:05:47PM -0800, Bart Alberti wrote: > Here is the idea I am working on. > Bart Alberti Randomize word order, huh? I guess this is just a learning-Perl exercise? Anyway, I see many problems. Please see my ##comments preceded by double pound signs. A few general observations: - You obviously have an incomplete grasp of the language. I would suggest reading _Learning Perl_. At the very least, you need to read some basic documentation so you can, e.g., understand how rand works, before you attempt to use it. (For rand, see the perlfunc man page; for $_, see the perlvar man page.) - This is an example of obfuscated Perl code, which gives readers headaches and gives Perl (and Perl programmers) a bad name. For instance, the line @scramble = sort { (-1,1)[rand 2] } @scramble seems deliberately obscure. I hope you don't write this kind of thing at work! #!/usr/bin/perl #use warnings; use strict; my $dictionary = "textfile"; my ($word); open (DICT, $dictionary) or die "Cannot open $dictionary: $!"; my @words = ; ## Bad variable name. This gets an array of lines, ## not an array of words. I can see by your ## following code that you know this, but you ## should use another name to make things easier ## on the reader. foreach (@words) { chomp($_); # print "$_,\n"; #for debug reason } ## Your foreach block ends, meaning that if ($_ % 3 == 1){ ## $_ is the line itself, not the line number. ## You want to find every third line, right? $word = $words[rand @words]; ## rand returns fractional numbers. ## Unfortunately Perl uses floating-point ## numbers by default, so it allows ## fractional array subscripts. However, ## you can't reliably take the 1.23'th element ## of an array. This expression will ## sometimes get you undef, which is ## probably not what you want. my @scramble = split(//, $word); @scramble = sort { (-1,1)[rand 2] } @scramble; ## This code cries out for ## documentation. It ## also suffers from the ## rand problem described ## in my preceding comment. $word = $scramble; #if this line omitted, prints the whole file unchanged } foreach (@words) {print "$_\n"}; ## Here you are printing $_, ## which is unmodified (except ## for the chomp you did). ## You have been operating on $word, ## which is a copy of an element ## of @words. So all your work is lost. __END__ PS: As of at least Perl 5.6, you can use open to create a lexically scoped filehandle object, rather than a hard-to-handle package-scoped filehandle typeglob. So instead of open (DICT, $dictionary) or die "Cannot open $dictionary: $!"; You could do open my $dict_fh, $dictionary or die "Cannot open $dictionary: $!"; That way you don't have to worry about whether you already used the name DICT, and you can simply pass $dict_fh to other functions. In short, it scales better. The other use of open isn't incorrect, just suboptimal. -- qw (Quinn Weaver); #President, San Francisco Perl Mongers =for information, visit http://sf.pm.org/weblog =cut From qw at sf.pm.org Mon Mar 6 17:03:30 2006 From: qw at sf.pm.org (Quinn Weaver) Date: Mon, 6 Mar 2006 17:03:30 -0800 Subject: [sf-perl] randomize particular lines In-Reply-To: <20060307005008.GA74323@cfcl.com> References: <440CCE5B.8000408@solozone.com> <20060307005008.GA74323@cfcl.com> Message-ID: <20060307010330.GC74323@cfcl.com> I forgot to say, $. is the current line number if you are reading lines from a file, e.g.: while (<$fh>) { if ($. % 3 == 0) { # We're on a third line (counting from line zero, which # counts as a third line in this case). } } Again, perlvar covers $. and other "global special variables" (a.k.a. "punctuation variables"). You can, and probably should, use more readable names for variables like $. Get them via 'use English qw( -no_match_vars )'. man English for details. When you're ready, Damian's _Perl Best Practices_ is a wonderful book full of helpful suggestions like 'use English qw( -no_match_vars )'. It teaches you how to write Perl that's easy maintain and, in particular, how to shy away from language features that can shoot you in the foot. Why does this whole thread make me feel like becoming a Python advocate? ;) -- qw (Quinn Weaver); #President, San Francisco Perl Mongers =for information, visit http://sf.pm.org/weblog =cut From mbudash at sonic.net Mon Mar 6 17:20:41 2006 From: mbudash at sonic.net (Michael Budash) Date: Mon, 6 Mar 2006 17:20:41 -0800 Subject: [sf-perl] randomize particular lines In-Reply-To: <440CCE5B.8000408@solozone.com> References: <440CCE5B.8000408@solozone.com> Message-ID: <2BF600F9-2C4E-4D7C-8C16-A76C80F6DDA9@sonic.net> On Mar 6, 2006, at 4:05 PM, Bart Alberti wrote: > Here is the idea I am working on. > Bart Alberti > > ------------------------>>>>>>>>>> > > #!/usr/bin/perl > > #use warnings; > use strict; > my $dictionary = "textfile"; > my ($word); > open (DICT, $dictionary) or die "Cannot open $dictionary: $!"; > my @words = ; > foreach (@words) > { > chomp($_); > # print "$_,\n"; #for debug reason > } > if ($_ % 3 == 1){ > $word = $words[rand @words]; > my @scramble = split(//, $word); > @scramble = sort { (-1,1)[rand 2] } @scramble; > $word = $scramble; #if this line omitted, prints the whole file > unchanged > } > foreach (@words) {print "$_\n"}; > __END__ not very elegant, but this works for me: perhaps someone smarter than me can take the general idea and make it elegant... use strict; my $dictionary = '/usr/share/dict/words'; # mac os x open (D, $dictionary) or die ("Can't open $dictionary: $!"); # store'em all in 3 alternating groups my ($i, %lines); foreach () { chomp; $i++; $i = 1 if $i == 4; push @{$lines{$i}}, $_; } close D; # shuffle the third group fisher_yates_shuffle( \@{$lines{3}} ); # re-join the three groups my (@words, $last); for my $g (0..(scalar(@{$lines{1}})-1)) { for my $l (1..3) { if ($lines{$l}->[$g]) { push @words, $lines{$l}->[$g]; } else { $last++; last; } } last if $last; } print "$_\n" foreach (@words); #-------------------------------- sub fisher_yates_shuffle { #-------------------------------- my $deck = shift; # $deck is a reference to an array my $i = @$deck; while ($i--) { my $j = int rand ($i+1); @$deck[$i,$j] = @$deck[$j,$i]; } } From chris at noncombatant.org Mon Mar 6 17:31:36 2006 From: chris at noncombatant.org (Chris Palmer) Date: Mon, 6 Mar 2006 17:31:36 -0800 Subject: [sf-perl] randomize particular lines In-Reply-To: <440CCE5B.8000408@solozone.com> References: <440CCE5B.8000408@solozone.com> Message-ID: <20060307013136.GA10636@nodewarrior.org> Bart Alberti writes: > #!/usr/bin/perl > > #use warnings; > use strict; Quinn already said the most important things, but I'll note another best practice (according to me, anyway). People often think that the "shebang" line is how you start a Perl program. Not so! All true Perl programs start with a 4-line preamble: #!/usr/bin/perl -T use warnings; use strict; A file beginning with anything else is actually program text in some other, inferior language. ;) If taint checking, warnings and strict cause Perl to print any warning or error messages, you definitely have a bug that you must fix. -- http://www.noncombatant.org/ http://www.boshuda.com/ From doom at kzsu.stanford.edu Mon Mar 6 18:27:37 2006 From: doom at kzsu.stanford.edu (Joseph Brenner) Date: Mon, 06 Mar 2006 18:27:37 -0800 Subject: [sf-perl] randomize particular lines In-Reply-To: <20060307013136.GA10636@nodewarrior.org> References: <440CCE5B.8000408@solozone.com> <20060307013136.GA10636@nodewarrior.org> Message-ID: <200603070227.k272Rbu40821@mail0.rawbw.com> Chris Palmer wrote: > #!/usr/bin/perl -T I don't use -T on non-cgi scripts myself... if you run them through the debugger you'll get a "too late to taint" error. From bart at solozone.com Mon Mar 6 17:35:54 2006 From: bart at solozone.com (Bart Alberti) Date: Mon, 06 Mar 2006 17:35:54 -0800 Subject: [sf-perl] randomize particular lines In-Reply-To: <2BF600F9-2C4E-4D7C-8C16-A76C80F6DDA9@sonic.net> References: <440CCE5B.8000408@solozone.com> <2BF600F9-2C4E-4D7C-8C16-A76C80F6DDA9@sonic.net> Message-ID: <440CE37A.2030505@solozone.com> Michael Budash wrote: >On Mar 6, 2006, at 4:05 PM, Bart Alberti wrote: > > > >>Here is the idea I am working on. >>Bart Alberti >> >> >not very elegant, but this works for me: perhaps someone smarter than >ird group >fisher_yates_shuffle( \@{$lines{3}} ); > ># re-join the three groups >my (@words, $last); >for my $g (0..(scalar(@{$lines{1}})-1)) { > for my $l (1..3) { > if ($lines{$l}->[$g]) { > push @words, $lines{$l}->[$g]; > } > else { > $last++; > last; > } > } > last if $last; >} > >print "$_\n" foreach (@words); > >#-------------------------------- >sub fisher_yates_shuffle { >#-------------------------------- > my $deck = shift; # $deck is a reference to an array > my $i = @$deck; > while ($i--) { > my $j = int rand ($i+1); > @$deck[$i,$j] = @$deck[$j,$i]; > } >} > > >isco-pm > > > YES indeed 4.17 in COOKBOOK page 121. Bart Alberti From bart at solozone.com Mon Mar 6 17:54:48 2006 From: bart at solozone.com (Bart Alberti) Date: Mon, 06 Mar 2006 17:54:48 -0800 Subject: [sf-perl] randomize particular lines In-Reply-To: <2BF600F9-2C4E-4D7C-8C16-A76C80F6DDA9@sonic.net> References: <440CCE5B.8000408@solozone.com> <2BF600F9-2C4E-4D7C-8C16-A76C80F6DDA9@sonic.net> Message-ID: <440CE7E8.5090700@solozone.com> Michael Budash wrote: >On Mar 6, 2006, at 4:05 PM, Bart Alberti wrote: > > > >>Here is the idea I am working on. >>Bart Alberti >> >>------------------------>>>>>>>>>> >> >>#!/usr/bin/perl >> >> > > This produced only the first two lines of my 'dictionary' namely a list thus, without randomization of anything": bart at kissling:~/scramble/goodies> perl budash.pl ABRAHAM LINCOLN ABRAHAM LINCOLN by Carl Sandburg bart at kissling:~/scramble/goodies> the 'dictionary being as you can see simply a list of authors and works running 1600 lines Bart ALberti budash.pl is: -------->>>>> use strict; my $dictionary = 'textfile'; # mac os x open (D, $dictionary) or die ("Can't open $dictionary: $!"); # store'em all in 3 alternating groups my ($i, %lines); foreach () { chomp; $i++; $i = 1 if $i == 4; push @{$lines{$i}}, $_; } close D; # shuffle the third group fisher_yates_shuffle( \@{$lines{3}} ); # re-join the three groups my (@words, $last); for my $g (0..(scalar(@{$lines{1}})-1)) { for my $l (1..3) { if ($lines{$l}->[$g]) { push @words, $lines{$l}->[$g]; } else { $last++; last; } } last if $last; } print "$_\n" foreach (@words); #-------------------------------- sub fisher_yates_shuffle { #-------------------------------- my $deck = shift; # $deck is a reference to an array my $i = @$deck; while ($i--) { my $j = int rand ($i+1); @$deck[$i,$j] = @$deck[$j,$i]; } } From fred at redhotpenguin.com Mon Mar 6 20:03:48 2006 From: fred at redhotpenguin.com (Fred Moyer) Date: Mon, 06 Mar 2006 20:03:48 -0800 Subject: [sf-perl] randomize particular lines In-Reply-To: <20060307005008.GA74323@cfcl.com> References: <440CCE5B.8000408@solozone.com> <20060307005008.GA74323@cfcl.com> Message-ID: <440D0624.3060908@redhotpenguin.com> Quinn Weaver wrote: > On Mon, Mar 06, 2006 at 04:05:47PM -0800, Bart Alberti wrote: > $word = $words[rand @words]; ## rand returns fractional numbers. > ## Unfortunately Perl uses floating-point > ## numbers by default, so it allows > ## fractional array subscripts. However, > ## you can't reliably take the 1.23'th element > ## of an array. This expression will > ## sometimes get you undef, which is > ## probably not what you want. I had to get a random index from a set last week in several places in my code. I was using '$word = $words[int(rand(@words))]' (wrapped in a subroutine call), but it's a fairly noisy idiom and I ended up using '$word = $words[rand(@words)]' as it's a bit easier on the eyes. Quinn can you explain a bit more how this expression can return undef? I'm using it with a defined @words list and haven't run into any problems yet. From mbudash at sonic.net Tue Mar 7 00:46:35 2006 From: mbudash at sonic.net (Michael Budash) Date: Tue, 7 Mar 2006 00:46:35 -0800 Subject: [sf-perl] randomize particular lines In-Reply-To: <440CE7E8.5090700@solozone.com> References: <440CCE5B.8000408@solozone.com> <2BF600F9-2C4E-4D7C-8C16-A76C80F6DDA9@sonic.net> <440CE7E8.5090700@solozone.com> Message-ID: <0E2FC923-812F-4F29-BDDB-837F882C84B3@sonic.net> On Mar 6, 2006, at 5:54 PM, Bart Alberti wrote: > This produced only the first two lines of my 'dictionary' namely a > list > thus, without randomization of anything": > > bart at kissling:~/scramble/goodies> perl budash.pl > ABRAHAM LINCOLN > ABRAHAM LINCOLN by Carl Sandburg > bart at kissling:~/scramble/goodies> > > the 'dictionary being as you can see simply a list of authors and > works > running 1600 lines > > > Bart ALberti > > budash.pl is: -------->>>>> > use strict; > my $dictionary = 'textfile'; # mac os x > open (D, $dictionary) or die ("Can't open $dictionary: $!"); > # store'em all in 3 alternating groups > my ($i, %lines); > foreach () { > chomp; > $i++; > $i = 1 if $i == 4; > push @{$lines{$i}}, $_; > } > > close D; > > # shuffle the third group > fisher_yates_shuffle( \@{$lines{3}} ); > > # re-join the three groups > my (@words, $last); > for my $g (0..(scalar(@{$lines{1}})-1)) { > for my $l (1..3) { > if ($lines{$l}->[$g]) { > push @words, $lines{$l}->[$g]; > } > else { > $last++; > last; > } > } > last if $last; > } > > print "$_\n" foreach (@words); > > #-------------------------------- > sub fisher_yates_shuffle { > #-------------------------------- > my $deck = shift; # $deck is a reference to an array > my $i = @$deck; > while ($i--) { > my $j = int rand ($i+1); > @$deck[$i,$j] = @$deck[$j,$i]; > } > } hmm. can't imagine why... From paul at makepeace.net Tue Mar 7 03:42:12 2006 From: paul at makepeace.net (Paul Makepeace) Date: Tue, 7 Mar 2006 11:42:12 +0000 Subject: [sf-perl] randomize particular lines In-Reply-To: <20060307005008.GA74323@cfcl.com> References: <440CCE5B.8000408@solozone.com> <20060307005008.GA74323@cfcl.com> Message-ID: <20060307114212.GB28737@mythix.realprogrammers.com> Je 2006-03-07 00:50:08 +0000, Quinn Weaver skribis: > $word = $words[rand @words]; ## rand returns fractional numbers. > ## Unfortunately Perl uses floating-point > ## numbers by default, so it allows > ## fractional array subscripts. However, > ## you can't reliably take the 1.23'th element > ## of an array. This expression will > ## sometimes get you undef, which is > ## probably not what you want. This one line is actually quite fine. The $array[rand @array] is a pretty standard idiom and will do what you want: the rand is rounded down (i.e. int() is implied) and scalar(@array) is one past the end of the array so the result is 0..$#array. > my @scramble = split(//, $word); > @scramble = sort { (-1,1)[rand 2] } @scramble; ## This code cries out for > ## documentation. It > ## also suffers from the > ## rand problem described > ## in my preceding comment. It's wrong too as sort's behavior doesn't permit a random comparison. perldoc -f sort, The comparison function is required to behave. If it returns inconsistent results (sometimes saying $x[1] is less than $x[2] and sometimes saying the opposite, for example) the results are not well-defined. Which is sort of a shame, as it's cute :-) Since we're promoting best practices, use Algorithm::Numerical::Shuffle 'shuffle'; @scramble = shuffle(@scramble); > $word = $scramble; #if this line omitted, prints the whole file unchanged (I wonder how $scramble got past the use strict; ?) > open (DICT, $dictionary) or die "Cannot open $dictionary: $!"; > > You could do > > open my $dict_fh, $dictionary or die "Cannot open $dictionary: $!"; > > That way you don't have to worry about whether you already used the > name DICT, and you can simply pass $dict_fh to other functions. In > short, it scales better. The other use of open isn't incorrect, > just suboptimal. Yeah, or use File::Slurp 'slurp'; # slurp is preferred Perl 6 name my @lines = slurp($dictionary); # process @lines write_file(\*STDOUT, @lines); # I think this is right Paul -- Paul Makepeace .............................. http://paulm.com/inchoate/ "If kerry feels horney, then we will put you in our curry." -- http://paulm.com/toys/surrealism/ From qw at sf.pm.org Tue Mar 7 09:42:44 2006 From: qw at sf.pm.org (Quinn Weaver) Date: Tue, 7 Mar 2006 09:42:44 -0800 Subject: [sf-perl] randomize particular lines In-Reply-To: <440D0624.3060908@redhotpenguin.com> References: <440CCE5B.8000408@solozone.com> <20060307005008.GA74323@cfcl.com> <440D0624.3060908@redhotpenguin.com> Message-ID: <20060307174244.GA23170@cfcl.com> On Mon, Mar 06, 2006 at 08:03:48PM -0800, Fred Moyer wrote: [...] > I had to get a random index from a set last week in several places in my > code. I was using '$word = $words[int(rand(@words))]' (wrapped in a > subroutine call), but it's a fairly noisy idiom and I ended up using > '$word = $words[rand(@words)]' as it's a bit easier on the eyes. > > Quinn can you explain a bit more how this expression can return undef? > I'm using it with a defined @words list and haven't run into any > problems yet. Re-running the relevant test, I believe I was mistaken. It tried index 2.2 on a two-element array. Oops. The result is undef, but that's probably the least illogical outcome in this case. Anyway, you wouldn't get an out-of-range value like that from your use of rand above. -- qw (Quinn Weaver); #President, San Francisco Perl Mongers =for information, visit http://sf.pm.org/weblog =cut From quinn at funkspiel.org Tue Mar 7 00:26:48 2006 From: quinn at funkspiel.org (Quinn Weaver) Date: Tue, 7 Mar 2006 00:26:48 -0800 Subject: [sf-perl] randomize particular lines In-Reply-To: <440D0624.3060908@redhotpenguin.com> References: <440CCE5B.8000408@solozone.com> <20060307005008.GA74323@cfcl.com> <440D0624.3060908@redhotpenguin.com> Message-ID: <20060307082648.GD8233@cfcl.com> On Mon, Mar 06, 2006 at 08:03:48PM -0800, Fred Moyer wrote: [...] > I had to get a random index from a set last week in several places in my > code. I was using '$word = $words[int(rand(@words))]' (wrapped in a > subroutine call), but it's a fairly noisy idiom and I ended up using > '$word = $words[rand(@words)]' as it's a bit easier on the eyes. > > Quinn can you explain a bit more how this expression can return undef? > I'm using it with a defined @words list and haven't run into any > problems yet. Re-running the relevant test code, I believe I was mistaken. It tried index 2.2 on a two-element array. That gets undef, but that's probably the least illogical result in that case. Anyway, you wouldn't get an out-of-range value like that from your use of rand above. -- qw (Quinn Weaver); #President, San Francisco Perl Mongers =for information, visit http://sf.pm.org/weblog =cut From quinn at sf.pm.org Tue Mar 7 09:31:01 2006 From: quinn at sf.pm.org (Quinn Weaver) Date: Tue, 7 Mar 2006 09:31:01 -0800 Subject: [sf-perl] randomize particular lines In-Reply-To: <440D0624.3060908@redhotpenguin.com> References: <440CCE5B.8000408@solozone.com> <20060307005008.GA74323@cfcl.com> <440D0624.3060908@redhotpenguin.com> Message-ID: <20060307173100.GA18296@cfcl.com> On Mon, Mar 06, 2006 at 08:03:48PM -0800, Fred Moyer wrote: [...] > I had to get a random index from a set last week in several places in my > code. I was using '$word = $words[int(rand(@words))]' (wrapped in a > subroutine call), but it's a fairly noisy idiom and I ended up using > '$word = $words[rand(@words)]' as it's a bit easier on the eyes. > > Quinn can you explain a bit more how this expression can return undef? > I'm using it with a defined @words list and haven't run into any > problems yet. Re-running the relevant test, I believe I was mistaken. It tried index 2.2 on a two-element array. Oops. The result is undef, but that's probably the least illogical outcome in that case. Anyway, you wouldn't get an out-of-range value like that from your use of rand above. -- qw (Quinn Weaver); #President, San Francisco Perl Mongers =for information, visit http://sf.pm.org/weblog =cut From chris at noncombatant.org Tue Mar 7 10:36:40 2006 From: chris at noncombatant.org (Chris Palmer) Date: Tue, 7 Mar 2006 10:36:40 -0800 Subject: [sf-perl] randomize particular lines In-Reply-To: <200603070227.k272Rbu40821@mail0.rawbw.com> References: <440CCE5B.8000408@solozone.com> <20060307013136.GA10636@nodewarrior.org> <200603070227.k272Rbu40821@mail0.rawbw.com> Message-ID: <20060307183640.GA1791@nodewarrior.org> Joseph Brenner writes: > I don't use -T on non-cgi scripts myself... You really should. Any warning you get as a result of taint checking is in fact a real, live security bug. Taint mode has no false alarms. > if you run them through the debugger you'll get a "too late to taint" > error. So make a habit of putting "-T" on *all* Perl command lines. -- http://www.noncombatant.org/ http://www.boshuda.com/ From qw at sf.pm.org Tue Mar 7 10:53:38 2006 From: qw at sf.pm.org (Quinn Weaver) Date: Tue, 7 Mar 2006 10:53:38 -0800 Subject: [sf-perl] randomize particular lines In-Reply-To: <20060307183640.GA1791@nodewarrior.org> References: <440CCE5B.8000408@solozone.com> <20060307013136.GA10636@nodewarrior.org> <200603070227.k272Rbu40821@mail0.rawbw.com> <20060307183640.GA1791@nodewarrior.org> Message-ID: <20060307185337.GD33976@cfcl.com> On Tue, Mar 07, 2006 at 10:36:40AM -0800, Chris Palmer wrote: > Joseph Brenner writes: > > > I don't use -T on non-cgi scripts myself... > > You really should. Any warning you get as a result of taint checking is > in fact a real, live security bug. Taint mode has no false alarms. By the way, for those who are interested, some Berkeley researchers presented a "taint checker" for C++ at CodeCon. (It's actually a general-purpose parser that tracks "data flow" statically, i.e. in source code. Pretty amazing, considering that it can handle templates properly.) They ran the Linux kernel through it and found six unnoticed security bugs(!) The team includes SF Perl Monger Daniel S. Wilkerson. This page by him is a great starting point: http://www.cs.berkeley.edu/~dsw/oink.html -- qw (Quinn Weaver); #President, San Francisco Perl Mongers =for information, visit http://sf.pm.org/weblog =cut From doom at kzsu.stanford.edu Tue Mar 7 15:32:06 2006 From: doom at kzsu.stanford.edu (Joseph Brenner) Date: Tue, 07 Mar 2006 15:32:06 -0800 Subject: [sf-perl] randomize particular lines In-Reply-To: <20060307183640.GA1791@nodewarrior.org> References: <440CCE5B.8000408@solozone.com> <20060307013136.GA10636@nodewarrior.org> <200603070227.k272Rbu40821@mail0.rawbw.com> <20060307183640.GA1791@nodewarrior.org> Message-ID: <200603072332.k27NW6u76572@mail0.rawbw.com> Chris Palmer wrote: > Joseph Brenner writes: > > > I don't use -T on non-cgi scripts myself... > > You really should. Any warning you get as a result of taint checking is > in fact a real, live security bug. Taint mode has no false alarms. > > > if you run them through the debugger you'll get a "too late to taint" > > error. > > So make a habit of putting "-T" on *all* Perl command lines. I tried it with perlnow.el, and I see that it grabs the -T off of the hashbang line and passes it through to the debugger automatically. If I hadn't written this, I would be impressed. (As it is, I'm impressed with how much I can forget about my own code.) From david at fetter.org Tue Mar 7 23:30:13 2006 From: david at fetter.org (David Fetter) Date: Tue, 7 Mar 2006 23:30:13 -0800 Subject: [sf-perl] March 14 Meeting of SF PostgreSQL Users' Group Message-ID: <20060308073013.GF14881@fetter.org> Folks, David Fetter (that's me ;) will be talking about how to get OO code and RDBMSs to play nicely together with some examples. Venue: Casa Donde Date: Tuesday, March 14, 2006 Time: 7:30pm RSVP: to david at fetter.org if you want the best pizza in the Bay Area. It's usually about $10 Details: http://pugs.postgresql.org/sfpug/ Cheers, David. -- David Fetter david at fetter.org http://fetter.org/ phone: +1 415 235 3778 Remember to vote! From extasia at extasia.org Wed Mar 8 18:39:37 2006 From: extasia at extasia.org (David Alban) Date: Wed, 8 Mar 2006 18:39:37 -0800 Subject: [sf-perl] Humorous RMS quote Message-ID: <4c714a9c0603081839m3e91167o914702f713ae2164@mail.gmail.com> This RMS interview URL came to me via the Oakland perl mongers list: http://www.linuxdevcenter.com/pub/a/linux/2004/12/22/rms_interview.html I *love* the following quote from it. On the environment variable POSIXLY_CORRECT: My original plan was to name it POSIX_ME_HARDER. -- Live in a world of your own, but always welcome visitors. From rdm at cfcl.com Wed Mar 8 21:54:47 2006 From: rdm at cfcl.com (Rich Morin) Date: Wed, 8 Mar 2006 21:54:47 -0800 Subject: [sf-perl] Humorous RMS quote In-Reply-To: <4c714a9c0603081839m3e91167o914702f713ae2164@mail.gmail.com> References: <4c714a9c0603081839m3e91167o914702f713ae2164@mail.gmail.com> Message-ID: Hofstadter's book elevates recursion (in the broadest sense of self-reference) to exalted heights, leading to Andrew Plotkin's recursive definition of recursion: "If you already know what recursion is, just remember the answer. Otherwise, find someone who is standing closer to Douglas Hofstadter than you are; then ask him or her what recursion is." http://www.cabochon.com/~stevey/blog-rants/godel-escher-blog.html -- http://www.cfcl.com/rdm Rich Morin http://www.cfcl.com/rdm/resume rdm at cfcl.com http://www.cfcl.com/rdm/weblog +1 650-873-7841 Technical editing and writing, programming, and web development From qw at sf.pm.org Sun Mar 12 09:17:43 2006 From: qw at sf.pm.org (Quinn Weaver) Date: Sun, 12 Mar 2006 09:17:43 -0800 Subject: [sf-perl] [Meeting] March 28: Revenge of the Son of Perl IDEs Message-ID: <20060312171743.GB99457@cfcl.com> (( This time, RSVP to Jeff.Thalhammer at barclaysglobal.com! )) There was so much response to the idea of comparing Perl IDEs, we had material for a second meeting. :) This time... - Fred Moyer will present vi(m), focusing on how it can be integrated with tools like Perltidy and the Perl debugger. - Vicki Brown will present BBEdit, a favorite edior for the Mac. - Blake D. Mills III of Airwave will present their Emacs extensions, intended for use in Extreme Programming. Date: Tuesday, March 28 Time: 8:00 p.m. Place: Barclays Global Investors, 45 Fremont St., San Francisco, CA Security: When you arrive, please tell the security people the name with which you RSVP'd. They will direct you to the meeting room. RSVP: Jeff.Thalhammer at barclaysglobal.com As always, this info is also at http://sf.pm.org/weblog. Hope to see you there! -- qw (Quinn Weaver); #President, San Francisco Perl Mongers =for information, visit http://sf.pm.org/weblog =cut From david at fetter.org Mon Mar 13 08:30:41 2006 From: david at fetter.org (David Fetter) Date: Mon, 13 Mar 2006 08:30:41 -0800 Subject: [sf-perl] TOMORROW: March 14 Meeting of SF PostgreSQL Users' Group Message-ID: <20060313163041.GL28298@fetter.org> Folks, David Fetter (that's me ;) will be talking about how to get OO code and RDBMSs to play nicely together with some examples. Venue: Casa Donde <-- print this and bring it along. Date: TOMORROW! Tuesday, March 14, 2006 Time: 7:30pm RSVP: to david at fetter.org if you want the best pizza in the Bay Area. It's usually about $10 Details: http://pugs.postgresql.org/sfpug/ Cheers, David. -- David Fetter david at fetter.org http://fetter.org/ phone: +1 415 235 3778 Remember to vote! From bart at solozone.com Tue Mar 14 10:25:40 2006 From: bart at solozone.com (Bart Alberti) Date: Tue, 14 Mar 2006 10:25:40 -0800 Subject: [sf-perl] encodings Message-ID: <44170AA4.8040903@solozone.com> question: what is the preferred way to change ISO-8859-1 extended ASCII or UTF-8 (basis of my SuSE 9.2) to gsm 338 with its odd pushing of the high bits to fit 7 bit spaces? I see perldoc Encode.pm on CPAN, indeed. This does it? iconv and recoe do not reognize 'gsm'. What is Hentai Latin 1 which is mentioned on the perldoc page ? Is it exactly the 'same' as 'gsm'? Bart Alberti From bart at solozone.com Tue Mar 14 15:12:52 2006 From: bart at solozone.com (Bart Alberti) Date: Tue, 14 Mar 2006 15:12:52 -0800 Subject: [sf-perl] gsm hentai convert In-Reply-To: <20060314211113.B0BB3B277B@lorax.ldc.upenn.edu> References: <20060314211113.B0BB3B277B@lorax.ldc.upenn.edu> Message-ID: <44174DF4.3000700@solozone.com> David Graff wrote: >bart at solozone.com said: > > >>Just to convert (which iconv does not do) ISO08859 or UTF-8 to gsm >>338 what do you suggest since I do not eneed multi byte support I >>have downloaded the Encode tar ball from CPAN. Is this a one-liner? >> >> > > perl -e 'binmode STDIN,":utf8"; binmode STDOUT,":encoding(gsm0338)"; > print while (<>)' < utf8.data > gsm.data > > >For 8859 input, the binmode on STDIN would be ":encoding(iso-8859-1)" >(or some other final digit, if your data uses some other 8859 page). > > Dave Graff > > > I do see by the 7 bit template reference that I am using stuff not capable of being sent cleanly to gsm as you can see below. Is there some easy was ( & I am about to write a shell script using 'tr' and its OCTAL values to do this) to clear (LaTeX=? \"e and so forth ) to be their equivalents without diacriticals (stripped letters if they do not make it)? Note the 'panic' statement which I have never seen before, below when I errorneously tried this using 8859 on a diffeent input when the command line said utf-8:. Bart Alberti ------------------------------------------------->>>>>>>>>>>>>>>>>> bart at kissling:~> perl -e 'binmode STDIN,":utf8"; binmode STDOUT,":encoding(gsm0338)"; print while (<>)' < books.utf8 > gsm.list.books " panic: sv_setpvn called with negative strlen at -e line 1, <> line 887. "\x{9837}" does not map to gsm0338, <> line 887. panic: sv_setpvn called with negative strlen, <> line 887. And with correct calling: perl -e 'binmode STDIN,":utf8"; binmode STDOUT,":encoding(gsm0338)"; print while (<>)' < books.utf8 > gsm.books "\x{00ed}" does not map to gsm0338 at -e line 1, <> line 56. "\x{00eb}" does not map to gsm0338 at -e line 1, <> line 238. "\x{00ed}" does not map to gsm0338 at -e line 1, <> line 371. "\x{00e1}" does not map to gsm0338 at -e line 1, <> line 371. "\x{00eb}" does not map to gsm0338 at -e line 1, <> line 371. "\x{00f4}" does not map to gsm0338 at -e line 1, <> line 397. "\x{00c7}" does not map to gsm0338 at -e line 1, <> line 554. "\x{00eb}" does not map to gsm0338, <> line 563. From graff at ldc.upenn.edu Tue Mar 14 15:35:42 2006 From: graff at ldc.upenn.edu (David Graff) Date: Tue, 14 Mar 2006 18:35:42 -0500 Subject: [sf-perl] gsm hentai convert In-Reply-To: Your message of "Tue, 14 Mar 2006 15:12:52 PST." <44174DF4.3000700@solozone.com> Message-ID: <20060314233542.490EEB278E@lorax.ldc.upenn.edu> bart at solozone.com said: > Is there some easy was ( & I am about to write a shell script using > 'tr' and its OCTAL values to do this) to clear (LaTeX=? \"e and so > forth ) to be their equivalents without diacriticals (stripped > letters if they do not make it)? Here's a pretty simple approach for normalizing all the accented Latin characters to their unaccented ASCII equivalents -- it's not a one-liner anymore, but it's not that hard... sub map_accents { my @charnames = grep /\tLATIN \S+ LETTER/, split( /^/, do 'unicore/Name.pl' ); my %deaccent; for my $c ( split //, qq/AEIOUCNYaeioucny/ ) { my $case = ( $c eq lc $c ) ? 'SMALL' : 'CAPITAL'; $deaccent{$c} = join( '', map { chr hex( substr $_, 0, 4 ) } grep /\tLATIN $case LETTER \U$c WITH/, @charnames ); } return \%accents; } # Sample usage in a main script: my $accmap = map_accents(); while (<>) { for my $c ( keys %$accmap ) { s/[$$accmap{$c}]/$c/g; } # $_ now contains no accented latin letters... } > Note the 'panic' statement which I > have never seen before, below when I errorneously tried this using > 8859 on a diffeent input when the command line said utf-8:. I'm not sure about the cause of the panic, but the message indicates you were passing a string with a character in the unicode CJK range (U9837 is a Chinese ideograph). If you really have Chinese text data in unicode, you'll need something more elaborate to handle that (conversion to pinyin, maybe?). Dave Graff From rdm at cfcl.com Wed Mar 15 21:52:09 2006 From: rdm at cfcl.com (Rich Morin) Date: Wed, 15 Mar 2006 21:52:09 -0800 Subject: [sf-perl] BASS reminder Message-ID: The Beer & Scripting SIG (http://www.cfcl.com/rdm/bass) will convene on Wed., 3/22. Be there or be elsewhere! -r P.S. I maintain a list of scripting-related groups: SF Bay Area Scripting Groups http://www.cfcl.com/rdm/bass/groups.php Pointers to any missing groups would be welcomed! -- http://www.cfcl.com/rdm Rich Morin http://www.cfcl.com/rdm/resume rdm at cfcl.com http://www.cfcl.com/rdm/weblog +1 650-873-7841 Technical editing and writing, programming, and web development From extasia at extasia.org Thu Mar 16 16:15:00 2006 From: extasia at extasia.org (David Alban) Date: Thu, 16 Mar 2006 16:15:00 -0800 Subject: [sf-perl] Question about find2perl output Message-ID: <4c714a9c0603161615l22949b40g15a1b1c7fd05d2f@mail.gmail.com> Greetings, I fed find2perl as follows: $ find2perl dir1 dir2 \( \( -name baddir1 -o -name baddir2 \ -o -name baddir3 \) -type d -prune \) -o ! -type l -type f -print This resulted in the following wanted() subroutine: sub wanted { my ($dev,$ino,$mode,$nlink,$uid,$gid); ( ( /^baddir1\z/s || /^baddir2\z/s || /^baddir3\z/s ) && ($nlink || (($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_))) && -d _ && ($File::Find::prune = 1) ) || ($nlink || (($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_))) && ! -l _ && -f _ && print("$name\n"); } I believe I understand the reason for the *second* instance of: $nlink || ( ... ) = lstat( ... ) If $nlink is true we know we've called lstat() and subsequent file tests on "_" will do The Right Thing(TM). If $nlink is not true then we haven't called lstat() and need to, to enable those file tests to succeed. But it seems to me that in the *first* instance of that code snippet, $nlink cannot ever be defined. Am I missing something? Not that it will interfere with the desired functionality, but it seems to be attempting to handle a case that isn't possible. $ perl -v This is perl, v5.8.0 built for sun4-solaris [...] $ uname -sr SunOS 5.8 Thanks, David -- Live in a world of your own, but always welcome visitors. From Jeff.Thalhammer at barclaysglobal.com Fri Mar 24 12:14:37 2006 From: Jeff.Thalhammer at barclaysglobal.com (Thalhammer, Jeffrey BGI SF) Date: Fri, 24 Mar 2006 12:14:37 -0800 Subject: [sf-perl] Reminder: SFPM meeting on Tuesday, March 28 Message-ID: <5489416797D9C546B92C7C787523B20501A24D96@calnte2k036.insidelive.net> Hello everyone- This is just a reminder that the next meeting of the SF Perl Mongers will be held next Tuesday, March 28 at Barclays Global Investors. This month, we will continue our exploration of cool Perl editors. Vicki Brown, Rich Morin, and Blake Mills will present. Barclays Global Investors is located at 45 Fremont Street in San Francisco, which is half a block from the Embarcadero Bart station and the Transbay terminal. The meeting will be held on the 29th floor in the "Palace" conference room. Someone will be posted in the lobby to help escort you through security, but I strongly suggest that you RSVP to me if you haven't already done so. And BGI will sponsor the Thai food! See you all there. http://sf.pm.org/weblog -Jeff This message and any attachments are confidential, proprietary, and may be privileged. If this message was misdirected, Barclays Global Investors (BGI) does not waive any confidentiality or privilege. If you are not the intended recipient, please notify us immediately and destroy the message without disclosing its contents to anyone. Any distribution, use or copying of this e-mail or the information it contains by other than an intended recipient is unauthorized. The views and opinions expressed in this e-mail message are the author's own and may not reflect the views and opinions of BGI, unless the author is authorized by BGI to express such views or opinions on its behalf. All email sent to or from this address is subject to electronic storage and review by BGI. Although BGI operates anti-virus programs, it does not accept responsibility for any damage whatsoever caused by viruses being passed. From qw at sf.pm.org Mon Mar 27 13:25:19 2006 From: qw at sf.pm.org (Quinn Weaver) Date: Mon, 27 Mar 2006 13:25:19 -0800 Subject: [sf-perl] [Meeting] March 28: Revenge of the Son of Perl IDEs Message-ID: <20060327212519.GA33112@cfcl.com> This is a reminder that our IDE meeting is tomorrow, Tuesday, March 28. BGI has generously agreed to spring for food, so we will have free Thai food for anyone who RSVPs. Thanks, BGI (and Jeff!) :) Details below. (( This time, RSVP to Jeff.Thalhammer at barclaysglobal.com! He's handling security. )) There was so much response to the idea of comparing Perl IDEs, we had material for a second meeting. :) This time... - Fred Moyer will present vi(m), focusing on how it can be integrated with tools like Perltidy and the Perl debugger. - Vicki Brown will present BBEdit, a favorite edior for the Mac. - Blake Mills of Airwave will present their Emacs extensions, intended for use in Extreme Programming. Date: Tuesday, March 28 Time: 8:00 p.m. Place: Barclays Global Investors, 45 Fremont St., San Francisco, CA Security: When you arrive, please tell the security people the name with which you RSVP'd. They will direct you to the meeting room. RSVP: Jeff.Thalhammer at barclaysglobal.com As always, this info is also at http://sf.pm.org/weblog. Hope to see you there! -- qw (Quinn Weaver); #President, San Francisco Perl Mongers =for information, visit http://sf.pm.org/weblog =cut From david at fetter.org Mon Mar 27 17:59:48 2006 From: david at fetter.org (David Fetter) Date: Mon, 27 Mar 2006 17:59:48 -0800 Subject: [sf-perl] [sfpug] Change of Date -- April Meeting In-Reply-To: <200603271755.35566.josh@agliodbs.com> References: <200603271755.35566.josh@agliodbs.com> Message-ID: <20060328015948.GB13576@fetter.org> On Mon, Mar 27, 2006 at 05:55:35PM -0800, Josh Berkus wrote: > Folks, > > Based on a conflict in Jack's schedule, the April Postgres event has now > been rescheduled for the following Monday. > > Time: ?Mon, Apr 17 at 7pm > Place: Adaptive Path, 363 Brannan St. ?http://www.adaptivepath.com/ > > Full details on the website RSN (pugs.postgresql.org/sfpug). Full details were up there this morning ;) Cheers, D -- David Fetter http://fetter.org/ phone: +1 415 235 3778 AIM: dfetter666 Skype: davidfetter Remember to vote! From qw at sf.pm.org Tue Mar 28 11:45:42 2006 From: qw at sf.pm.org (Quinn Weaver) Date: Tue, 28 Mar 2006 11:45:42 -0800 Subject: [sf-perl] [Meeting] March 28: Revenge of the Son of Perl IDEs In-Reply-To: <20060327212519.GA33112@cfcl.com> References: <20060327212519.GA33112@cfcl.com> Message-ID: <20060328194541.GB77680@fu.fairpath.com> Last-minute news: Vicki is unable to make it. :( So we'll just have the following: > - Fred Moyer will present vi(m), focusing on how it can be integrated > with tools like Perltidy and the Perl debugger. > > - Blake Mills of Airwave will present their Emacs extensions, > intended for use in Extreme Programming. Also, if there's time, we'll open the floor to lightning talks. )))) If this causes you to un-RSVP, please mail )))) Jeff.Thalhammer at barclaysglobal.com . Otherwise we'll see you tonight... -- Quinn Weaver | Founder, Fairpath Communications http://fairpath.com/quinn/contact/ From josh at agliodbs.com Tue Mar 28 12:03:48 2006 From: josh at agliodbs.com (Josh Berkus) Date: Tue, 28 Mar 2006 12:03:48 -0800 Subject: [sf-perl] [Meeting] March 28: Revenge of the Son of Perl IDEs In-Reply-To: <20060328194541.GB77680@fu.fairpath.com> References: <20060327212519.GA33112@cfcl.com> <20060328194541.GB77680@fu.fairpath.com> Message-ID: <200603281203.50001.josh@agliodbs.com> Quinn, I can finish off ActiveState if you want, as well as showing people Kate briefly. I'll go last though in case there isn't time. BTW, I'm *not* having pizza at the meeting, I'll have already eaten. -- --Josh Josh Berkus Aglio Database Solutions San Francisco From qw at sf.pm.org Tue Mar 28 13:30:15 2006 From: qw at sf.pm.org (Quinn Weaver) Date: Tue, 28 Mar 2006 13:30:15 -0800 Subject: [sf-perl] [Meeting] March 28: Revenge of the Son of Perl IDEs In-Reply-To: <20060328194541.GB77680@fu.fairpath.com> References: <20060327212519.GA33112@cfcl.com> <20060328194541.GB77680@fu.fairpath.com> Message-ID: <20060328213015.GC80143@fu.fairpath.com> On Tue, Mar 28, 2006 at 11:45:42AM -0800, Quinn Weaver wrote: > Last-minute news: Vicki is unable to make it. :( So we'll just have the > following: > > > - Fred Moyer will present vi(m), focusing on how it can be integrated > > with tools like Perltidy and the Perl debugger. > > > > - Blake Mills of Airwave will present their Emacs extensions, > > intended for use in Extreme Programming. Josh Berkus has gamely stepped up and offered to demo Kate, a text editor for KDE, as well as expanding on his presentation of Komodo from last meeting. (We had to truncate his Komodo talk due to time constraints, so he has more to say.) Thanks, Josh! You're a lifesaver. :) -- Quinn Weaver | Founder, Fairpath Communications http://fairpath.com/quinn/contact/ From blakem-sfpug at blakem.com Tue Mar 28 23:48:47 2006 From: blakem-sfpug at blakem.com (Blake D. Mills IV) Date: Wed, 29 Mar 2006 02:48:47 -0500 Subject: [sf-perl] Airwave emacs extensions. Message-ID: <20060329024847.A30948@cobalt.blakem.com> Just a quick note to anyone interested in the airwave emacs extensions I presented tonight.... I can be reached on this list, or at blakem-sfpug at blakem.com -Blake From fred at redhotpenguin.com Wed Mar 29 01:17:04 2006 From: fred at redhotpenguin.com (Fred Moyer) Date: Wed, 29 Mar 2006 01:17:04 -0800 Subject: [sf-perl] Perl Vim IDE source Message-ID: <442A5090.2090709@redhotpenguin.com> Folks, Here's a link to the source used for my Vim presentation: https://www.redhotpenguin.com/svn/vim Thanks to those who suggested improvements, I've incorporated as many as I could keep track of. And if you see something that you think you could improve, feel free to do an svn PUT to the source repository with your change, commit access to that uri is open. - Fred From Jeff.Thalhammer at barclaysglobal.com Fri Mar 31 00:36:05 2006 From: Jeff.Thalhammer at barclaysglobal.com (Thalhammer, Jeffrey BGI SF) Date: Fri, 31 Mar 2006 00:36:05 -0800 Subject: [sf-perl] March 28: Revenge of the Son of Perl IDEs Message-ID: <5489416797D9C546B92C7C787523B20501A24DDF@calnte2k036.insidelive.net> Perl Mongers, I just wanted to thank everyone for attending the SFPM meeting on Tuesday night. Special thanks to our guest speakers Blake Mills and Fred Moyer, and to Quinn Weaver for managing the catering. Some notes from the meeting can be found at http://sf.pm.org/weblog/. Looking ahead, Barclays Global Investors will host the next SFPM meeting on Tuesday, April 25. I will be presenting Perl::Critic, which is static source code analyzer based on Damian Conway's book "Perl Best Practices." See http://search.cpan.org/dist/Perl-Critic for more details. The list below contains all the folks who RSVP'd to the last meeting. I apologize if you sent an RSVP but I did not include you on the list. If you plan to attend any future SFPM meetings, just reply mailto:jeffrey.thalhammer at barclaysglobal.com and I'll add you to this permanent guest list so you won't have to hassle with security. Thanks. -Jeff Ackerman, Bob Alban, David Alberti, Bart Berkus, Josh Brenner, Joseph Brown, Vicki Budash, Michael Cash, Julian Christian, Storm Fetter, David Graff, David Hamlin, Brian Lyke, Dan Lyman, Belden Makepeace, Paul Mills, Blake Morin, Rich Mosley, Bill Moyer, Fred Mueller, Nathan Mungall, Chris Obrien, Duane Palmer, Chris Prickett, Shannon Rubin, Herb Salomon, David Spain, Damian Sully, Dan Weaver, Quinn This message and any attachments are confidential, proprietary, and may be privileged. If this message was misdirected, Barclays Global Investors (BGI) does not waive any confidentiality or privilege. If you are not the intended recipient, please notify us immediately and destroy the message without disclosing its contents to anyone. Any distribution, use or copying of this e-mail or the information it contains by other than an intended recipient is unauthorized. The views and opinions expressed in this e-mail message are the author's own and may not reflect the views and opinions of BGI, unless the author is authorized by BGI to express such views or opinions on its behalf. All email sent to or from this address is subject to electronic storage and review by BGI. Although BGI operates anti-virus programs, it does not accept responsibility for any damage whatsoever caused by viruses being passed.