From perl-pm at joshheumann.com Thu Feb 3 08:53:04 2005 From: perl-pm at joshheumann.com (Josh Heumann) Date: Thu Feb 3 08:53:16 2005 Subject: [Pdx-pm] February Meeting Message-ID: <33036.130.94.161.146.1107449584.squirrel@joshheumann.com> We are still without a presenter for next week's meeting. If one of you would like to do a presentation, or if a couple of people are willing to do shorter presentations, please let me know. Otherwise, we can just get together and watch The Triplets of Belleville for an hour and a half. Josh From keithl at kl-ic.com Thu Feb 3 12:18:48 2005 From: keithl at kl-ic.com (Keith Lofstrom) Date: Thu Feb 3 12:20:55 2005 Subject: [Pdx-pm] Hiding Perlish Churlishness from App users Message-ID: <20050203201848.GA32159@gate.kl-ic.com> "Perlish Churlishness"? THAT should get people's attention. The dirvish app I talked about last month exposes a lot of Perlishness to the user of the program. For example, in the config file, setting the option 'foo' to the string 'false' makes it logically TRUE, because the underlying program uses the option value as a Perl logical without further processing. This upsets some users, and that upsets me - users have enough details to worry about without getting picayune. I am thinking of adding a line to dirvish that does this: for ( @BOOLEAN_FIELDS ) { $$Options{ $_ } =~ s/(false|off|no)/0/i } (yes, we already have the array and the hash reference ) ... which allows users to use 'FALSE' and 'False' and 'false' and 'off' and 'no' (etc) as synonyms for '0' or logical FALSE in the options in the dirvish config file. While that might break config files where 'false' was used by accident when the user was confused about the effect of logical TRUE, this is far less common than people setting an option to false then getting confused when it doesn't work as expected. Are there any other consequences of this kind of change? There are other places that Dirvish is Perlish Churlish that I want to fix (loosening up the syntax on some array options, for example), but this is the easiest fix to do. Keith -- Keith Lofstrom keithl@keithl.com Voice (503)-520-1993 KLIC --- Keith Lofstrom Integrated Circuits --- "Your Ideas in Silicon" Design Contracting in Bipolar and CMOS - Analog, Digital, and Scan ICs From publiustemp-pdxpm at yahoo.com Thu Feb 3 12:43:21 2005 From: publiustemp-pdxpm at yahoo.com (Ovid) Date: Thu Feb 3 12:43:32 2005 Subject: [Pdx-pm] Hiding Perlish Churlishness from App users In-Reply-To: <20050203201848.GA32159@gate.kl-ic.com> Message-ID: <20050203204321.72522.qmail@web60803.mail.yahoo.com> The key to this is to figure out how your users are really going to use your software and try to make it fit their expectations. For example, some of the software that I am working on allows people to search a database and the syntax looks like similar to this: ok my $iterator = $store->search( $class, name => NOT 'foo', OR(description => NOT undef), ); The WHERE clause would be "WHERE name = ? OR description IS NOT NULL". A lot of effort went into making that syntax "just work." The following are all equivalent and generate the same code: name => NE 'foo', name => NOT 'foo', name => NOT EQ 'foo', It took me a lot of time to nail that down, but the benefit is clear: the programmers using this code have an application that is very easy to use and doesn't force them to constantly consult the manual. This is very important. Contrast that with the following annoyance in HTML. Guess which works: 1. 2. 3. 4. 5. 6. Cheers, Ovid ===== If this message is a response to a question on a mailing list, please send follow up questions to the list. Web Programming with Perl -- http://users.easystreet.com/ovid/cgi_course/ From spam at geekhouse.org Thu Feb 3 13:36:54 2005 From: spam at geekhouse.org (Spicy Spam) Date: Thu Feb 3 13:37:02 2005 Subject: [Pdx-pm] Perl Win32 help! Message-ID: <200502032136.j13LasQe026886@yume.wella.org> Hi All, I am having a problem with ActiveState Perl Win32 AdminMisc module. I need a way to impersonate another domain user during the life time of a script. From Dave Roth's book "Win32 Perl Programming", there is a section on "Impersonating a user" using his Win32::AdminMisc module (it is not part of ActiveState Perl distro). I follow the instruction, run "Win32::AdminMisc::LogonAsUser" and when I check the result with "Win32::AdminMisc::GetLogonName", I notice the login user has not changed. Anyone who is familiar with Perl Win32 and especially with impersonating domain user, your help will be greatly appreciated :*) Thanks, -- Sum From schwern at pobox.com Thu Feb 3 13:45:01 2005 From: schwern at pobox.com (Michael G Schwern) Date: Thu Feb 3 14:10:19 2005 Subject: [Pdx-pm] Perl Win32 help! In-Reply-To: <200502032136.j13LasQe026886@yume.wella.org> References: <200502032136.j13LasQe026886@yume.wella.org> Message-ID: <20050203214501.GC13644@windhund.schwern.org> On Thu, Feb 03, 2005 at 01:36:54PM -0800, Spicy Spam wrote: > I am having a problem with ActiveState Perl Win32 AdminMisc module. I > need a way to impersonate another domain user during the life time of > a script. From Dave Roth's book "Win32 Perl Programming", there is a > section on "Impersonating a user" using his Win32::AdminMisc module (it > is not part of ActiveState Perl distro). I follow the instruction, run > "Win32::AdminMisc::LogonAsUser" and when I check the result with > "Win32::AdminMisc::GetLogonName", I notice the login user has not > changed. I'm going to ask the obvious question: what did LogonAsUser return? From spam at geekhouse.org Thu Feb 3 14:42:29 2005 From: spam at geekhouse.org (Spicy Spam) Date: Thu Feb 3 14:42:38 2005 Subject: [Pdx-pm] Perl Win32 help! Message-ID: <200502032242.j13MgTnJ027037@yume.wella.org> > Michael G Schwern wrote: > >On Thu, Feb 03, 2005 at 01:36:54PM -0800, Spicy Spam wrote: >> I am having a problem with ActiveState Perl Win32 AdminMisc module. I >> need a way to impersonate another domain user during the life time of >> a script. From Dave Roth's book "Win32 Perl Programming", there is a >> section on "Impersonating a user" using his Win32::AdminMisc module (it >> is not part of ActiveState Perl distro). I follow the instruction, run >> "Win32::AdminMisc::LogonAsUser" and when I check the result with >> "Win32::AdminMisc::GetLogonName", I notice the login user has not >> changed. > >I'm going to ask the obvious question: what did LogonAsUser return? > Oh shit... it returns 0 ... doh! Now that I use "Win32::AdminMisc::GetError" to get the error message, I find and fixed the problem... and I need to find a place to hide :*(~~ -- Sum From ewilhelm at sbcglobal.net Fri Feb 4 08:12:56 2005 From: ewilhelm at sbcglobal.net (Eric Wilhelm) Date: Fri Feb 4 08:08:53 2005 Subject: [Pdx-pm] Hiding Perlish Churlishness from App users In-Reply-To: <20050203201848.GA32159@gate.kl-ic.com> References: <20050203201848.GA32159@gate.kl-ic.com> Message-ID: <200502041012.56731.ewilhelm@sbcglobal.net> # The following was supposedly scribed by # Keith Lofstrom # on Thursday 03 February 2005 02:18 pm: >or ( @BOOLEAN_FIELDS ) { $$Options{ $_ } =~ s/(false|off|no)/0/i } >Are there any other consequences of this kind of change? ?There are >other places that Dirvish is Perlish Churlish that I want to fix >(loosening up the syntax on some array options, for example), but >this is the easiest fix to do. You don't really want to *hide* the perlishness from the users. IMO, you want it to 'just work' for both those that know perl (I think we sometimes think a little differently) and those that don't. Hopefully, this doesn't require much hiding. http://www.joelonsoftware.com/articles/LeakyAbstractions.html If you only do the above regex, you still have some holes (e.g. syntax errors are true.) ($val =~ s/^(f|false|off|no|n|0*)$/0/i) or ($val =~ s/^(t|true|on|yes|y|1)$/1/i) or die "invalid value $val for option $opt\n"; That anchors the front and back of the string to catch any typo'd garbage, and gets 000 or even undef() to work too. (Written as "~" when your config files are in YAML format.) --Eric -- The opinions expressed in this e-mail were randomly generated by the computer and do not necessarily reflect the views of its owner. --Management From perl-pm at joshheumann.com Fri Feb 4 14:32:29 2005 From: perl-pm at joshheumann.com (Josh Heumann) Date: Fri Feb 4 14:32:37 2005 Subject: [Pdx-pm] February Meeting - Saved! Message-ID: <34123.130.94.160.138.1107556349.squirrel@joshheumann.com> Tom Heady has offered to talk about the phalanx project[1] and how to contribute. He's also going to talk about Devel::Cover and how to use it to ensure the coverage of your tests. See Randall Hansen's email from January 24th[2]. Praise be to Tom! Meeting info: February 9th, 2005 6:30pm at Free Geek, 1741 SE 10th Ave Afterwards, as always, beer at the Lucky Lab. Josh [1]: http://qa.perl.org/phalanx/ [2]: http://mail.pm.org/pipermail/pdx-pm-list/2005-January/002389.html From jamarks at jamarks.com Sat Feb 5 12:06:12 2005 From: jamarks at jamarks.com (James marks) Date: Sat Feb 5 12:06:30 2005 Subject: [Pdx-pm] Bulletin/message board recommendations? Message-ID: <477b6845121e3c5f38b70c192fc98b13@jamarks.com> Hi all, I'm interested in setting up a bulletin/message board on my server as a forum for some of my coworkers who are scattered among several different locations around Portland. Any recommendations as to a good bulletin/message board? I'm looking at yaBB but I'm not really familiar with what else is out there (nor am I familiar with yaBB, for that matter). It doesn't necessarily have to be a Perl-based system, although it might help me learn a little more about Perl if it is. Thanks! James From jamarks at jamarks.com Sat Feb 5 12:49:33 2005 From: jamarks at jamarks.com (James marks) Date: Sat Feb 5 12:49:45 2005 Subject: [Pdx-pm] Bulletin/message board follow Message-ID: <55456fbe68d680f26ea1ff67ee839ca0@jamarks.com> I guess I should have mentioned that I'm running a Linux server and looking for open source BB/message board. Thanks, James From raa at mailporter.net Mon Feb 7 13:51:38 2005 From: raa at mailporter.net (Roderick A. Anderson) Date: Mon Feb 7 13:51:56 2005 Subject: [Pdx-pm] semi-sensical phrase generator Message-ID: <4207E2EA.2030502@mailporter.net> I tried PLUG list but figured since I'm trying to program this here would be better. I didn't see ( or at least recognize ) anything to generate passphrases ( not passwords ) that make a little sense or are at least close to a sentence and , maybe , memorable. Sort-a-like-this: Miranda greped the kingdom fleeing the dragon Any pointers? TIA, Rod -- --- [This E-mail scanned for viruses by Declude Virus] From jkeroes at eli.net Mon Feb 7 14:03:10 2005 From: jkeroes at eli.net (Joshua Keroes) Date: Mon Feb 7 14:03:20 2005 Subject: [Pdx-pm] semi-sensical phrase generator In-Reply-To: <4207E2EA.2030502@mailporter.net> References: <4207E2EA.2030502@mailporter.net> Message-ID: <4207E59E.2010405@eli.net> Roderick A. Anderson wrote on 02/07/2005 01:51 PM: > I tried PLUG list but figured since I'm trying to program this here > would be better. > > I didn't see ( or at least recognize ) anything to generate passphrases > ( not passwords ) that make a little sense or are at least close to a > sentence and , maybe , memorable. Sort-a-like-this: > > Miranda greped the kingdom fleeing the dragon > > Any pointers? Travesty generator with interesting input should work. Coy.pm may be worth a look. From perl-pm at joshheumann.com Mon Feb 7 18:28:01 2005 From: perl-pm at joshheumann.com (Josh Heumann) Date: Mon Feb 7 18:28:13 2005 Subject: [Pdx-pm] February Meeting this Wednesday Message-ID: <33200.130.94.161.146.1107829681.squirrel@joshheumann.com> February 9th, 2005 6:30pm at Free Geek, 1741 SE 10th Ave Tom Heady has offered to talk about the phalanx project[1] and how to contribute. He's also going to talk about Devel::Cover and how to use it to ensure the coverage of your tests. See Randall Hansen's email from January 24th[2]. Afterwards, as always, beer at the Lucky Lab. Josh [1]: http://qa.perl.org/phalanx/ [2]: http://mail.pm.org/pipermail/pdx-pm-list/2005-January/002389.html From keithl at kl-ic.com Wed Feb 9 09:43:06 2005 From: keithl at kl-ic.com (Keith Lofstrom) Date: Wed Feb 9 09:43:24 2005 Subject: [Pdx-pm] Two peas in a perlpod Message-ID: <20050209174306.GB5577@gate.kl-ic.com> I like the idea of embedding pod documentation into the Perl programs being documented. However, the structure of the documentation I want does not exactly match the structure of the Perl programs and libraries I will have. Is possible to extract two pod documents from one Perl program, or extract one pod document from two Perl programs, perhaps by adding some special pod tags and running a special pod extractor? For example, I want to generate both a user's and a designer's doc from the same perl script; the designer's doc might be constructed out of multiple perl scripts. For extra credit, is it possible to direct the same chunk of embedded pod to multiple pod docs, or to reorder the chunks of embedded pod documentation into the final pod doc? Again, I assume enhanced pod extraction mojo will be needed, probably called by Makefile.PL . There is no doubt something that does this in CPAN, but how would I find it? Just A Newbie Perl Hacker, Keith -- Keith Lofstrom keithl@keithl.com Voice (503)-520-1993 KLIC --- Keith Lofstrom Integrated Circuits --- "Your Ideas in Silicon" Design Contracting in Bipolar and CMOS - Analog, Digital, and Scan ICs From jeff at vpservices.com Wed Feb 9 10:49:23 2005 From: jeff at vpservices.com (Jeff Zucker) Date: Wed Feb 9 10:47:19 2005 Subject: [Pdx-pm] Two peas in a perlpod In-Reply-To: <20050209174306.GB5577@gate.kl-ic.com> References: <20050209174306.GB5577@gate.kl-ic.com> Message-ID: <420A5B33.8090303@vpservices.com> Keith Lofstrom wrote: >I like the idea of embedding pod documentation > Pod rocks. >Is possible to extract two pod documents from one Perl program, > > Well there are a number of Pod parsers and other ways of dealing with Pods on CPAN including Portland's own Allison's Pod::PseudoPod. Pod::Simple is the base for most of them. >or extract one pod document from two Perl programs, perhaps by >adding some special pod tags and running a special pod extractor? >For example, I want to generate both a user's and a designer's >doc from the same perl script; the designer's doc might be >constructed out of multiple perl scripts. > > It sounds like the easiest thing to do would be to put the user's pod in the .pm file and distribute a designer.pod along with it. If you have a bunch of example scripts, each with its own pod, just let the users run perldoc on those scripts. >For extra credit, is it possible to direct the same chunk of >embedded pod to multiple pod docs, or to reorder the chunks >of embedded pod documentation into the final pod doc? > > Yes, with one of the Pod::* modules, though just using the L<> tag to make links from one document to another is easier. >Again, I assume enhanced pod extraction mojo will be needed, >probably called by Makefile.PL . > I don't think you want to distribute pod parsers with your distribution or require that the user has them. A better way would be for you to generate all the pods beforehand. >There is no doubt something >that does this in CPAN, but how would I find it? > In the Pod::** hierarchy. -- Jeff From perl-pm at joshheumann.com Wed Feb 9 13:57:29 2005 From: perl-pm at joshheumann.com (Josh Heumann) Date: Wed Feb 9 13:57:41 2005 Subject: [Pdx-pm] February Meeting Tonight Message-ID: <38002.130.94.160.138.1107986249.squirrel@joshheumann.com> Come one, come all! The meeting's tonight! February 9th, 2005 6:30pm at Free Geek, 1741 SE 10th Ave Tom Heady has offered to talk about the phalanx project[1] and how to contribute. He's also going to talk about Devel::Cover and how to use it to ensure the coverage of your tests. See Randall Hansen's email from January 24th[2]. Afterwards, as always, beer at the Lucky Lab. Josh [1]: http://qa.perl.org/phalanx/ [2]: http://mail.pm.org/pipermail/pdx-pm-list/2005-January/002389.html From andy at petdance.com Wed Feb 9 14:26:31 2005 From: andy at petdance.com (Andy Lester) Date: Wed Feb 9 14:26:47 2005 Subject: [Pdx-pm] February Meeting Tonight In-Reply-To: <38002.130.94.160.138.1107986249.squirrel@joshheumann.com> References: <38002.130.94.160.138.1107986249.squirrel@joshheumann.com> Message-ID: <20050209222631.GA24347@petdance.com> On Wed, Feb 09, 2005 at 01:57:29PM -0800, Josh Heumann (perl-pm@joshheumann.com) wrote: > Tom Heady has offered to talk about the phalanx project[1] and how to > contribute. He's also going to talk about Devel::Cover and how to use it > to ensure the coverage of your tests. See Randall Hansen's email from > January 24th[2]. Excellent! Anything I can do to help you guys, let me know. xoxo, Andy Lead Hoplite -- Andy Lester => andy@petdance.com => www.petdance.com => AIM:petdance From david at kineticode.com Wed Feb 9 15:07:05 2005 From: david at kineticode.com (David Wheeler) Date: Wed Feb 9 15:07:14 2005 Subject: [Pdx-pm] February Meeting Tonight In-Reply-To: <20050209222631.GA24347@petdance.com> References: <38002.130.94.160.138.1107986249.squirrel@joshheumann.com> <20050209222631.GA24347@petdance.com> Message-ID: On Feb 9, 2005, at 2:26 PM, Andy Lester wrote: > Excellent! Anything I can do to help you guys, let me know. Show up and buy each of us a beer? ;-) D -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2369 bytes Desc: not available Url : http://mail.pm.org/pipermail/pdx-pm-list/attachments/20050209/f1014820/smime.bin From andy at petdance.com Wed Feb 9 15:10:51 2005 From: andy at petdance.com (Andy Lester) Date: Wed Feb 9 15:11:03 2005 Subject: [Pdx-pm] February Meeting Tonight In-Reply-To: References: <38002.130.94.160.138.1107986249.squirrel@joshheumann.com> <20050209222631.GA24347@petdance.com> Message-ID: <20050209231051.GA24843@petdance.com> On Wed, Feb 09, 2005 at 03:07:05PM -0800, David Wheeler (david@kineticode.com) wrote: > On Feb 9, 2005, at 2:26 PM, Andy Lester wrote: > > >Excellent! Anything I can do to help you guys, let me know. > > Show up and buy each of us a beer? ;-) I'll swap airplane ticket for beer, you bet. -- Andy Lester => andy@petdance.com => www.petdance.com => AIM:petdance From ewilhelm at sbcglobal.net Wed Feb 9 20:17:24 2005 From: ewilhelm at sbcglobal.net (Eric Wilhelm) Date: Wed Feb 9 20:13:00 2005 Subject: [Pdx-pm] Two peas in a perlpod In-Reply-To: <20050209174306.GB5577@gate.kl-ic.com> References: <20050209174306.GB5577@gate.kl-ic.com> Message-ID: <200502092217.24516.ewilhelm@sbcglobal.net> # The following was supposedly scribed by # Keith Lofstrom # on Wednesday 09 February 2005 11:43 am: >Is possible to extract two pod documents from one Perl program, >or extract one pod document from two Perl programs, perhaps by >adding some special pod tags and running a special pod extractor? >For example, I want to generate both a user's and a designer's >doc from the same perl script; ?the designer's doc might be >constructed out of multiple perl scripts. There was some discussion on this sort of thing under the thread "not-so-plain documentation" on the module-authors list a while back. The thread got started for other reasons, but you know how threads go. IMO, perldoc needs work. So fix it, improve it, and get it into the standard distribution. That would be great. Barring that, you could lead all of the designer docs with comments, so that something like this would work: grep "#" scriptname | sed 's/^# //' | perldoc That is, it would work if you improved perldoc to be able to read stdin :-) As it is, I guess you have to use a temp file. --Eric -- "Everything should be made as simple as possible, but no simpler." --Albert Einstein From pdxpm at punch.net Thu Feb 10 00:08:03 2005 From: pdxpm at punch.net (Tom Heady) Date: Thu Feb 10 00:08:36 2005 Subject: [Pdx-pm] Phalanxing App::Info Message-ID: <4260.204.203.49.119.1108022883.squirrel@mail.snapmedical.com> Hello! Tonight we decided to take the App::Info module through the phalanx process. I was tasked/volunteered to lead this effort. I have setup a page on the wiki to track the progress: http://portland.pm.org/kwiki/index.cgi?AppInfoPhalanx On the agenda (volunteers welcome): * Document the number of tests * Setup a subversion repository * Determine Weak points in the module * get the current percentage of code coverage David, do you want more platforms tested than the CPAN testers already have? http://testers.cpan.org/show/App-Info.html Anything else? Thanks Tom From perl-pm at joshheumann.com Thu Feb 10 00:32:16 2005 From: perl-pm at joshheumann.com (Josh Heumann) Date: Thu Feb 10 00:32:25 2005 Subject: [Pdx-pm] Phalanxing App::Info In-Reply-To: <4260.204.203.49.119.1108022883.squirrel@mail.snapmedical.com> References: <4260.204.203.49.119.1108022883.squirrel@mail.snapmedical.com> Message-ID: <33154.130.94.161.146.1108024336.squirrel@joshheumann.com> > Tonight we decided to take the App::Info module through the phalanx > process. I was tasked/volunteered to lead this effort. Many thanks to Tom for leading a good meeting tonight and putting the project in front of us. > * Setup a subversion repository Currently the pdx.pm.org site is being hosted locally, but we thought that this might be a problem that many phalanx projects will have to face. Andy, has this been brought up with other groups? What was the solution? I will be in Chicago for the next week or so, but I'll track along with the conversation from the Windy City. Josh PS. Thanks to David "the curmudgeon" Wheeler for having written a module popular enough to make it onto the phalanx 100! From andy at petdance.com Thu Feb 10 02:10:04 2005 From: andy at petdance.com (Andy Lester) Date: Thu Feb 10 02:10:15 2005 Subject: [Pdx-pm] Phalanxing App::Info In-Reply-To: <4260.204.203.49.119.1108022883.squirrel@mail.snapmedical.com> References: <4260.204.203.49.119.1108022883.squirrel@mail.snapmedical.com> Message-ID: > Tonight we decided to take the App::Info module through the phalanx > process. > I was tasked/volunteered to lead this effort. Beautiful. Thanks for joining the team. > I have setup a page on the wiki to track the progress: > http://portland.pm.org/kwiki/index.cgi?AppInfoPhalanx Could I persuade you to use the Phalanx Kwiki at http://phalanx.kwiki.org, so that we can centralize all the reporting? I'd like to be able to have one place where prospective team members can see all that's being done. > On the agenda (volunteers welcome): > * Document the number of tests > * Setup a subversion repository We can use http://svn.perl.org/phalanx/. I'll need to know who needs commit access to it. Read access is wide open. Thanks! I didn't even have to buy anyone beers! xoa -- Andy Lester => andy@petdance.com => www.petdance.com => AIM:petdance From andy at petdance.com Thu Feb 10 02:10:57 2005 From: andy at petdance.com (Andy Lester) Date: Thu Feb 10 02:11:03 2005 Subject: [Pdx-pm] Phalanxing App::Info In-Reply-To: <33154.130.94.161.146.1108024336.squirrel@joshheumann.com> References: <4260.204.203.49.119.1108022883.squirrel@mail.snapmedical.com> <33154.130.94.161.146.1108024336.squirrel@joshheumann.com> Message-ID: <0E8D0391-7B4C-11D9-972F-000393DC3588@petdance.com> > > I will be in Chicago for the next week or so, but I'll track along with > the conversation from the Windy City. What are you doing out here? xoa -- Andy Lester => andy@petdance.com => www.petdance.com => AIM:petdance From pdxpm at punch.net Thu Feb 10 03:41:32 2005 From: pdxpm at punch.net (Tom Heady) Date: Thu Feb 10 03:42:05 2005 Subject: [Pdx-pm] Phalanxing App::Info Message-ID: <6436.204.203.49.119.1108035692.squirrel@mail.snapmedical.com> > Could I persuade you to use the Phalanx Kwiki at > http://phalanx.kwiki.org, so that we can centralize all the reporting? > I'd like to be able to have one place where prospective team members > can see all that's being done. > Done. New page is here: http://phalanx.kwiki.org/index.cgi?PortlandStatus Old page linked to new page. > We can use http://svn.perl.org/phalanx/. I'll need to know who needs > commit access to it. Read access is wide open. I will want commit access. Anyone else that wants commit access should email me and we'll set something up. > Thanks! I didn't even have to buy anyone beers! yet :) Tom From allison at perl.org Thu Feb 10 03:32:06 2005 From: allison at perl.org (Allison Randal) Date: Thu Feb 10 07:21:47 2005 Subject: [Pdx-pm] Two peas in a perlpod In-Reply-To: <20050209174306.GB5577@gate.kl-ic.com> References: <20050209174306.GB5577@gate.kl-ic.com> Message-ID: <4a7e26d05b13af644a2c3ce8129ded86@perl.org> On Feb 9, 2005, at 18:43, Keith Lofstrom wrote: > > I like the idea of embedding pod documentation into the Perl > programs being documented. However, the structure of the > documentation I want does not exactly match the structure of > the Perl programs and libraries I will have. You might try Mark Overmeer's OODoc: http://perl.overmeer.net/oodoc/ I'm not sure it'd meet your needs, but I just saw a talk about it at GPW about an hour ago and it looks interesting. Allison From andy at petdance.com Thu Feb 10 07:42:55 2005 From: andy at petdance.com (Andy Lester) Date: Thu Feb 10 07:43:16 2005 Subject: [Pdx-pm] Phalanxing App::Info In-Reply-To: <64fbacae050210033512e3159f@mail.gmail.com> References: <4260.204.203.49.119.1108022883.squirrel@mail.snapmedical.com> <64fbacae050210033512e3159f@mail.gmail.com> Message-ID: <20050210154255.GB31171@petdance.com> On Thu, Feb 10, 2005 at 03:35:54AM -0800, Tom Heady (tom.heady@gmail.com) wrote: > I will want commit access. > Anyone else that wants commit access should email me and we'll set something up. Make a list of people who need write access and get me their auth.perl.org IDs to forward to Robrt. Note that auth.perl.org is not the same as CPAN. xoa -- Andy Lester => andy@petdance.com => www.petdance.com => AIM:petdance From david at kineticode.com Thu Feb 10 08:28:11 2005 From: david at kineticode.com (David Wheeler) Date: Thu Feb 10 08:28:27 2005 Subject: [Pdx-pm] Phalanxing App::Info In-Reply-To: <4260.204.203.49.119.1108022883.squirrel@mail.snapmedical.com> References: <4260.204.203.49.119.1108022883.squirrel@mail.snapmedical.com> Message-ID: <06ffd7e78305ded43736d7595beb274f@kineticode.com> On Feb 10, 2005, at 12:08 AM, Tom Heady wrote: > Tonight we decided to take the App::Info module through the phalanx > process. > I was tasked/volunteered to lead this effort. > > I have setup a page on the wiki to track the progress: > http://portland.pm.org/kwiki/index.cgi?AppInfoPhalanx You might want to remove the part of the GET string there that points you to the editing interface for the new page on testers.cpan.org. > David, do you want more platforms tested than the CPAN testers already > have? > http://testers.cpan.org/show/App-Info.html Sure! The more the merrier. Win32 has been the biggest PITA, but I don't think anyone has tested it on Mac Classic, VMS, or OS/390, yet. ;-) Regards, David -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2369 bytes Desc: not available Url : http://mail.pm.org/pipermail/pdx-pm-list/attachments/20050210/e0d0285c/smime.bin From david at kineticode.com Thu Feb 10 08:29:17 2005 From: david at kineticode.com (David Wheeler) Date: Thu Feb 10 08:29:35 2005 Subject: [Pdx-pm] Phalanxing App::Info In-Reply-To: References: <4260.204.203.49.119.1108022883.squirrel@mail.snapmedical.com> Message-ID: <6333ea6e21790c89d29cd607877e5e0a@kineticode.com> On Feb 10, 2005, at 2:10 AM, Andy Lester wrote: > We can use http://svn.perl.org/phalanx/. I'll need to know who needs > commit access to it. Read access is wide open. Sign me up. username: theory. I'll import what I have when it's ready. Regards, David -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2369 bytes Desc: not available Url : http://mail.pm.org/pipermail/pdx-pm-list/attachments/20050210/fe712285/smime.bin From andy at petdance.com Thu Feb 10 08:30:48 2005 From: andy at petdance.com (Andy Lester) Date: Thu Feb 10 08:30:58 2005 Subject: [Pdx-pm] Phalanxing App::Info In-Reply-To: <6333ea6e21790c89d29cd607877e5e0a@kineticode.com> References: <4260.204.203.49.119.1108022883.squirrel@mail.snapmedical.com> <6333ea6e21790c89d29cd607877e5e0a@kineticode.com> Message-ID: <20050210163048.GA32074@petdance.com> On Thu, Feb 10, 2005 at 08:29:17AM -0800, David Wheeler (david@kineticode.com) wrote: >We can use http://svn.perl.org/phalanx/. I'll need to know who needs > >commit access to it. Read access is wide open. > > Sign me up. username: theory. I'll import what I have when it's ready. I'll let Tom collect 'em, so I don't swamp Robrt with onesie-twosie requests. xoxo, Andy -- Andy Lester => andy@petdance.com => www.petdance.com => AIM:petdance From randall at sonofhans.net Thu Feb 10 09:04:53 2005 From: randall at sonofhans.net (Randall Hansen) Date: Thu Feb 10 09:05:05 2005 Subject: [Pdx-pm] Phalanxing App::Info In-Reply-To: <0E8D0391-7B4C-11D9-972F-000393DC3588@petdance.com> References: <4260.204.203.49.119.1108022883.squirrel@mail.snapmedical.com> <33154.130.94.161.146.1108024336.squirrel@joshheumann.com> <0E8D0391-7B4C-11D9-972F-000393DC3588@petdance.com> Message-ID: <436d746e9498159acbc1103e721c3865@sonofhans.net> On Feb 10, 2005, at 2:10 AM, Andy Lester wrote: >> I will be in Chicago for the next week or so, but I'll track along >> with >> the conversation from the Windy City. > > What are you doing out here? Portland is too sunny and beautiful for him. he wants ice, wind, and 3 feet of snow. :) r From pdxpm at punch.net Thu Feb 10 12:58:09 2005 From: pdxpm at punch.net (Tom Heady) Date: Thu Feb 10 12:59:09 2005 Subject: [Pdx-pm] Phalanxing App::Info In-Reply-To: <06ffd7e78305ded43736d7595beb274f@kineticode.com> References: <4260.204.203.49.119.1108022883.squirrel@mail.snapmedical.com> <06ffd7e78305ded43736d7595beb274f@kineticode.com> Message-ID: <7514.204.203.49.119.1108069089.squirrel@mail.snapmedical.com> > On Feb 10, 2005, at 12:08 AM, Tom Heady wrote: > >> I have setup a page on the wiki to track the progress: >> http://portland.pm.org/kwiki/index.cgi?AppInfoPhalanx > > You might want to remove the part of the GET string there that points > you to the editing interface for the new page on testers.cpan.org. Thanks for whoever fixed this. I was up way to late last night :) >> David, do you want more platforms tested than the CPAN testers already >> have? http://testers.cpan.org/show/App-Info.html > > Sure! The more the merrier. Win32 has been the biggest PITA, but I > don't think anyone has tested it on Mac Classic, VMS, or OS/390, yet. > ;-) > So do we have anyone who has access to these platforms? Tom From keithl at kl-ic.com Thu Feb 10 13:31:25 2005 From: keithl at kl-ic.com (Keith Lofstrom) Date: Thu Feb 10 13:31:47 2005 Subject: [Pdx-pm] Man/Nroff to POD Message-ID: <420BD2AD.90903@kl-ic.com> I have 5 man pages to turn into pod. Yes, I can do that with a text editor. I would rather use a program if one exists. Looking through CPAN, it looks like I can do nroff -> html -> pod . Does anyone know of a cleaner way to do this? Keith -- Keith Lofstrom keithl@keithl.com Voice (503)-520-1993 KLIC --- Keith Lofstrom Integrated Circuits --- "Your Ideas in Silicon" Design Contracting in Bipolar and CMOS - Analog, Digital, and Scan ICs From keithl at kl-ic.com Sun Feb 13 21:39:53 2005 From: keithl at kl-ic.com (Keith Lofstrom) Date: Sun Feb 13 21:40:07 2005 Subject: [Pdx-pm] Build vs. MakeMaker In-Reply-To: <20050210114213.B4F16177CD@x6.develooper.com> References: <20050210114213.B4F16177CD@x6.develooper.com> Message-ID: <20050214053953.GA31803@gate.kl-ic.com> Still learning about building apps. Apparently MakeMaker is passe, and the New Thing is Module::Build . OTOH, MakeMaker always works with most Perl installations, while Build may not be fully rolled out yet. OTGH, it apparently is possible to hack things so that the first thing Makefile.pl does is install Build. So confusing! I want to roll out a test version of Dirvish in the next two weeks, followed by a production version in a couple of months. I would like to keep things as simple as possible. I would also like to learn the New Thing and not bother learning the Old Thing if I can. Suggestions? Keith -- Keith Lofstrom keithl@keithl.com Voice (503)-520-1993 KLIC --- Keith Lofstrom Integrated Circuits --- "Your Ideas in Silicon" Design Contracting in Bipolar and CMOS - Analog, Digital, and Scan ICs From merlyn at stonehenge.com Sun Feb 13 22:03:06 2005 From: merlyn at stonehenge.com (Randal L. Schwartz) Date: Sun Feb 13 22:03:16 2005 Subject: [Pdx-pm] Build vs. MakeMaker In-Reply-To: <20050214053953.GA31803@gate.kl-ic.com> References: <20050210114213.B4F16177CD@x6.develooper.com> <20050214053953.GA31803@gate.kl-ic.com> Message-ID: <86wttbhe5h.fsf@blue.stonehenge.com> >>>>> "Keith" == Keith Lofstrom writes: Keith> Still learning about building apps. Apparently MakeMaker is passe, Keith> and the New Thing is Module::Build . OTOH, MakeMaker always works Keith> with most Perl installations, while Build may not be fully rolled Keith> out yet. OTGH, it apparently is possible to hack things so that Keith> the first thing Makefile.pl does is install Build. Module::Build is still in mid-alpha, early beta. Not ready for prime time. Give it another six months or so. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training! From chromatic at wgz.org Sun Feb 13 22:38:07 2005 From: chromatic at wgz.org (chromatic) Date: Sun Feb 13 22:38:56 2005 Subject: [Pdx-pm] Build vs. MakeMaker In-Reply-To: <20050214053953.GA31803@gate.kl-ic.com> References: <20050210114213.B4F16177CD@x6.develooper.com> <20050214053953.GA31803@gate.kl-ic.com> Message-ID: <1108363087.30693.7.camel@localhost> On Sun, 2005-02-13 at 21:39 -0800, Keith Lofstrom wrote: > Still learning about building apps. Apparently MakeMaker is passe, > and the New Thing is Module::Build . OTOH, MakeMaker always works > with most Perl installations, while Build may not be fully rolled > out yet. OTGH, it apparently is possible to hack things so that > the first thing Makefile.pl does is install Build. > > So confusing! I want to roll out a test version of Dirvish in the > next two weeks, followed by a production version in a couple of > months. I would like to keep things as simple as possible. I > would also like to learn the New Thing and not bother learning the > Old Thing if I can. Suggestions? For simple installations of pure-Perl modules, they're of equal ability and difficulty. The nice thing about Module::Build is that customzing the build is as easy as writing Perl. The bad thing about MakeMaker is that customizing the build is as hard as running regular expressions against generated Makefiles or else figuring out how its inheritance hierarchy works. You should be fine with either one. Module::Build is almost in bleadperl, so it's reasonably stable and solid and has certainly done me no wrong. -- c From pdxpm at punch.net Sun Feb 13 23:09:30 2005 From: pdxpm at punch.net (Tom Heady) Date: Sun Feb 13 23:10:03 2005 Subject: [Pdx-pm] write access to subversion for App::Info Message-ID: <9660.204.203.49.119.1108364970.squirrel@mail.snapmedical.com> Andy, It looks like the following people need write access to subversion: thinc theory creamyg Thanks, Tom From schwern at pobox.com Mon Feb 14 01:08:35 2005 From: schwern at pobox.com (Michael G Schwern) Date: Mon Feb 14 01:08:37 2005 Subject: [Pdx-pm] Build vs. MakeMaker In-Reply-To: <86wttbhe5h.fsf@blue.stonehenge.com> References: <20050210114213.B4F16177CD@x6.develooper.com> <20050214053953.GA31803@gate.kl-ic.com> <86wttbhe5h.fsf@blue.stonehenge.com> Message-ID: <20050214090835.GA10761@windhund.schwern.org> On Sun, Feb 13, 2005 at 10:03:06PM -0800, Randal L. Schwartz wrote: > Module::Build is still in mid-alpha, early beta. Not ready for > prime time. Give it another six months or so. This is a bit misleading. It could be considered in alpha state because the interface is still being added to vigourously but in terms of code and doc quality its quite stable and usable. chromatic hit the nail on the head. MakeMaker is a nightmare to customize because in the end you're modifying snippets of make code which may or may not look the same in the next version. Furthermore, you're stuck writing shell one-liners rather than Perl code with all the maintenance and portability nightmares that brings. With MB its just Perl. See also "MakeMaker is DOOMED" http://www.pobox.com/~schwern/talks/MakeMaker_Is_DOOMED/slides/slide001.html From andy at petdance.com Mon Feb 14 09:34:27 2005 From: andy at petdance.com (Andy Lester) Date: Mon Feb 14 09:34:37 2005 Subject: [Pdx-pm] write access to subversion for App::Info In-Reply-To: <9660.204.203.49.119.1108364970.squirrel@mail.snapmedical.com> References: <9660.204.203.49.119.1108364970.squirrel@mail.snapmedical.com> Message-ID: <20050214173427.GA18081@petdance.com> On Sun, Feb 13, 2005 at 11:09:30PM -0800, Tom Heady (pdxpm@punch.net) wrote: > thinc > theory > creamyg Done. I set up the tree for you guys, too. xoa -- Andy Lester => andy@petdance.com => www.petdance.com => AIM:petdance From david at kineticode.com Mon Feb 14 18:58:26 2005 From: david at kineticode.com (David Wheeler) Date: Mon Feb 14 18:58:35 2005 Subject: [Pdx-pm] write access to subversion for App::Info In-Reply-To: <20050214173427.GA18081@petdance.com> References: <9660.204.203.49.119.1108364970.squirrel@mail.snapmedical.com> <20050214173427.GA18081@petdance.com> Message-ID: <747ce0e3e072210925d046b95d11a1a7@kineticode.com> On Feb 14, 2005, at 9:34 AM, Andy Lester wrote: > Done. I set up the tree for you guys, too. Thanks Andy. I committed the changes to the trunk to bring it into line with what I have in my own repository, including the new errors.t test script I started during the meeting. So have at it, all! Regards, David From cdawson at webiphany.com Tue Feb 15 14:47:54 2005 From: cdawson at webiphany.com (Chris Dawson) Date: Tue Feb 15 14:48:46 2005 Subject: [Pdx-pm] ExtUtils::MakeMaker Message-ID: <42127C1A.5030405@webiphany.com> I am having some trouble figuring out how to use MakeMaker. I have a Makefile.PL which looks like this: use ExtUtils::MakeMaker; WriteMakefile( NAME => "Smil", PMLIBDIRS => [ ( ".", "SMIL", "RN" ) ] ); package MY; sub libscan { # Determine things that should *not* be installed my($self, $path) = @_; return '' if $path !~ m/\.pm$/i; $path; } The directory appears like this: -rw-rw-rw- 1 cdawson users 288 2004-03-31 17:26 Makefile.PL -rw-rw-rw- 1 cdawson users 1903 2004-03-31 17:26 README drwxr-xr-x 4 cdawson users 120 2005-02-15 14:15 lib I have a base module Smil.pm and two directories with supporting modules in SMIL and RN, inside the lib directory. When I run perl Makefile.PL && make && make test && make install, the test fails when it tries to find a module in the SMIL directory. Is there something I am doing incorrectly here? I haven't modified this Makefile in a long time; it seemed like it used to work and install all modules. I recently read that .pm files should be placed into a lib directory within the tgz'ed file, so I did this, but to no avail. Chris From raa at mailporter.net Tue Feb 15 16:18:39 2005 From: raa at mailporter.net (Roderick A. Anderson) Date: Tue Feb 15 16:16:54 2005 Subject: [Pdx-pm] Escaping strings for SQL insertion Message-ID: <4212915F.5090402@mailporter.net> This just went by on the PLUG list today and I was smiling thinking "I don't make those mistakes" ... then reality slapped my along side the head. While testing an older application I entered single quotes ( apostrophes ) in a string and Win32::ODBC mostly choked. So I've been looking on CPAN but didn't see anything that looks "right". Win32::ODBC doesn't have ( from what I can tell ) quote/unquote functions and DBI only has quote. I'll be converting to DBI shortly and would bet I could kludge something together to unquote my strings before passing them back but in the mean time anyone have a quick method to make strings SQL safe or safe for SQL? Thanks, Rod -- --- [This E-mail scanned for viruses by Declude Virus] From nat at powning.org Tue Feb 15 16:18:34 2005 From: nat at powning.org (Nathaniel Powning) Date: Tue Feb 15 16:25:03 2005 Subject: [Pdx-pm] Escaping strings for SQL insertion In-Reply-To: <4212915F.5090402@mailporter.net> References: <4212915F.5090402@mailporter.net> Message-ID: On Tue, 15 Feb 2005, Roderick A. Anderson wrote: > Win32::ODBC doesn't have ( from what I can tell ) quote/unquote > functions and DBI only has quote. I'll be converting to DBI shortly and > would bet I could kludge something together to unquote my strings before > passing them back but in the mean time anyone have a quick method to > make strings SQL safe or safe for SQL? In good practice the strings should be kept separate from the query, in DBI you should prepare your query using question marks as place holders and set their values using bind_param. From david at kineticode.com Tue Feb 15 17:28:20 2005 From: david at kineticode.com (David Wheeler) Date: Tue Feb 15 17:28:34 2005 Subject: [Pdx-pm] Escaping strings for SQL insertion In-Reply-To: References: <4212915F.5090402@mailporter.net> Message-ID: On Feb 15, 2005, at 4:18 PM, Nathaniel Powning wrote: > In good practice the strings should be kept separate from the query, in > DBI you should prepare your query using question marks as place holders > and set their values using bind_param. But if, for whatever reason, you can't do that, use the DBI's quote() method. From the docs: "quote" $sql = $dbh->quote($value); $sql = $dbh->quote($value, $data_type); Quote a string literal for use as a literal value in an SQL state- ment, by escaping any special characters (such as quotation marks) contained within the string and adding the required type of outer quotation marks. $sql = sprintf "SELECT foo FROM bar WHERE baz = %s", $dbh->quote("Don't"); For most database types, quote would return 'Don''t' (including the outer quotation marks). An undefined $value value will be returned as the string "NULL" (without single quotation marks) to match how NULLs are represented in SQL. If $data_type is supplied, it is used to try to determine the required quoting behaviour by using the information returned by "type_info". As a special case, the standard numeric types are optimized to return $value without calling "type_info". Quote will probably not be able to deal with all possible input (such as binary data or data containing newlines), and is not related in any way with escaping or quoting shell meta-characters. It is valid for the quote() method to return an SQL expression that evaluates to the desired string. For example: $quoted = $dbh->quote("one\ntwo\0three") may return something like: CONCAT('one', CHAR(12), 'two', CHAR(0), 'three') The quote() method should not be used with "Placeholders and Bind Values". Regards, David From jeff at vpservices.com Tue Feb 15 17:45:44 2005 From: jeff at vpservices.com (Jeff Zucker) Date: Tue Feb 15 17:43:18 2005 Subject: [Pdx-pm] Escaping strings for SQL insertion In-Reply-To: <4212915F.5090402@mailporter.net> References: <4212915F.5090402@mailporter.net> Message-ID: <4212A5C8.8000508@vpservices.com> Roderick A. Anderson wrote: > While testing an older application I entered single quotes ( > apostrophes ) in a string and Win32::ODBC mostly choked. SQL should look like this: WHERE col_name = 'string_value', in other words, there should be single quotes around the string _value. If that value contains a single quote, everything gets confused because you end up with WHERE col_name ='O'Reilly' and there's no way to know where the value ends. Most dialects of SQL use two single-quotes to escape an embedded quote, though some use backslash or other things. So proper SQL should look like WHERE col_name='O''Reilly'. DBI provides the quote() method to escape the embedded single quotes for you, but it is essentially just putting an escape character in front for you. When you get to DBI, use placeholders instead, but for Win32::ODBC, either write your own quote-escaping or better, just copy the quote() method from DBD::ODBC. > Win32::ODBC doesn't have ( from what I can tell ) quote/unquote > functions and DBI only has quote. I'll be converting to DBI shortly > and would bet I could kludge something together to unquote my strings > before passing them back You don't need to reverse the quoting. When you insert 'O''Reilly' you are really inserting O'Reilly and that's how it will come back from the database. -- Jeff From 9nn24e402 at sneakemail.com Tue Feb 15 20:48:21 2005 From: 9nn24e402 at sneakemail.com (Steve Bonds) Date: Tue Feb 15 20:48:34 2005 Subject: [Pdx-pm] Escaping strings for SQL insertion In-Reply-To: <4212A5C8.8000508@vpservices.com> References: <4212915F.5090402@mailporter.net> <4212A5C8.8000508@vpservices.com> Message-ID: <27562-14747@sneakemail.com> On Tue, 15 Feb 2005 17:45:44 -0800, Jeff Zucker wrote: > SQL should look like this: WHERE col_name = 'string_value', in other > words, there should be single quotes around the string _value. If that > value contains a single quote, everything gets confused because you end > up with WHERE col_name ='O'Reilly' and there's no way to know where the > value ends. The SQL Inserters have already thought of this and often use the SQL comment character "--" to end the SQL statement before that closing quote is reached. This is a really nice, concise discussion of SQL insertion: http://www.unixwiz.net/techtips/sql-injection.html The section on "mitigations" is especially good. He heartily recommends using the PREPARE statement in addition to the usual input sanitizing. -- Steve From keithl at kl-ic.com Tue Feb 15 21:23:06 2005 From: keithl at kl-ic.com (Keith Lofstrom) Date: Tue Feb 15 21:23:20 2005 Subject: [Pdx-pm] File::Path rmtree modification Message-ID: <20050216051813.GA27528@gate.kl-ic.com> Perl newbie here; rmtree() in the File::Path package does something that I want-- almost. This is two questions; (One), am I thinking correctly about what I want to do, and (B), if a package is Almost Right (but not quite), what is the most maintainable way to do the Right Thing? For those of you who dote on Secunia security advisories, you are of course familiar with http://secunia.com/advisories/13643/, " Perl File::Path::rmtree Race Condition ". rmtree() is intended to delete a directory tree. It can be set to either skip directories with incorrect permissions (say 0500 ), or to chmod them to 0777 then proceed with deleting them and their contents. The security hole is that if the directory is set to 0777, somebody else can write into it before it is deleted; if the process is interrupted, a 0777 directory remains. A bit far-fetched, but we Linux/Unix folk are a cautious sort. Question Numero Uno: Why the heck the authors ( Tim Bunce and Charles Bailey ) felt it necessary to chmod the recalcitrant directory to 0777 ! Newbie here thinks that if the directory has a different owner or group, the chmod fails anyway, and if the directory is mine, I can chmod it to 0700 and do my removal without setting the other permissions. If the removal fails and leaves an incorrect 0700 instead of where I started, the directory is slated (somehow) for destruction anyway, so no important damage is done. And no security hole created. So, *am* I thinking? Question Roman Numeral II: If I *am* thinking correctly, and the authors say "go away kid, don't bother me" then I am faced with building a local version of rmtree(), and distributing that version with my app. I can rename it and put it in the app's library, but is that the best way? Keith -- Keith Lofstrom keithl@keithl.com Voice (503)-520-1993 KLIC --- Keith Lofstrom Integrated Circuits --- "Your Ideas in Silicon" Design Contracting in Bipolar and CMOS - Analog, Digital, and Scan ICs From schwern at pobox.com Tue Feb 15 23:51:42 2005 From: schwern at pobox.com (Michael G Schwern) Date: Wed Feb 16 01:54:19 2005 Subject: [Pdx-pm] File::Path rmtree modification In-Reply-To: <20050216051813.GA27528@gate.kl-ic.com> References: <20050216051813.GA27528@gate.kl-ic.com> Message-ID: <20050216075142.GB21586@windhund.schwern.org> On Tue, Feb 15, 2005 at 09:23:06PM -0800, Keith Lofstrom wrote: > Question Numero Uno: Why the heck the authors ( Tim Bunce and > Charles Bailey ) felt it necessary to chmod the recalcitrant > directory to 0777 ! Simple answer: its cross-platform. Some file/operating systems won't let you delete a directory unless you have write permission so the simplest thing to do is to give yourself write permission. Keep in mind that the "authors" section in core Perl libraries is often just "the original authors" and that the code has likely been patched many hundreds of times by many other people. Often what happens is a patch comes into p5p "Hi, I'm running ObscureOS 3.4 and found a bug in rmtree(). This patch fixes it" and p5p goes, "Uuuuuhhh... sure, looks harmless, ok". > Newbie here thinks that if the directory > has a different owner or group, the chmod fails anyway, and > if the directory is mine, I can chmod it to 0700 and do my > removal without setting the other permissions. I believe using 0777 is an artifact of MacPerl's attempt to map chmod into file lock/unlock where chmod 0444 meant "lock" and chmod 0666 meant "unlock" though I could be wrong. Or nobody was paying too much attention. Hypothetical microsecond security holes weren't so much an issue Back Then. > Question Roman Numeral II: If I *am* thinking correctly, and the > authors say "go away kid, don't bother me" then I am faced with > building a local version of rmtree(), and distributing that > version with my app. I can rename it and put it in the app's > library, but is that the best way? rmtree() is currently in the process of being reworked on p5p. At the heart of things is that File::Path is very old code and nobody has taken the time to rework it. I'd give you a reference to the relevant thread but I ain't got the Internet at the moment. From schwern at pobox.com Tue Feb 15 23:37:08 2005 From: schwern at pobox.com (Michael G Schwern) Date: Wed Feb 16 03:00:56 2005 Subject: [Pdx-pm] ExtUtils::MakeMaker In-Reply-To: <42127C1A.5030405@webiphany.com> References: <42127C1A.5030405@webiphany.com> Message-ID: <20050216073708.GA21586@windhund.schwern.org> On Tue, Feb 15, 2005 at 02:47:54PM -0800, Chris Dawson wrote: > I am having some trouble figuring out how to use MakeMaker. I have a > Makefile.PL which looks like this: > > use ExtUtils::MakeMaker; > > WriteMakefile( NAME => "Smil", > PMLIBDIRS => [ ( ".", "SMIL", "RN" ) ] ); > > package MY; > > sub libscan > { # Determine things that should *not* be installed > my($self, $path) = @_; > return '' if $path !~ m/\.pm$/i; > $path; > } You're going to feel silly. use ExtUtils::MakeMaker; WriteMakefile( NAME => 'Smil' ); MakeMaker will figure out the rest. Your additions above are actually sabotaging MakeMaker's default "find my pm files" logic. I'm curious why you put them there in the first place (to better understand why new users get confused). The basics are covered in ExtUtils::MakeMaker::Tutorial. From keithl at kl-ic.com Wed Feb 16 07:22:39 2005 From: keithl at kl-ic.com (Keith Lofstrom) Date: Wed Feb 16 07:22:51 2005 Subject: [Pdx-pm] File::Path rmtree modification (2) In-Reply-To: <20050216075142.GB21586@windhund.schwern.org> References: <20050216051813.GA27528@gate.kl-ic.com> <20050216075142.GB21586@windhund.schwern.org> Message-ID: <20050216152239.GB1915@gate.kl-ic.com> I wrote about the directory chmod problem of File::Path::rmtree, where an unwritable directory is set to chmod 0777 before removal. On Wed, Feb 16, 2005 at 02:51:42AM -0500, Michael G Schwern wrote: ... > rmtree() is currently in the process of being reworked on p5p. At the heart > of things is that File::Path is very old code and nobody has taken the time > to rework it. I'd give you a reference to the relevant thread but I ain't > got the Internet at the moment. http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2005-02/msg00210.html There appears to be a fix emerging - it needs help from the MacOS and VMS crowd, but seems to fix both the chmod problem and an associated race condition. I will assume that a fix will proceed, and that by the time my app is ready, this fix will evolve so that I can use it. Keith -- Keith Lofstrom keithl@keithl.com Voice (503)-520-1993 KLIC --- Keith Lofstrom Integrated Circuits --- "Your Ideas in Silicon" Design Contracting in Bipolar and CMOS - Analog, Digital, and Scan ICs From perl-pm at joshheumann.com Fri Feb 18 15:03:38 2005 From: perl-pm at joshheumann.com (Josh Heumann) Date: Fri Feb 18 15:03:48 2005 Subject: [Pdx-pm] New O'Reilly books Message-ID: <40922.130.94.160.138.1108767818.squirrel@joshheumann.com> -------- Original Message -------- Subject: Newsletter from O'Reilly UG Program, February 18 From: Marsee Henon Date: Fri, February 18, 2005 2:41 pm ================================================================ O'Reilly News for User Group Members February 18, 2005 ================================================================ ---------------------------------------------------------------- Book News ---------------------------------------------------------------- -Head First Java, 2nd Edition -Linux Device Drivers, 3rd Edition -Surviving PC Disasters, Mishaps, and Blunders -Linux Network Administrator's Guide, 3rd Edition -Windows XP in a Nutshell, 2nd Edition ---------------------------------------------------------------- New Releases ---------------------------------------------------------------- ***Head First Java, 2nd Edition Publisher: O'Reilly ISBN: 0596009208 "Head First Java, 2nd Edition" delivers a highly interactive, multi-sensory learning experience that lets new programmers pick up the fundamentals of the Java language quickly. Through mind-stretching exercises, memorable analogies, humorous pictures, and casual language, "Head First Java" encourages readers to think like Java programmers. This revised second edition focuses on Java 5.0, the latest version of the Java development platform. http://www.oreilly.com/catalog/hfjava2/ Chapter 2, "A Trip to Objectville," and Chapter 8, "Serious Polymorphism," are available online: http://www.oreilly.com/catalog/hfjava2/chapter/index.html ***Linux Device Drivers, 3rd Edition Publisher: O'Reilly ISBN: 0596005903 Over the years, this best-selling guide has helped countless programmers learn how to support computer peripherals and how to develop new hardware under the Linux operating system. Now, with this third edition, it's even more helpful, covering all the significant changes to Version 2.6 of the Linux kernel. The guide even includes full-featured examples that programmers can compile and run without special hardware. http://www.oreilly.com/catalog/linuxdrive3/ Chapter 13, "USB Drivers," is available online: http://www.oreilly.com/catalog/linuxdrive3/chapter/index.html ***Surviving PC Disasters, Mishaps, and Blunders Publisher: Paraglyph Press ISBN: 1932111980 "Surviving PC Disasters, Mishaps, and Blunders" is the must-have survival guide for every PC user. Written in an engaging, reassuring, and fun style, it gives you the answers you need immediately to fix the thorniest PC problems. It also provides valuable insight on measures that can prevent a difficult and often expensive cure. (Who's got money to waste these days on fixing mishaps and blunders anyway?) http://www.oreilly.com/catalog/1932111980/index.html ***Linux Network Administrator's Guide, 3rd Edition Publisher: O'Reilly ISBN: 0596005482 This refreshed resource takes an in-depth look at everything you need to know to join a network. Topics covered include all of the essential networking software that comes with the Linux operating system, plus information on a host of cutting-edge services including wireless hubs, spam filtering, IPv6, OpenLDAP, and more. http://www.oreilly.com/catalog/linag3/ Chapter 18, "Wireless Networking," is available online: http://www.oreilly.com/catalog/linag3/chapter/index.html ***Windows XP in a Nutshell, 2nd Edition Publisher: O'Reilly ISBN: 0596009003 "Windows XP in a Nutshell, 2nd Edition" documents everything there is to know about the world's most widely used operating system. Updated to include information on the security technologies featured in Service Pack 2 (SP2), this must-have desktop reference is dedicated to making your time at the computer safer, easier, and more fun. It's the ultimate resource for IT professionals and Windows XP power users everywhere. http://www.oreilly.com/catalog/winxpnut2/ Chapter 8, "The Registry," is available online: http://www.oreilly.com/catalog/winxpnut2/chapter/index.html Until next time-- Marsee From raa at mailporter.net Mon Feb 21 10:29:39 2005 From: raa at mailporter.net (Roderick A. Anderson) Date: Mon Feb 21 10:32:01 2005 Subject: [Pdx-pm] SOT: Javascripting lists Message-ID: <421A2893.3060707@mailporter.net> This list has always been so great I was hoping someone might know of a Javascript ( ECMAscript ) list? I've been all over the web looking for examples and used my safari account to check out a couple of books but I can't find an answer or example of doing what I need. I can't seem to get my brain wrapped around the Javascript object/method naming for complex data/objects. Basically an array with multiple keys and an object for the data. Heck I'm not sure I could do it in raw perl ( sans-module ) so maybe some research on that will help. In the mean time any suggestions or pointers to resources are appreciated. Rod -- --- [This E-mail scanned for viruses by Declude Virus] From marvin at rectangular.com Wed Feb 23 09:24:47 2005 From: marvin at rectangular.com (Marvin Humphrey) Date: Wed Feb 23 09:25:00 2005 Subject: [Pdx-pm] each within eval Message-ID: Greets, Some reference acrobatics I'm doing seem to be causing bizarre behavior inside an eval. I have a $hashref that's ricocheted all over the innards of a large object. There are multiple copies hanging around pointing at the same anonymous hash. That might be where the problem originates, though I'm not sure why. For performance reasons, I'm constructing a tight loop using conditionals to build a scalar full of $code to be eval'd. I can iterate through the key-value pairs in the hash using each, so long as I do it inside the main body of the module: while (my ($k, $v) = each %$hashref) { print "$k => $v\n"; } But if I put that same each loop inside $code and eval it, the loop doesn't execute. each doesn't iterate, and the assignment expression returns 0. Other code works fine inside the eval, I've got strict and warnings turned on, and I'm checking $@. This works inside the eval: foreach my $k (keys %$hashref) { my $v = $hashref->{$k}; print "$k => $v\n"; } ... But that's not as efficient, and this loop may be executed millions of times. I can also unroll and reroll the hash... my %copy = %$hashref; while (my ($k, $v) = each %copy) { print "$k => $v\n"; } ... but again, that's wasteful. When I print Dumper($hashref), it looks normal. And of course, when I write a sanity check test script to perform the same function, it works as expected. It might take me quite some time to write test scripts to isolate the problem. Any ideas on where I go next to troubleshoot this? Cheers, -- Marvin Humphrey Rectangular Research http://www.rectangular.com/ ### The relevant code, snipped from the module: ### Build a routine for deriving a result set from an undetermined ### number of productions, each of which may be required, negated, or ### neither, and which must be sorted either by accumulated score or ### by date. ### TODO Is it possible to make this less tortured? my $routine_part1 = q( my $merged = { '' => undef }; while (my ($doc_num, $score_or_timestamp) = each %{ $production->{result_set} }) { ); my $routine_part2 = $self->{-sort_by} eq 'timestamp' ? q( $result_set->{$doc_num} = $score_or_timestamp;) : q( $result_set->{$doc_num} += $score_or_timestamp;); $routine_part2 .= q( }); if (%$neglist) { $routine_part1 .= q( next if exists $neglist->{$doc_num};); } if (%$reqlist) { $routine_part1 .= q( next unless exists $reqlist->{$doc_num};); } if (%$reqlist and $production->{required}) { $routine_part1 .= q( $merged->{$doc_num} = undef;); $routine_part2 .= q( foreach (keys %$result_set) { delete $result_set->{$_} unless exists $merged->{$_}; } $reqlist = $merged; $merged = { '' => undef };); } elsif ($production->{required}) { $routine_part2 .= q( $reqlist = $production->{result_set}; ### Make %$reqlist evaluate to true, even if it contains no ### docs -- because if you require a term, and it doesn't exist ### in any documents, your query shouldn't return anything. $reqlist->{''} = undef;); } eval "$routine_part1 $routine_part2"; die $@ if $@; From david at kineticode.com Wed Feb 23 10:24:29 2005 From: david at kineticode.com (David Wheeler) Date: Wed Feb 23 10:24:41 2005 Subject: [Pdx-pm] each within eval In-Reply-To: References: Message-ID: <22e5315cf1d04701fdff3c9fcb825c4e@kineticode.com> On Feb 23, 2005, at 9:24 AM, Marvin Humphrey wrote: > while (my ($k, $v) = each %$hashref) { > print "$k => $v\n"; > } > > But if I put that same each loop inside $code and eval it, the loop > doesn't execute. each doesn't iterate, and the assignment expression > returns 0. Other code works fine inside the eval, I've got strict and > warnings turned on, and I'm checking $@. > > This works inside the eval: > > foreach my $k (keys %$hashref) { > my $v = $hashref->{$k}; > print "$k => $v\n"; > } That's because %$hashref is unrolled into the string, but each doesn't do that (it's an iterator). What you want is a reference to the hash in your eval. Use single quotes so that $hashref doesn't evaluate into the string, but in the eval. This works for me: my $hashref = { foo => 1, bar => 2, }; my $to_eval = q{ while (my ($k, $v) = each %$hashref) { print "$k => $v\n"; } }; eval $to_eval; Regards, David From nick2canz at yahoo.com Thu Feb 24 00:20:13 2005 From: nick2canz at yahoo.com (Nick Wehr) Date: Thu Feb 24 00:20:21 2005 Subject: [Pdx-pm] Debugging Inline C programs... Message-ID: <20050224082013.82595.qmail@web50908.mail.yahoo.com> hello everyone, I've been looking all over the man pages for some information on debugging C code from within Inline. I've been using if (DEBUG) lines all over tracking down my problem code... is there an easier way to do this? Can I [cross fingers] somehow use a debugger? If not, what have you guys done to make this task less painful. thanks __________________________________ Do you Yahoo!? Yahoo! Mail - Easier than ever with enhanced search. Learn more. http://info.mail.yahoo.com/mail_250 From ewilhelm at sbcglobal.net Thu Feb 24 07:27:48 2005 From: ewilhelm at sbcglobal.net (Eric Wilhelm) Date: Thu Feb 24 07:22:41 2005 Subject: [Pdx-pm] Debugging Inline C programs... In-Reply-To: <20050224082013.82595.qmail@web50908.mail.yahoo.com> References: <20050224082013.82595.qmail@web50908.mail.yahoo.com> Message-ID: <200502240927.48341.ewilhelm@sbcglobal.net> # The following was supposedly scribed by # Nick Wehr # on Thursday 24 February 2005 02:20 am: Sorry to leave you hanging on the inline-perl list. >I've been looking all over the man pages for some information on > debugging C code from within Inline. ?I've been using if (DEBUG) > lines all over tracking down my problem code... ?is there an easier > way to do this? To be portable: ------------------------ /*#define DEBUG_PRINT*/ #ifdef DEBUG_PRINT #define dbg_p(x) printf x #else #define dbg_p(x) #endif ... free(p); dbg_p(("p free... DESTROY complete\n")); ... ------------------------ > Can I [cross fingers] somehow use a debugger? ?If > not, what have you guys done to make this task less painful. Hmm. How do you use a debugger on XS code? If you know that, you're halfway there. Then you just have to get Inline to not CLEAN_AFTER_BUILD. As far as automagic c-level debugging support from within Inline, I don't think there's anything (though perldoc Inline::C makes some reference to an OPTIMIZE => '-g' setting for use with gdb.) --Eric -- "Matter will be damaged in direct proportion to its value." -- Murphy's Constant --------------------------------------------- http://scratchcomputing.com --------------------------------------------- From schwern at pobox.com Thu Feb 24 23:41:22 2005 From: schwern at pobox.com (Michael G Schwern) Date: Thu Feb 24 23:41:27 2005 Subject: [Pdx-pm] I have returned to claim the pyramids. Message-ID: <20050225074122.GA19654@windhund.schwern.org> I'm back in Portland. Hurrah! You guys have been hogging all the good weather. From chromatic at wgz.org Fri Feb 25 10:55:45 2005 From: chromatic at wgz.org (chromatic) Date: Fri Feb 25 10:56:23 2005 Subject: [Pdx-pm] I have returned to claim the pyramids. In-Reply-To: <20050225074122.GA19654@windhund.schwern.org> References: <20050225074122.GA19654@windhund.schwern.org> Message-ID: <1109357745.17002.2.camel@localhost> On Thu, 2005-02-24 at 23:41 -0800, Michael G Schwern wrote: > I'm back in Portland. Hurrah! You guys have been hogging all the good > weather. It was nice here *yesterday*. -- c From ben.prew at gmail.com Fri Feb 25 10:59:50 2005 From: ben.prew at gmail.com (Ben Prew) Date: Fri Feb 25 10:59:59 2005 Subject: [Pdx-pm] I have returned to claim the pyramids. In-Reply-To: <20050225074122.GA19654@windhund.schwern.org> References: <20050225074122.GA19654@windhund.schwern.org> Message-ID: <24f4b2e805022510593785ca1e@mail.gmail.com> Welcome back, lets just hope you didn't bring any of the bad weather with you.... On Thu, 24 Feb 2005 23:41:22 -0800, Michael G Schwern wrote: > I'm back in Portland. Hurrah! You guys have been hogging all the good > weather. > > _______________________________________________ > Pdx-pm-list mailing list > Pdx-pm-list@pm.org > http://mail.pm.org/mailman/listinfo/pdx-pm-list > -- Ben Prew ben.prew@gmail.com From schwern at pobox.com Fri Feb 25 14:34:36 2005 From: schwern at pobox.com (Michael G Schwern) Date: Fri Feb 25 14:34:41 2005 Subject: [Pdx-pm] I have returned to claim the pyramids. In-Reply-To: <24f4b2e805022510593785ca1e@mail.gmail.com> References: <20050225074122.GA19654@windhund.schwern.org> <24f4b2e805022510593785ca1e@mail.gmail.com> Message-ID: <20050225223436.GD23038@windhund.schwern.org> On Fri, Feb 25, 2005 at 10:59:50AM -0800, Ben Prew wrote: > Welcome back, lets just hope you didn't bring any of the bad weather > with you.... Airport security confiscated it. From perl-pm at joshheumann.com Fri Feb 25 14:40:01 2005 From: perl-pm at joshheumann.com (Josh Heumann) Date: Fri Feb 25 14:40:09 2005 Subject: [Pdx-pm] is_deeply and objects Message-ID: <57121.130.94.160.138.1109371201.squirrel@joshheumann.com> Test::More::is_deeply doesn't seem to differentiate between hashes and blessed hashes. Anyone know why? A quickly-thrown-together example: my %hash = ( foo => 1, bar => 2, baz => 3, ); my %other_hash = %hash; bless \%hash, 'FOO'; is_deeply( \%hash, \%other_hash ); #passes This question is posed in honor of Schwern's arrival. Schwern: who loves ya, baby? Josh From schwern at pobox.com Fri Feb 25 15:06:18 2005 From: schwern at pobox.com (Michael G Schwern) Date: Fri Feb 25 15:06:30 2005 Subject: [Pdx-pm] is_deeply and objects In-Reply-To: <57121.130.94.160.138.1109371201.squirrel@joshheumann.com> References: <57121.130.94.160.138.1109371201.squirrel@joshheumann.com> Message-ID: <20050225230617.GA23341@windhund.schwern.org> On Fri, Feb 25, 2005 at 02:40:01PM -0800, Josh Heumann wrote: > Test::More::is_deeply doesn't seem to differentiate between hashes and > blessed hashes. Anyone know why? Because then it would be harder to do this: is_deeply( $some_object, { foo => 42, bar => 23 } ); Also, what about this? package Foo; sub new { return bless { foo => 42 } } package Bar; @ISA = qw(Foo); package main; use Test::More tests => 1; my $foo = Foo->new; my $bar = Bar->new; is_deeply( $foo, $bar ); If is_deeply were object-aware should that pass or fail? Maybe, maybe not. So I decided to simply ignore the whole problem. For similar reasons is_deeply() honors overloading. If you hand it a string overloaded object it'll compare it as that string. In the end, is_deeply() can have only one behavior and is one-size-fits-most. For more flexibility use Test::Deep. > This question is posed in honor of Schwern's arrival. Schwern: who loves > ya, baby? According to my spam folder, Jeanna11111 is hot and waiting for me right now. From perl-pm at joshheumann.com Fri Feb 25 15:48:56 2005 From: perl-pm at joshheumann.com (Josh Heumann) Date: Fri Feb 25 15:49:04 2005 Subject: [Pdx-pm] is_deeply and objects In-Reply-To: <20050225230617.GA23341@windhund.schwern.org> References: <57121.130.94.160.138.1109371201.squirrel@joshheumann.com> <20050225230617.GA23341@windhund.schwern.org> Message-ID: <57312.130.94.160.138.1109375336.squirrel@joshheumann.com> > Also, what about this? > > package Foo; > sub new { return bless { foo => 42 } } > > package Bar; > @ISA = qw(Foo); > > package main; > use Test::More tests => 1; > > my $foo = Foo->new; > my $bar = Bar->new; > > is_deeply( $foo, $bar ); > > If is_deeply were object-aware should that pass or fail? Maybe, maybe > not. Advocating devilishly, what are the arguments for it failing? If there are two objects, blessed with the same class and containing the same data, are they really different? >> This question is posed in honor of Schwern's arrival. Schwern: who >> loves ya, baby? > > According to my spam folder, Jeanna11111 is hot and waiting for me right > now. Lucky you. And the other 42,000 people. Josh From andy at petdance.com Fri Feb 25 15:52:58 2005 From: andy at petdance.com (Andy Lester) Date: Fri Feb 25 15:53:09 2005 Subject: [Pdx-pm] is_deeply and objects In-Reply-To: <57121.130.94.160.138.1109371201.squirrel@joshheumann.com> References: <57121.130.94.160.138.1109371201.squirrel@joshheumann.com> Message-ID: <20050225235258.GA15542@petdance.com> On Fri, Feb 25, 2005 at 02:40:01PM -0800, Josh Heumann (perl-pm@joshheumann.com) wrote: > Test::More::is_deeply doesn't seem to differentiate between hashes and > blessed hashes. Anyone know why? Because it's not part of the design, probably. I wouldn't expect is_deeply() to check the type. -- Andy Lester => andy@petdance.com => www.petdance.com => AIM:petdance From wcooley at nakedape.cc Fri Feb 25 15:54:48 2005 From: wcooley at nakedape.cc (Wil Cooley) Date: Fri Feb 25 15:55:04 2005 Subject: [Pdx-pm] is_deeply and objects In-Reply-To: <57312.130.94.160.138.1109375336.squirrel@joshheumann.com> References: <57121.130.94.160.138.1109371201.squirrel@joshheumann.com> <20050225230617.GA23341@windhund.schwern.org> <57312.130.94.160.138.1109375336.squirrel@joshheumann.com> Message-ID: <20050225235448.GH2539@rheingold.nakedape.priv> Also Sprach Josh Heumann on Fri, Feb 25, 2005 at 03:48:56PM PST: > > Advocating devilishly, what are the arguments for it failing? If there > are two objects, blessed with the same class and containing the same data, > are they really different? Except they aren't the same class--one is a subclass of the other. Sure, in this case they're pretty much the same, but how different do they need to be? Wil -- Wil Cooley wcooley@nakedape.cc Naked Ape Consulting http://nakedape.cc * * * * Linux, UNIX, Networking and Security Solutions * * * * -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://mail.pm.org/pipermail/pdx-pm-list/attachments/20050225/cd8c0f2a/attachment.bin From publiustemp-pdxpm at yahoo.com Fri Feb 25 15:58:42 2005 From: publiustemp-pdxpm at yahoo.com (Ovid) Date: Fri Feb 25 15:58:56 2005 Subject: [Pdx-pm] is_deeply and objects In-Reply-To: <57312.130.94.160.138.1109375336.squirrel@joshheumann.com> Message-ID: <20050225235847.78336.qmail@web60810.mail.yahoo.com> --- Josh Heumann wrote: > Advocating devilishly, what are the arguments for it failing? If > there > are two objects, blessed with the same class and containing the same > data, > are they really different? Schwern's objects were not blessed into the same class. One was a subclass of the other. Whether or not your application should consider Foo->new or Bar->new to be the same things depends upon the particular needs of the application. To have is_deeply() automatically say that different classes are the same, regardless of whether or not they're in the same inheritance heirarchy would be deeply flawed. Cheers, Ovid ===== If this message is a response to a question on a mailing list, please send follow up questions to the list. Web Programming with Perl -- http://users.easystreet.com/ovid/cgi_course/ From schwern at pobox.com Fri Feb 25 16:00:59 2005 From: schwern at pobox.com (Michael G Schwern) Date: Fri Feb 25 16:01:07 2005 Subject: [Pdx-pm] is_deeply and objects In-Reply-To: <57311.130.94.160.138.1109375330.squirrel@joshheumann.com> References: <57121.130.94.160.138.1109371201.squirrel@joshheumann.com> <20050225230617.GA23341@windhund.schwern.org> <57311.130.94.160.138.1109375330.squirrel@joshheumann.com> Message-ID: <20050226000059.GA1989@windhund.schwern.org> On Fri, Feb 25, 2005 at 03:48:50PM -0800, Josh Heumann wrote: > > > Also, what about this? > > > > package Foo; > > sub new { return bless { foo => 42 } } > > > > package Bar; > > @ISA = qw(Foo); > > > > package main; > > use Test::More tests => 1; > > > > my $foo = Foo->new; > > my $bar = Bar->new; > > > > is_deeply( $foo, $bar ); > > > > If is_deeply were object-aware should that pass or fail? Maybe, maybe > > not. > > Advocating devilishly, what are the arguments for it failing? If there > are two objects, blessed with the same class and containing the same data, > are they really different? They're not the same class. Or rather they weren't supposed to be. I wrote the constructor hastily. It should have been: sub new { my $class = shift; return bless { foo => 42 }, $class; } So its two objects with the same internal structure where one inherits from the other's class. Should they be considered equal? I can come up with arguments both ways: Yes, they should be since Bar inherits from Foo it should have the same behaviors. In theory I should be able to replace $foo with $bar in the program and have it continue to work. The blackbox is preserved. No, if we're looking at the internal structure of an object we're into glassbox testing and thus want exact internal equality. So I just punt the whole issue over in Fergal's direction. Test::Deep allows you to customize the comparison to do whatever you like. Now for the real reason is_deeply() doesn't acknowledge objects or pierce overloading: I didn't think of it when I wrote it and it was simplier to do without. All of the above is retrograde reasoning for why it works the way it does. Fortunately it comes out pretty sensible in the end. > >> This question is posed in honor of Schwern's arrival. Schwern: who > >> loves ya, baby? > > > > According to my spam folder, Jeanna11111 is hot and waiting for me right > > now. > > Lucky you. And the other 42,000 people. That dirty ho... as advertised. From schwern at pobox.com Fri Feb 25 16:02:32 2005 From: schwern at pobox.com (Michael G Schwern) Date: Fri Feb 25 16:02:40 2005 Subject: [Pdx-pm] is_deeply and objects In-Reply-To: <20050225235258.GA15542@petdance.com> References: <57121.130.94.160.138.1109371201.squirrel@joshheumann.com> <20050225235258.GA15542@petdance.com> Message-ID: <20050226000232.GB1989@windhund.schwern.org> On Fri, Feb 25, 2005 at 05:52:58PM -0600, Andy Lester wrote: > On Fri, Feb 25, 2005 at 02:40:01PM -0800, Josh Heumann (perl-pm@joshheumann.com) wrote: > > Test::More::is_deeply doesn't seem to differentiate between hashes and > > blessed hashes. Anyone know why? > > Because it's not part of the design, probably. I wouldn't expect > is_deeply() to check the type. That's a bit circular. "It doesn't work that way because it wasn't designed that way." Ok, why wasn't it designed that way? Back to square one. From andy at petdance.com Fri Feb 25 16:06:34 2005 From: andy at petdance.com (Andy Lester) Date: Fri Feb 25 16:06:43 2005 Subject: [Pdx-pm] is_deeply and objects In-Reply-To: <20050226000232.GB1989@windhund.schwern.org> References: <57121.130.94.160.138.1109371201.squirrel@joshheumann.com> <20050225235258.GA15542@petdance.com> <20050226000232.GB1989@windhund.schwern.org> Message-ID: <20050226000634.GB15542@petdance.com> On Fri, Feb 25, 2005 at 04:02:32PM -0800, Michael G Schwern (schwern@pobox.com) wrote: > > Because it's not part of the design, probably. I wouldn't expect > > is_deeply() to check the type. Elaborating: The name "is_deeply()" to me doesn't imply that it checks the type, too. -- Andy Lester => andy@petdance.com => www.petdance.com => AIM:petdance From ewilhelm at sbcglobal.net Mon Feb 28 22:03:34 2005 From: ewilhelm at sbcglobal.net (Eric Wilhelm) Date: Mon Feb 28 21:59:04 2005 Subject: [Pdx-pm] sanity check: how to use system() Message-ID: <200503010003.34878.ewilhelm@sbcglobal.net> What's the deal with this bit of code: unless(system(join ' ', @command) == 0) ... ?! I've been digging through a lot of backup programs this week and have been driven at-least-insane by the number of times that I've seen something like $cmd .= $options; system($cmd). Particularly, this one makes me really have to hope that $dir and $count are never both equal to "/" system("$rm -rf $dir.$count") I've checked "perldoc -f system | head -1" several times today and it still says: system LIST And further down, there's lots of yummy detail about how calling it with a single scalar fires-up a shell and hands-off the command rather than the more efficient and less-subject-to-interpolation direct hand-off to execvp(). So, I'm evaluating these programs that are going to be run as root and keep having to wonder if they've caught all of the corner cases of special characters, spaces in filenames, and other such things. Then, I come across the above needless join of a perfectly LISTlike @command and I think I surely must have lost it. Is there a historical reason or something here that I'm missing? Thanks, Eric -- Rule out stupidity, then look for the simplest explanation. -- Eric's Cleaver --------------------------------------------- http://scratchcomputing.com --------------------------------------------- From tex at off.org Mon Feb 28 22:16:54 2005 From: tex at off.org (Austin Schutz) Date: Mon Feb 28 22:17:02 2005 Subject: [Pdx-pm] sanity check: how to use system() In-Reply-To: <200503010003.34878.ewilhelm@sbcglobal.net> References: <200503010003.34878.ewilhelm@sbcglobal.net> Message-ID: <20050301061654.GH5597@gblx.net> On Tue, Mar 01, 2005 at 12:03:34AM -0600, Eric Wilhelm wrote: > What's the deal with this bit of code: > > unless(system(join ' ', @command) == 0) ... > > ?! > > I've been digging through a lot of backup programs this week and have > been driven at-least-insane by the number of times that I've seen > something like $cmd .= $options; system($cmd). Particularly, this one > makes me really have to hope that $dir and $count are never both equal > to "/" > > system("$rm -rf $dir.$count") > > I've checked "perldoc -f system | head -1" several times today and it > still says: > > system LIST > > And further down, there's lots of yummy detail about how calling it with > a single scalar fires-up a shell and hands-off the command rather than > the more efficient and less-subject-to-interpolation direct hand-off to > execvp(). So, I'm evaluating these programs that are going to be run > as root and keep having to wonder if they've caught all of the corner > cases of special characters, spaces in filenames, and other such > things. > > Then, I come across the above needless join of a perfectly LISTlike > @command and I think I surely must have lost it. Is there a historical > reason or something here that I'm missing? > It is often useful to have the shell do interpolation, such as system("rm $args") you can pass '-rf mydirectory', which will recursively remove 'mydirectory', versus thinking the entire '-rf mydirectory' string is an option. Often in modules it's easier to just pass it to the shell and let it sort it out rather than assuming that your users will think to use it the other way. Also it's often assumed a variable is ok as passed - you get plenty of rope. As you say, there is a performance penalty for execing the shell (though not usually very muh of a penalty). In some cases that penalty matters a bit. Most of us probably run code in places where we aren't so concerned with the local users being malicious. when in doubt run your script with -T if you are enabling other users to run root stuff, then sanitize everything perl gripes about, then if you are feeling brave, turn -T back off. Austin From ewilhelm at sbcglobal.net Mon Feb 28 22:52:11 2005 From: ewilhelm at sbcglobal.net (Eric Wilhelm) Date: Mon Feb 28 22:47:37 2005 Subject: [Pdx-pm] sanity check: how to use system() In-Reply-To: <20050301061654.GH5597@gblx.net> References: <200503010003.34878.ewilhelm@sbcglobal.net> <20050301061654.GH5597@gblx.net> Message-ID: <200503010052.11328.ewilhelm@sbcglobal.net> # The following was supposedly scribed by # Austin Schutz # on Tuesday 01 March 2005 12:16 am: >Often in modules it's easier to just pass it to the shell and let >it sort it out rather than assuming that your users will think to use > it the other way. That works until you have a filename with a space in it. Sure, you can quote it and escape it, but why? And in the context of backup systems, you are going to be reading from config files and dealing with users that don't know perl, etc. >????????Most of us probably run code in places where we aren't so > concerned with the local users being malicious. This isn't about maliciousness so much as code leaving corner-cases completely unconsidered. Even if you're just making a wrapper for another command, you should call exec() with a list context just in case your wife is a writer. command_wrapper "./-rf my wife's funny file name(s)" --Eric -- "Cleanliness is next to impossible." -- Unknown --------------------------------------------- http://scratchcomputing.com --------------------------------------------- From tex at off.org Mon Feb 28 22:56:07 2005 From: tex at off.org (Austin Schutz) Date: Mon Feb 28 22:56:15 2005 Subject: [Pdx-pm] sanity check: how to use system() In-Reply-To: <200503010052.11328.ewilhelm@sbcglobal.net> References: <200503010003.34878.ewilhelm@sbcglobal.net> <20050301061654.GH5597@gblx.net> <200503010052.11328.ewilhelm@sbcglobal.net> Message-ID: <20050301065607.GJ5597@gblx.net> On Tue, Mar 01, 2005 at 12:52:11AM -0600, Eric Wilhelm wrote: > # The following was supposedly scribed by > # Austin Schutz > # on Tuesday 01 March 2005 12:16 am: > > >Often in modules it's easier to just pass it to the shell and let > >it sort it out rather than assuming that your users will think to use > > it the other way. > > That works until you have a filename with a space in it. Sure, you can > quote it and escape it, but why? And in the context of backup systems, > you are going to be reading from config files and dealing with users > that don't know perl, etc. Yes, in the context of backup systems it doesn't make sense. `find . | cpio -i` works pretty well too - until you hit a filename with a newline. > > >????????Most of us probably run code in places where we aren't so > > concerned with the local users being malicious. > > This isn't about maliciousness so much as code leaving corner-cases > completely unconsidered. Even if you're just making a wrapper for > another command, you should call exec() with a list context just in > case your wife is a writer. > I have my office boobytrapped with computer parts. She's smart enough to stay out and use her own computer. :-) Austin