From masque at pobox.com Tue Jul 23 18:45:25 2002 From: masque at pobox.com (Masque) Date: Mon Aug 2 21:34:11 2004 Subject: [Pdx-pm-list] Re: Mailing list etiquette In-Reply-To: <02cf01c23277$a2dcedc0$1a01a8c0@ot.onsitetech.com> Message-ID: <426CDD2C-9E96-11D6-933D-000393450866@pobox.com> Personally, I think it's best to boil it down to this and this alone: Reasonable person principle applies. Now, this assumes that most people on the list are reasonable people! I think that's true in this case. Any of you who disagree can BITE ME. Er, wait a minute.... The community is capable of policing itself. If people think a behavior should stop, they can stop it. The role of the list owner should be an administrative one and he should not be required or expected to enforce things. If the list decides something, let it be, but otherwise it's best to let things go. If the community tolerates a behavior there can be no stopping it. If the community is intolerant of a behavior there will be no starting it. It really can be that simple. My -personal- vote: Play nice, kids. :) Masque. From masque at pobox.com Tue Jul 23 20:20:35 2002 From: masque at pobox.com (Masque) Date: Mon Aug 2 21:34:11 2004 Subject: [Pdx-pm-list] <- This new header sucks. Message-ID: <8E064623-9EA3-11D6-933D-000393450866@pobox.com> It's too large. If we _MUST_ have a header - which is not a true condition - let's make it shorter. I vote for no header at all. Masque. From jeff at vpservices.com Tue Jul 23 21:06:12 2002 From: jeff at vpservices.com (Jeff Zucker) Date: Mon Aug 2 21:34:11 2004 Subject: [Pdx-pm-list] <- This new header sucks. References: <8E064623-9EA3-11D6-933D-000393450866@pobox.com> Message-ID: <3D3E0B94.5070600@vpservices.com> Masque wrote: > It's too large. If we _MUST_ have a header - which is not a true > condition - let's make it shorter. I vote for no header at all. I prefer something I can visually sort on, [Pdx-pm] works for me. -- Jeff From merlyn at stonehenge.com Tue Jul 23 21:28:35 2002 From: merlyn at stonehenge.com (Randal L. Schwartz) Date: Mon Aug 2 21:34:11 2004 Subject: [Pdx-pm-list] Re: STOP: Re: Mail list fishing In-Reply-To: <20020723123237.C4503@gblx.net> References: <6B1CD982-9E60-11D6-9BD9-000393450866@pobox.com> <20020723123237.C4503@gblx.net> Message-ID: <86sn29zwoc.fsf@blue.stonehenge.com> >>>>> "Austin" == Austin Schutz writes: Austin> Perl's community has a very strong reputation for Austin> being severely abrasive. That has been true in my own Austin> experience, and doesn't seem to be true of other communities, Austin> e.g. Python. No other community has had to put up with 'the web' bringing in thousands of people who think that HTML is programming, so Perl is only slightly harder than that. I'm not saying that excuses the Perl community. Just giving you what is generally agreed to be the main cause. -- 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 gabrielle.roth at xo.com Wed Jul 24 10:43:55 2002 From: gabrielle.roth at xo.com (Roth, Gabrielle) Date: Mon Aug 2 21:34:11 2004 Subject: [Pdx-pm-list] <- This new header sucks. Message-ID: <45EDA71CFF25D411A2E400508B6FC52A04618FBB@orportexch1.internal.nextlink.net> > -----Original Message----- > From: Jeff Zucker [mailto:jeff@vpservices.com] > Sent: Tuesday, July 23, 2002 7:06 PM > To: pdx-pm-list@pm.org > Subject: Re: [Pdx-pm-list] <- This new header sucks. > I prefer something I can visually sort on, [Pdx-pm] works for me. me too I like having a header for the list, so I can tell at a glance it's something I want to read. -gabrielle "It's been lovely, but I must scream now." From jasona at inetarena.com Wed Jul 24 16:25:20 2002 From: jasona at inetarena.com (Jason White) Date: Mon Aug 2 21:34:11 2004 Subject: [Pdx-pm-list] <- This new header sucks. References: <45EDA71CFF25D411A2E400508B6FC52A04618FBB@orportexch1.internal.nextlink.net> Message-ID: <005e01c23358$9d910220$5b86fc83@archer> I find the subject header useful. I generally filter this list by TO || CC containing, however, there are times when my filtering rules are not intact and it is nice to be able to sort mail visually. TIMTOWTDI; Lets think outside the box and set a precedent here. Make a subject footer. The subject will remain un-blurred, so those of us who are already filtered wont have to visually s/[Pdx-pm-list]// and yet it will still be obvious if you are looking for it. I also think the "-list" portion is implicit, so [Pdx-pm] is sufficient. I cast my unsolicited vote for $subject .=" [Pdx-pm]"; Argh, this of course, will format funny in the inbox..... $$$$$$$$$$$$$[Pdx-pm] Re: $$$$$$$$$$$$$[Pdx-pm] #####[Pdx-pm] @#@@@@@@@@#@#[Pdx-pm] instead of...... [Pdx-pm]$$$$$$$$$$$$$ Re: [Pdx-pm]$$$$$$$$$$$$$ [Pdx-pm]##### [Pdx-pm]@#@@@@@@@@#@# At first, I thought it would make me dizzy, but looking at it, its not so bad. Not like it would be hard for any of us to actually format the subject line so all the footers lined up nicely on the end..... Nevermind, this would be futile, even plain-text has some .TTF qualaties under Windows. Jason White ----- Original Message ----- From: "Roth, Gabrielle" To: Sent: Wednesday, July 24, 2002 8:43 AM Subject: RE: [Pdx-pm-list] <- This new header sucks. > > -----Original Message----- > > From: Jeff Zucker [mailto:jeff@vpservices.com] > > Sent: Tuesday, July 23, 2002 7:06 PM > > To: pdx-pm-list@pm.org > > Subject: Re: [Pdx-pm-list] <- This new header sucks. > > > I prefer something I can visually sort on, [Pdx-pm] works for me. > > me too > > I like having a header for the list, so I can tell at a glance it's > something I want to read. > > -gabrielle > "It's been lovely, but I must scream now." > _______________________________________________ > Pdx-pm-list mailing list > Pdx-pm-list@mail.pm.org > http://mail.pm.org/mailman/listinfo/pdx-pm-list > From mikeraz at PATCH.COM Wed Jul 24 17:52:18 2002 From: mikeraz at PATCH.COM (mikeraz@PATCH.COM) Date: Mon Aug 2 21:34:11 2004 Subject: [Pdx-pm-list] <- This new header sucks. In-Reply-To: <005e01c23358$9d910220$5b86fc83@archer>; from jasona@inetarena.com on Wed, Jul 24, 2002 at 02:25:20PM -0700 References: <45EDA71CFF25D411A2E400508B6FC52A04618FBB@orportexch1.internal.nextlink.net> <005e01c23358$9d910220$5b86fc83@archer> Message-ID: <20020724155218.A24492@patch.com> On Wed, Jul 24, 2002 at 02:25:20PM -0700, Jason White typed: > I find the subject header useful. I generally filter this list by TO || CC > ... > [Pdx-pm] is sufficient. I cast my unsolicited vote for $subject .=" > [Pdx-pm]"; The mailing list is now on Mailman, which is written in the other P language, Python. The subject [Pdx-pm-list] prefix is a default based on the list name. While the list manager can change this to an arbitrary string ([PDX-Perl-rants] anyone?) there is not a choice between prefix and postfix for the string. Unless someone with Python skills wants to path Mailman. ?? -- Michael Rasmussen aka mikeraz Be appropriate && Follow your curiosity http://www.patch.com/ http://wiki.patch.com/ http://blog.patch.com/sandbox/ "They that give up essential liberty to obtain temporary safety, deserve neither liberty nor safety." -- Benjamin Franklin and the fortune cookie says: Always try to do things in chronological order; it's less confusing that way. From tkil at scrye.com Wed Jul 24 18:19:43 2002 From: tkil at scrye.com (Tkil) Date: Mon Aug 2 21:34:11 2004 Subject: [Pdx-pm] Re: [Pdx-pm-list] <- This new header sucks. In-Reply-To: <005e01c23358$9d910220$5b86fc83@archer> References: <45EDA71CFF25D411A2E400508B6FC52A04618FBB@orportexch1.internal.nextlink.net> <005e01c23358$9d910220$5b86fc83@archer> Message-ID: >>>>> "Jason" == Jason White writes: Jason> I generally filter this list by TO || CC containing, Note that MailMan adds a "List-Id" header: List-Id: Which makes filtering trivial. Jason> however, there are times when my filtering rules are not intact Jason> and it is nice to be able to sort mail visually. Fair enough. As it was, my old procmail recipie didn't catch the new address, so I had to look in my spam bucket for a few of the messages. Not a pretty sight. Me personally, I don't care all that much. Completely undecorated subject lines look the best to me, since I get the context by where I'm reading it. But I know that not everyone does that, so... Heh. On top of it all, I think that Jason and I managed to double the amount of mail I've ever gotten off this list, so... :) t. From cp at onsitetech.com Wed Jul 24 18:54:28 2002 From: cp at onsitetech.com (Curtis Poe) Date: Mon Aug 2 21:34:11 2004 Subject: [Pdx-pm] New header References: <45EDA71CFF25D411A2E400508B6FC52A04618FBB@orportexch1.internal.nextlink.net> <005e01c23358$9d910220$5b86fc83@archer> <20020724155218.A24492@patch.com> Message-ID: <00ed01c2336d$73845760$1a01a8c0@ot.onsitetech.com> ----- Original Message ----- From: To: "Jason White" Cc: Sent: Wednesday, July 24, 2002 3:52 PM Subject: Re: [Pdx-pm-list] <- This new header sucks. > On Wed, Jul 24, 2002 at 02:25:20PM -0700, Jason White typed: > > I find the subject header useful. I generally filter this list by TO || CC > > ... > > [Pdx-pm] is sufficient. I cast my unsolicited vote for $subject .=" > > [Pdx-pm]"; > > The mailing list is now on Mailman, which is written in the other P language, > Python. The subject [Pdx-pm-list] prefix is a default based on the list name. > While the list manager can change this to an arbitrary string ([PDX-Perl-rants] > anyone?) there is not a choice between prefix and postfix for the string. > > Unless someone with Python skills wants to path Mailman. ?? I went ahead and changed the subject line prefix to [Pdx-pm], so I was surprised that the last email that I received did not have the correct prefix. Of course, since it was a Re: line, perhaps mailman is smart enough to not munge the subject line. I'm sending this with a new subject to see if, in fact, my change to the subject line prefix has worked. -- Cheers, Curtis Poe Senior Programmer ONSITE! Technology, Inc. www.onsitetech.com 503-233-1418 Taking e-Business and Internet Technology To The Extreme! From jasona at inetarena.com Wed Jul 24 18:53:39 2002 From: jasona at inetarena.com (Jason White) Date: Mon Aug 2 21:34:11 2004 Subject: [Pdx-pm] Re: [Pdx-pm-list] <- This new header sucks. References: <45EDA71CFF25D411A2E400508B6FC52A04618FBB@orportexch1.internal.nextlink.net> <005e01c23358$9d910220$5b86fc83@archer> <20020724155218.A24492@patch.com> Message-ID: <00aa01c2336d$55eca860$5b86fc83@archer> The perl mongers list server runs on python...................................................................... ...... From jasona at inetarena.com Wed Jul 24 19:33:27 2002 From: jasona at inetarena.com (Jason White) Date: Mon Aug 2 21:34:11 2004 Subject: [Pdx-pm] Appologies Message-ID: <012301c23372$e536d720$5b86fc83@archer> Many things in life are a matter of perspective. Mine changed significantly when I read an email regarding the function of this list. I subscribed to this list at least two years ago, maybe more, after writing my first few perl scripts (Like making command line amp play random mp3s continuously and a fairly complex auto-player for an online game). I signed up so that I could monitor threads and pick up some useful pointers over time without having to wait until I had a problem to drop in and expect answers. I picked this list because it was the first local perl user list that I found. Perl Mongers doesn't detail their charter and I assumed this was a good place to ask newbie kinds of questions if I needed someplace to ask them. After reading in more detail about what happens at PM meetings and reading an email about this being more of a meeting and agenda list, I realize that I have been thinking of this list incorrectly. I realize now that the sometimes months of no threads and the only help related ones usually being quite complex, are because this is not a help desk. I appologise for the pieces of my complaints that were centered around the quality of help recieved. Additionally, I appologise to Tkil, the metaphor war was uncalled for(try saying that 3 times fast!) and I didn't mean you explicitly, I meant the general response. It was gracious for you to write so thorough an example after I was unpleasent to you. (And just so you know, many people came to your defense out of list) For the record, I have read the core O'reilly books and keep them around for reference, however, I don't use perl every day and sometimes things get fuzzy. Sometimes it is difficult to find information that you guys take for granted. For example, when I didn't know what qw() was. Try finding it documented in an O'reilly book, used extensivly, not documented. (I didn't ask questions like that here, I found them on my own). I just recently learned of perldoc and perlfunc. To my recollection, they aren't listed in any of the books I've read, or suggested on any of the sites I've been to. What I would like to know is where I can find a table of the subjects available via perldoc. `perldoc perltoot` is not intuative and I think its strange when people ask why I haven't looked there, What I would like to know is How do I know its there? Where do I learn that if I want to know about OOP, I want perltoot, not perloop or ooperl? Jason White -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/pdx-pm-list/attachments/20020724/064910d1/attachment.htm From plumpy at krimedawg.org Wed Jul 24 20:38:18 2002 From: plumpy at krimedawg.org (Michael P) Date: Mon Aug 2 21:34:11 2004 Subject: [Pdx-pm] Appologies In-Reply-To: <012301c23372$e536d720$5b86fc83@archer> Message-ID: On Wed, 24 Jul 2002, Jason White wrote: > For example, when I didn't know what qw() was. Try finding it > documented in an O'reilly book, used extensivly, not documented. It is documented, but not where you'd think. The trick is that qw (like q and qq) aren't functions; they just look that way. But you can just as easily use qw[foo barf] or q%foo barf% or even qw;foo barf; (they work like m// and s/// in that respect). Anyway, it's in the Camel at 2.6.4 and 2.8. (and the index!) > What I would like to know is where I can find a table of the subjects > available via perldoc. perldoc perl Another helpful trick you might not know is 'perldoc -f function' to look up a specific function. For example 'perldoc -f split' gives you split's usage. From tkil at scrye.com Wed Jul 24 23:50:45 2002 From: tkil at scrye.com (Tkil) Date: Mon Aug 2 21:34:11 2004 Subject: [Pdx-pm] Appologies In-Reply-To: <012301c23372$e536d720$5b86fc83@archer> References: <012301c23372$e536d720$5b86fc83@archer> Message-ID: >>>>> "Jason" == Jason White writes: Jason> this [list] is not a help desk.? I appologise for the pieces of Jason> my complaints that were centered around the quality of help Jason> recieved. For whatever it's worth, I don't mind seeing help requests come across the smaller local lists. These lists are less intimidating than the big worldwide feeds, and it's a lot of fun to interact with people in person as well as on the list. Consider it a sort of minor leagues, if you'll pardon the sports analogy. And the comments (by you and by others) about there being highly abrasive elements in the Perl "help" community are certainly true. I've called one of them an "intellectual bully" in his presence, and all it earned me was a kickban. :) So I just (mostly) try to be polite and not let it bother me. Much. I would like to make it better, but I can't change others, and I only have so much energy to help others at all ... so it's very hit or miss. Jason> I appologise to Tkil, Thanks. Interestingly enough, I can blow off pretty much any insult or rude behavior directed towards myself. It's when I see others being abused, or being embarrassed, that I get very uncomfortable. (This is what I mean when I say that I left the Perl community because I was "too thin-skinned".) The current issue seemed to be just a miscommunication and a misunderstanding (at least that's what I saw). If anything, I feel I should apologize for "talking down" at you a bit; much of my mail was intended as suggestions for helping us help you, but I could have phrased it more diplomatically. Jason> It was gracious for you to write so thorough an example after I Jason> was unpleasent to you. And this is the flip side of how I interact with help requests or questions that intrigue me. "Hm, I don't know; let's experiment to find out." I had never used Storable before, so I learned something in exchange (cf my concept of "payment" for helping others in a "free" forum). Jason> (And just so you know, many people came to your defense out of Jason> list) Enough of them copied me that I knew it. And it is appreciated. :) Jason> Sometimes it is difficult to find information that you guys Jason> take for granted.? Which is why every Perl help medium I've been on (irc, usenet, mailing lists, meetings, etc) is open to people asking "where do I find out more about ?". After a while, we might start suggesting that they start learning how to help themselves, but we can help with that, too. Jason> For example, when I didn't know what qw() was.? Try finding it Jason> documented in an O'reilly book, used extensivly, not Jason> documented.? (I didn't ask questions like that here, I found Jason> them on my own).? Lurking on the #perl channel on IRC was a very educational experience, because people will rapid-fire which bits of documentation to look at for a particular thing. Also, I strongly recommend reading through the entire FAQ at some point; even if you don't understand all of it, or need that section at the time, it will "stick in your mind" so you might remember to look there when you *do* need it. Jason> I just recently learned of perldoc and perlfunc. To my Jason> recollection,?they aren't listed in any of the books I've read, Jason> or suggested on any of the sites I've been to.? Heh. Take a look in the index of _Programming Perl_ (the "Camel" book) [3rd ed], under "Documentation". There are quite a few links there. As I mention below, googling for "perl documentation" would have helped you out, too. Jason> What I would like to know is where I can find a table of the Jason> subjects available via perldoc. As others have already pointed out, there's "perldoc perl", which is an introduction with a list of other pages. The more detailed table of contents if "perltoc". On a proper Unix install, these pages should all be accessable via "man" as well. There are versions of it on the web, too: www.perldoc.com Finally, there are the general solutions; going to Google and searching for "object-oriented perl" shows many useful pages; a web version of perltoot happens to be 4th on the list. For further reading/browsing, I strongly recommend checking out search.cpan.org -- much of perl's power is in its extensive library of modules; as well as doing much of the work for you, they are often sources of fascinating code. (Probably not a good place to look to learn basic perl, but for the hairy stuff...) I fully realize that the perl documentation set is huge, and it's not obvious where to look for things. In a way, this is is a part of the task of learning a new language, especially one as rich and subtle as perl is. This is why "learning perl in 24 hours" is simply not going to work; you can learn enough to do simple things, but you won't get a feel for the language itself. (To give a personal example, I'm at a very primitive level in Visual Basic; I can make it do things, but I know I'm doing it the hard way. I wouldn't feel justified in saying I "know" the language, but I know my way around.) Which brings us back to the idea of community. I learned a huge amount about Perl -- details, idioms, subtleties, tricks, modules, features -- by spending time on IRC, usenet, lists, etc. Interacting with people online, then occasionally continuing those conversations face-to-face, has made local lists quite enjoyable for me, and I feel that they should be inclusive rather than exclusive until volume becomes an issue. In particular, I don't mind seeing help requests on local lists; amusingly enough, one of the more frequent posters to the Boulder (Colorado) Linux Users' Group list is Ralf Mattes -- from Germany. Who also happens to be a Perl geek, so it all works out. Babble, babble, t. From karic at lclark.edu Thu Jul 25 12:23:08 2002 From: karic at lclark.edu (Kari Chisholm) Date: Mon Aug 2 21:34:11 2004 Subject: [Pdx-pm] regex & phone numbers... Message-ID: <3D4033FC.DE5EAF74@lclark.edu> Hey all... Now that all that madness is past... I've got another regex stumper. I want to clean up phone numbers that people submit in a form. They could come in all kinds of ways, like... (503) 123-4567 503.123.4567 (503)-123-4567 123-4567 503 123 4567 503-123-4567 ext. 89 123-4567 ext. 89 503-123-4567-mom's house I want to convert the actual seven- or ten-digit phone number part to just xxx-xxx-xxxx. I also want to leave alone anything that comes after that - which is obviously the tough part. The logic should be basically this: just process through the number left to right, grabbing the first seven or ten numbers, then reformat those and tack on whatever's left. The challenge is figuring out when it's a seven-digit or a ten-digit number. I've conceptualized any number of highly complex and idiotic ways of doing this. I'm just wondering if there's a simpler regex approach to this... Any ideas? -kari. From cb at onsitetech.com Thu Jul 25 13:56:02 2002 From: cb at onsitetech.com (Christian Brink) Date: Mon Aug 2 21:34:11 2004 Subject: [Pdx-pm] regex & phone numbers... In-Reply-To: <3D4033FC.DE5EAF74@lclark.edu> Message-ID: You may want to look at Number::Phone::US http://search.cpan.org/doc/KENNEDYH/Number-Phone-US-1.3/lib/Number/Phone/US. pm Christian Brink CTO ONSITE! Technology www.onsitetech.com 503.233.1418 cb@onsitetech.com Taking e-Business and Internet Technology To The Extreme! > -----Original Message----- > From: pdx-pm-list-admin@mail.pm.org > [mailto:pdx-pm-list-admin@mail.pm.org]On Behalf Of Kari Chisholm > Sent: Thursday, July 25, 2002 10:23 AM > To: pdx-pm-list@pm.org > Subject: [Pdx-pm] regex & phone numbers... > > > > Hey all... > > Now that all that madness is past... I've got another regex stumper. > > I want to clean up phone numbers that people submit in a form. They > could come in all kinds of ways, like... > > (503) 123-4567 > 503.123.4567 > (503)-123-4567 > 123-4567 > 503 123 4567 > 503-123-4567 ext. 89 > 123-4567 ext. 89 > 503-123-4567-mom's house > > I want to convert the actual seven- or ten-digit phone number part to > just xxx-xxx-xxxx. I also want to leave alone anything that comes > after that - which is obviously the tough part. The logic should be > basically this: just process through the number left to right, > grabbing the first seven or ten numbers, then reformat those and tack > on whatever's left. The challenge is figuring out when it's a > seven-digit or a ten-digit number. > > I've conceptualized any number of highly complex and idiotic ways of > doing this. I'm just wondering if there's a simpler regex approach to > this... Any ideas? > > -kari. > _______________________________________________ > Pdx-pm-list mailing list > Pdx-pm-list@mail.pm.org > http://mail.pm.org/mailman/listinfo/pdx-pm-list From cp at onsitetech.com Thu Jul 25 13:56:54 2002 From: cp at onsitetech.com (Curtis Poe) Date: Mon Aug 2 21:34:11 2004 Subject: [Pdx-pm] regex & phone numbers... References: <3D4033FC.DE5EAF74@lclark.edu> Message-ID: <013d01c2340d$0c01d0e0$1a01a8c0@ot.onsitetech.com> ----- Original Message ----- From: "Kari Chisholm" To: Sent: Thursday, July 25, 2002 10:23 AM Subject: [Pdx-pm] regex & phone numbers... > > Hey all... > > Now that all that madness is past... I've got another regex stumper. > > I want to clean up phone numbers that people submit in a form. They > could come in all kinds of ways, like... > > (503) 123-4567 > 503.123.4567 > (503)-123-4567 > 123-4567 > 503 123 4567 > 503-123-4567 ext. 89 > 123-4567 ext. 89 > 503-123-4567-mom's house > > I want to convert the actual seven- or ten-digit phone number part to > just xxx-xxx-xxxx. I also want to leave alone anything that comes > after that - which is obviously the tough part. The logic should be > basically this: just process through the number left to right, > grabbing the first seven or ten numbers, then reformat those and tack > on whatever's left. The challenge is figuring out when it's a > seven-digit or a ten-digit number. > > I've conceptualized any number of highly complex and idiotic ways of > doing this. I'm just wondering if there's a simpler regex approach to > this... Any ideas? Kari, My suggestion, if you're allowed to do this: rethink the problem. Rather than try to clean up their data, only allow them to enter data in a format that *you* specify. One way to do this is to use the following text on the form, near the input box. Phone (xxx-xxx-xxxx format only): Then, in your code: my $tainted_phone = param('phone'); my ($phone) = $tainted_phone =~ /(\d\d\d-\d\d\d-\d\d\d\d)/; if ( ! $phone ) { # some error processing and send 'em back to the form } else { # do the right thing } Of course, you'll have to customize that to your needs (such as allowing an optional extension), but I find it easier to ensure that the user does things right, rather than try to guess what the user did. Of course, another trick is to provide separate input boxes for the area code, exchange, number, extension, and perhaps a note. Imagining that the underscores are input boxes: ___-___-____ x _____ Note: _________ That's even easier to parse, but requires a bit more gruntwork. You'll have to let the users know what is mandatory and what is optional, though. -- Cheers, Curtis Poe Senior Programmer ONSITE! Technology, Inc. www.onsitetech.com 503-233-1418 Taking e-Business and Internet Technology To The Extreme! From tkil at scrye.com Thu Jul 25 14:28:49 2002 From: tkil at scrye.com (Tkil) Date: Mon Aug 2 21:34:11 2004 Subject: [Pdx-pm] regex & phone numbers... In-Reply-To: <3D4033FC.DE5EAF74@lclark.edu> References: <3D4033FC.DE5EAF74@lclark.edu> Message-ID: >>>>> "Kari" == Kari Chisholm writes: Kari> I want to convert the actual seven- or ten-digit phone number part to Kari> just xxx-xxx-xxxx. I also want to leave alone anything that comes Kari> after that - which is obviously the tough part. The logic should be Kari> basically this: just process through the number left to right, Kari> grabbing the first seven or ten numbers, then reformat those and tack Kari> on whatever's left. The challenge is figuring out when it's a Kari> seven-digit or a ten-digit number. Kari> I've conceptualized any number of highly complex and idiotic Kari> ways of doing this. I'm just wondering if there's a simpler Kari> regex approach to this... Any ideas? Get a list of all the formats you think you need to worry about, write a set of regexps that can handle all of them, then return an error if you can't parse a new one. That list bit is important; this keeps you from making assumptions that might trip you up. [I unintentionally did this to GBARR's Date::Parse::str2time function. Going through a few 100k mail messages, I found about 0.1% that had bogus date strings that it couldn't parse gracefully. Bit of a stress test there. And a sign of over-zealous error checking: str2time rejected New Zealand Daylight Saving Time, because UTC+1300 is "obviously" a bogus time zone...] A straightforward version might be: | #!/usr/bin/perl -w | | use strict; | | sub normalize_phone_number ( $ $ ) | { | my ($in, $default_ac) = @_; | | # abbreviations | my $d3 = '(\d{3})'; | my $d4 = '(\d{4})'; | | # is it already sane? | $in =~ /^ $d3 [\.\-\s] $d3 [\.\-\s] $d4 \s* (.*)/x | and return "$1-$2-$3 $4"; | | # area code in parens | $in =~ /^ \( $d3 \) [\-\s] $d3 [\-\s] $d4 \s* (.*)/x | and return "$1-$2-$3 $4"; | | # missing area code | $in =~ /^ $d3 [\.\-\s] $d4 \s* (.*)/x | and return "$default_ac-$1-$2 $3"; | | return; | } | | while (my $in = ) | { | chomp $in; | if (my $out = normalize_phone_number $in, '503') | { | printf "%-30s => %s\n", $in, $out; | } | else | { | print "$in: couldn't parse!\n"; | } | } | | __END__ | (503) 123-4567 | 503.123.4567 | (503)-123-4567 | 123-4567 | 503 123 4567 | 503-123-4567 ext. 89 | 123-4567 ext. 89 | 503-123-4567-mom's house | 858-123-4239 x23 t. From nforrett at wgz.com Thu Jul 25 14:47:42 2002 From: nforrett at wgz.com (n/a) Date: Mon Aug 2 21:34:11 2004 Subject: [Pdx-pm] regex & phone numbers... In-Reply-To: <3D4033FC.DE5EAF74@lclark.edu> Message-ID: On Thu, 25 Jul 2002, Kari Chisholm wrote: > I want to convert the actual seven- or ten-digit phone number part to > just xxx-xxx-xxxx. I also want to leave alone anything that comes > after that - which is obviously the tough part. The logic should be > basically this: just process through the number left to right, > grabbing the first seven or ten numbers, then reformat those and tack > on whatever's left. The challenge is figuring out when it's a > seven-digit or a ten-digit number. Here is a start... $line =~ s/(?: \(? # optional leading paren (\d{3}) # capture area code \)? # optional closing paren [-\s.]? # optional hyphen, space or period )? # make the whole area code bit optional (\d{3}) # capture first three digits [-\s.]? # optional hyphen, space or period (\d{4}) # capture last four digits /(\1) \2-\3/x ; (503) 123-4567 => (503) 123-4567 503.123.4567 => (503) 123-4567 (503)-123-4567 => (503) 123-4567 123-4567 => () 123-4567 503 123 4567 => (503) 123-4567 503-123-4567 ext. 89 => (503) 123-4567 ext. 89 123-4567 ext. 89 => () 123-4567 ext. 89 503-123-4567-mom's house => (503) 123-4567-mom's house Plus a few extra cases... asdf1234567fdsa => asdf() 123-4567fdsa asdf1234567890fdsa => asdf(123) 456-7890 asdf 12345678 fdsa => asdf () 123-45678 fdsa This assumes you don't mind the extra parens in the case of a missing area code. Though Christian probably had the better suggestion. =) > I've conceptualized any number of highly complex and idiotic ways of doing > this. I'm just wondering if there's a simpler regex approach to this... > Any ideas? -- Nick ,--< Nick Forrette >--------------------------. | e-mail: nforrett@wgz.org | | www : http://www.drforehead.net/ | `---------------------------------------------' umop apisdn aje noh From jkeroes at eli.net Thu Jul 25 14:02:03 2002 From: jkeroes at eli.net (Joshua Keroes) Date: Mon Aug 2 21:34:11 2004 Subject: [Pdx-pm] regex & phone numbers... In-Reply-To: <3D4033FC.DE5EAF74@lclark.edu> References: <3D4033FC.DE5EAF74@lclark.edu> Message-ID: <20020725190203.GH13315@eli.net> On (Thu, Jul 25 10:23), Kari Chisholm wrote: > I want to clean up phone numbers that people submit in a form. They > could come in all kinds of ways, like... > > (503) 123-4567 > 503.123.4567 > (503)-123-4567 > 123-4567 > 503 123 4567 > 503-123-4567 ext. 89 > 123-4567 ext. 89 > 503-123-4567-mom's house > > I want to convert the actual seven- or ten-digit phone number part > to just xxx-xxx-xxxx. [snip] I've conceptualized any number of > highly complex and idiotic ways of doing this. I'm just wondering > if there's a simpler regex approach to this... Any ideas? Just make sure you trim the PDX-pm email footer off the DATA section. -Joshua #!/usr/local/bin/perl -w use strict; our $AREACODE = 503; # Output default our $DELIM = '-'; # Output default my $areacode_re = qr/\(? ( \d{3} )? \)?/x; my $delim_re = qr/[-. ]/; my $lastseven_re = qr/( \d{3} ) $delim_re ( \d{4} )/x; my $ext_delim_re = qr/(?:ext\s? | ext| x)/x; my $ext_re = qr/( \d+ )/x; my $phone_re = qr/ $areacode_re \s* $delim_re? \s* $lastseven_re \s* $ext_delim_re? \s* $ext_re? /x; while () { chomp; my $nice = format_phone($_) || '?'; printf "%25s => %s\n", $_, $nice; } exit; # subs sub format_phone { my $ugly = shift or die "Didn't get a phone number. Aborting"; my ($areacode, $mid3, $last4, $ext) = $ugly =~ $phone_re; unless ($mid3 && $last4) { warn "Unable to parse phone number: '$ugly'"; return; } $areacode ||= $AREACODE; my $nice = join $DELIM, ($areacode, $mid3, $last4); $nice .= " x$ext" if $ext; return $nice; } __DATA__ (503) 123-4567 503.123.4567 (503)-123-4567 123-4567 503 123 4567 503-123-4567 ext. 89 123-4567 ext. 89 503-123-4567-mom's house From rb-pdx-pm at redcat.com Thu Jul 25 14:08:45 2002 From: rb-pdx-pm at redcat.com (Tom Phoenix) Date: Mon Aug 2 21:34:11 2004 Subject: [Pdx-pm] regex & phone numbers... In-Reply-To: <3D4033FC.DE5EAF74@lclark.edu> Message-ID: On Thu, 25 Jul 2002, Kari Chisholm wrote: > I want to clean up phone numbers that people submit in a form. They > could come in all kinds of ways, This sounds like a job for a module. If Number::Phone::US (from CPAN) won't do what you want, you should submit a patch to its author. :-) Cheers! --Tom Phoenix From dcstevens at earthlink.net Thu Jul 25 15:18:15 2002 From: dcstevens at earthlink.net (Earthlink) Date: Mon Aug 2 21:34:11 2004 Subject: [Pdx-pm] Newbie question ... built-in for subroutine name? Message-ID: I'm trying to find the perl built-in variable for the current subroutine name (the analog to __FUNCTION__ in gcc), so that I can pass the name to a calling function, as in the code below. I've looked through the Coriolis and O'Reilly texts, and at several on-line FAQs. Anyone know what it's called? sub foo { my ($callerName) = @_; printf("foo called from $callerName\n"); } sub callingFxn { my $currentFxnName = ???; foo($currentFxnName); } From cp at onsitetech.com Thu Jul 25 16:19:07 2002 From: cp at onsitetech.com (Curtis Poe) Date: Mon Aug 2 21:34:11 2004 Subject: [Pdx-pm] Subscribing References: <3D4033FC.DE5EAF74@lclark.edu> <20020725190203.GH13315@eli.net> Message-ID: <016a01c23420$e9d3e0d0$1a01a8c0@ot.onsitetech.com> I'm getting a few mailings that I need to approve because people have failed to sign up for the list. If you haven't signed up, you probably aren't seeing this message :) If you have signed up and use more than one account ... be sure to sign up the other account. -- Cheers, Curtis Poe Senior Programmer ONSITE! Technology, Inc. www.onsitetech.com 503-233-1418 Taking e-Business and Internet Technology To The Extreme! From jkeroes at eli.net Thu Jul 25 16:47:14 2002 From: jkeroes at eli.net (Joshua Keroes) Date: Mon Aug 2 21:34:11 2004 Subject: [Pdx-pm] Newbie question ... built-in for subroutine name? In-Reply-To: References: Message-ID: <20020725214714.GM13315@eli.net> On (Thu, Jul 25 13:18), Earthlink wrote: > I'm trying to find the perl built-in variable for the current subroutine name (the analog to __FUNCTION__ in gcc) #!/usr/local/bin/perl -w use strict; foo(); sub foo { my ($package, $filename, $line, $subroutine, $hasargs, $wantarray, $evaltext, $is_require, $hints, $bitmask) = caller(0); print < Message-ID: <3D406E30.C87ECCCC@eli.net> Kari Chisholm wrote: > I've conceptualized any number of highly complex and idiotic ways of > doing this. Me too. sandbox:/tmp/nums[1749]> cat source (503) 123-4567 503.123.4567 (503)-123-4567 123-4567 503 123 4567 503-123-4567 503-123-4567 ext. 69 123-4567 ext. 69 503-123-4567-mom's house sandbox:/tmp/nums[1750]> perl -ple '/(?:\D*(\d{3,4})\D?(?{local@n=(@n,$1)})){1,3}(?{local$r=join("-",@n)})(?{$_=$r." ".substr($_,pos($_))})/g' source 503-123-4567 503-123-4567 503-123-4567 123-4567 503-123-4567 503-123-4567 503-123-4567 ext. 69 123-4567 ext. 69 503-123-4567 mom's house From cb at onsitetech.com Thu Jul 25 16:53:39 2002 From: cb at onsitetech.com (Christian Brink) Date: Mon Aug 2 21:34:11 2004 Subject: [Pdx-pm] Newbie question ... built-in for subroutine name? In-Reply-To: Message-ID: You can use caller in the foo sub to get the calling sub. http://www.perldoc.com/perl5.6.1/pod/func/caller.html Christian Brink CTO ONSITE! Technology www.onsitetech.com 503.233.1418 cb@onsitetech.com Taking e-Business and Internet Technology To The Extreme! > -----Original Message----- > From: pdx-pm-list-admin@mail.pm.org > [mailto:pdx-pm-list-admin@mail.pm.org]On Behalf Of Earthlink > Sent: Thursday, July 25, 2002 1:18 PM > To: pdx-pm-list@pm.org > Subject: [Pdx-pm] Newbie question ... built-in for subroutine name? > > > I'm trying to find the perl built-in variable for the current > subroutine name (the analog to __FUNCTION__ in gcc), so that I > can pass the name to a calling function, as in > the code below. I've looked through the Coriolis and O'Reilly > texts, and at several on-line FAQs. Anyone know what it's called? > > sub foo > { > my ($callerName) = @_; > printf("foo called from $callerName\n"); > } > > sub callingFxn > { > my $currentFxnName = ???; > foo($currentFxnName); > } > > > _______________________________________________ > Pdx-pm-list mailing list > Pdx-pm-list@mail.pm.org > http://mail.pm.org/mailman/listinfo/pdx-pm-list From tkil at scrye.com Thu Jul 25 17:59:53 2002 From: tkil at scrye.com (Tkil) Date: Mon Aug 2 21:34:11 2004 Subject: [Pdx-pm] Newbie question ... built-in for subroutine name? In-Reply-To: References: Message-ID: >>>>> "dcs" == dcstevens writes: dcs> I'm trying to find the perl built-in variable for the current dcs> subroutine name (the analog to __FUNCTION__ in gcc), so that I dcs> can pass the name to a calling function, as in the code dcs> below. I've looked through the Coriolis and O'Reilly texts, and dcs> at several on-line FAQs. Anyone know what it's called? perldoc -f caller From tkil at scrye.com Thu Jul 25 18:17:24 2002 From: tkil at scrye.com (Tkil) Date: Mon Aug 2 21:34:11 2004 Subject: [Pdx-pm] Newbie question ... built-in for subroutine name? In-Reply-To: References: Message-ID: <15680.34564.290055.496219@brand.scrye.com> To amplify my previous response: | #!/usr/bin/perl -w | | use strict; | | sub squawk | { | my ($sub) = (caller 1)[ 3 ]; | $sub ||= 'main'; | my ($file, $line) = (caller 0)[ 1, 2 ]; | print "squawk: called from $sub ($file\: $line)\n"; | } | | sub foo { squawk(); } | | print "in main\n"; | squawk(); | | foo(); | | exit 0; Which gives me: | $ ./show-caller | in main | squawk: called from main (./show-caller: 16) | squawk: called from main::foo (./show-caller: 13) I've used this to do a custom version of carp/cluck before (perldoc Carp). It's a bit annoying that we have to look at two different "caller" levels to get information about one point, but whatever works... t. From cb at onsitetech.com Thu Jul 25 18:47:16 2002 From: cb at onsitetech.com (Christian Brink) Date: Mon Aug 2 21:34:11 2004 Subject: [Pdx-pm] Subscribing In-Reply-To: <016a01c23420$e9d3e0d0$1a01a8c0@ot.onsitetech.com> Message-ID: > I'm getting a few mailings that I need to approve because people > have failed > to sign up for the list. If you haven't signed up, you probably aren't > seeing this message :) Just as a note: I'll be announcing all portland.pm.org website outages on the index page at portland.pm.org :) From rootbeer at redcat.com Thu Jul 25 18:09:55 2002 From: rootbeer at redcat.com (Tom Phoenix) Date: Mon Aug 2 21:34:11 2004 Subject: [Pdx-pm] regex & phone numbers... In-Reply-To: <013d01c2340d$0c01d0e0$1a01a8c0@ot.onsitetech.com> Message-ID: On Thu, 25 Jul 2002, Curtis Poe wrote: > Of course, another trick is to provide separate input boxes Is this happening on the web? As a user, having separate boxes is something I dislike. Just last week, I had to enter a phone number into separate input boxes. I could copy the number from a web page (it's not _my_ number!), but I couldn't paste it into the three boxes. I had to switch from window to window to copy the phone number. As a general principle, make things easier for the user, even if that's harder for the programmer. After all, there are a lot more users than programmers. Cheers! --Tom Phoenix From jkeroes at eli.net Thu Jul 25 17:01:49 2002 From: jkeroes at eli.net (Joshua Keroes) Date: Mon Aug 2 21:34:11 2004 Subject: [Pdx-pm] Subscribing In-Reply-To: <016a01c23420$e9d3e0d0$1a01a8c0@ot.onsitetech.com> References: <3D4033FC.DE5EAF74@lclark.edu> <20020725190203.GH13315@eli.net> <016a01c23420$e9d3e0d0$1a01a8c0@ot.onsitetech.com> Message-ID: <20020725220149.GO13315@eli.net> On (Thu, Jul 25 14:19), Curtis Poe wrote: > I'm getting a few mailings that I need to approve because people have failed > to sign up for the list. If you haven't signed up, you probably aren't > seeing this message :) If you have signed up and use more than one account > ... be sure to sign up the other account. FWIW, if you sign up two accounts, MailMan can be configured to sent mail to just one. This will permit email submissions from either account. 1. Go to http://mail.pm.org/mailman/listinfo/pdx-pm-list 2. Type one of your subscribed email addresses in the text box beside the "Edit Options" button, then click the button. 3. Set "Disable mail delivery" to "On" 4. Type password below, click "Submit My Changes" -Joshua From nforrett at wgz.com Thu Jul 25 17:31:25 2002 From: nforrett at wgz.com (n/a) Date: Mon Aug 2 21:34:11 2004 Subject: [Pdx-pm] Newbie question ... built-in for subroutine name? In-Reply-To: Message-ID: On Thu, 25 Jul 2002, Earthlink wrote: > I'm trying to find the perl built-in variable for the current subroutine name (the analog to __FUNCTION__ in gcc), so that I can pass the name to a calling function, as in > the code below. I've looked through the Coriolis and O'Reilly texts, and at several on-line FAQs. Anyone know what it's called? perldoc -f caller -- Nick ,--< Nick Forrette >--------------------------. | e-mail: nforrett@wgz.org | | www : http://www.drforehead.net/ | `---------------------------------------------' umop apisdn aje noh From cp at onsitetech.com Thu Jul 25 17:16:40 2002 From: cp at onsitetech.com (Curtis Poe) Date: Mon Aug 2 21:34:11 2004 Subject: [Pdx-pm] Subscribing References: <3D4033FC.DE5EAF74@lclark.edu> <20020725190203.GH13315@eli.net> <016a01c23420$e9d3e0d0$1a01a8c0@ot.onsitetech.com> <20020725220149.GO13315@eli.net> Message-ID: <018e01c23428$f3793ba0$1a01a8c0@ot.onsitetech.com> ----- Original Message ----- From: "Joshua Keroes" > FWIW, if you sign up two accounts, MailMan can be configured to sent mail to > just one. This will permit email submissions from either account. > > 1. Go to http://mail.pm.org/mailman/listinfo/pdx-pm-list > > 2. Type one of your subscribed email addresses in the text box beside > the "Edit Options" button, then click the button. > > 3. Set "Disable mail delivery" to "On" > > 4. Type password below, click "Submit My Changes" Aah! Nice to know. I'm liking mailman better than majordomo already. -- Cheers, Curtis Poe Senior Programmer ONSITE! Technology, Inc. www.onsitetech.com 503-233-1418 Taking e-Business and Internet Technology To The Extreme! From cp at onsitetech.com Tue Jul 30 11:16:28 2002 From: cp at onsitetech.com (Curtis Poe) Date: Mon Aug 2 21:34:11 2004 Subject: [Pdx-pm] Michael Schwern and Brian Ingerson References: <3D4033FC.DE5EAF74@lclark.edu> <20020725190203.GH13315@eli.net> <016a01c23420$e9d3e0d0$1a01a8c0@ot.onsitetech.com> <20020725220149.GO13315@eli.net> <018e01c23428$f3793ba0$1a01a8c0@ot.onsitetech.com> Message-ID: <001701c237e4$75f66b70$1a01a8c0@ot.onsitetech.com> Michael Schwern and Brian Ingerson will be in town tomorrow night and while this is a bit of short notice for a technical meeting, a social meeting would be great. My suggestion is the Lucky Lab, http://www.luckylab.com/, for which you can find directions at http://www.luckylab.com/lab_trans.html. They're at 915 SE Hawthorne Blvd, so they should be easy for most of us to get to. If you haven't heard of them, Michael Schwern, a 2002 nominee for the ActiveState Active Awards (http://www.activestate.com/Corporate/Awards/ActiveAwards.html?_x=1) is well known for his contributions to Perl's automated testing modules and culture. At Perl Conference 5, Brian Ingerson, shared with Neil Watkiss an award for Best Module. This module, of course, was Inline, and is one of the coolest toys you can lay your hands on, assuming that you happen to know another language that you can embed in Perl. Interesting coincidence: my current pet project would have been much more difficult without the Test::More module that Michael Schwern wrote, and I need to convert parts of it to C using Inline::C, which Brian Ingerson wrote. If anyone else would like to come, feel free. We'll be there around 6:00 pm. -- Cheers, Curtis Poe Senior Programmer ONSITE! Technology, Inc. www.onsitetech.com 503-233-1418 Taking e-Business and Internet Technology To The Extreme! From cp at onsitetech.com Tue Jul 30 16:51:51 2002 From: cp at onsitetech.com (Curtis Poe) Date: Mon Aug 2 21:34:11 2004 Subject: [Pdx-pm] Michael Schwern and Brian Ingerson References: <3D4033FC.DE5EAF74@lclark.edu> <20020725190203.GH13315@eli.net> <016a01c23420$e9d3e0d0$1a01a8c0@ot.onsitetech.com> <20020725220149.GO13315@eli.net> <018e01c23428$f3793ba0$1a01a8c0@ot.onsitetech.com> <001701c237e4$75f66b70$1a01a8c0@ot.onsitetech.com> Message-ID: <009401c23813$5095bdc0$1a01a8c0@ot.onsitetech.com> I have been informed that Personal TelCo is meeting at the Lucky Lab tomorrow. I have no idea how many people they are or whether or not there will be space for us. Since I haven't had many replies, it looks like this isn't a problem, but I wanted to give people a heads up. Let me know if you're going to be there tomorrow and, if we have a large crowd, maybe we can rethink the location. Let me know ASAP, though, as this is a much shorter timeframe then I would care for. -- Cheers, Curtis Poe Senior Programmer ONSITE! Technology, Inc. www.onsitetech.com 503-233-1418 Taking e-Business and Internet Technology To The Extreme! ----- Original Message ----- From: "Curtis Poe" To: Sent: Tuesday, July 30, 2002 9:16 AM Subject: [Pdx-pm] Michael Schwern and Brian Ingerson > Michael Schwern and Brian Ingerson will be in town tomorrow night and while > this is a bit of short notice for a technical meeting, a social meeting > would be great. My suggestion is the Lucky Lab, http://www.luckylab.com/, > for which you can find directions at http://www.luckylab.com/lab_trans.html. > They're at 915 SE Hawthorne Blvd, so they should be easy for most of us to > get to. > > If you haven't heard of them, Michael Schwern, a 2002 nominee for the > ActiveState Active Awards > (http://www.activestate.com/Corporate/Awards/ActiveAwards.html?_x=1) is well > known for his contributions to Perl's automated testing modules and culture. > > At Perl Conference 5, Brian Ingerson, shared with Neil Watkiss an award for > Best Module. This module, of course, was Inline, and is one of the coolest > toys you can lay your hands on, assuming that you happen to know another > language that you can embed in Perl. > > Interesting coincidence: my current pet project would have been much more > difficult without the Test::More module that Michael Schwern wrote, and I > need to convert parts of it to C using Inline::C, which Brian Ingerson > wrote. > > If anyone else would like to come, feel free. We'll be there around 6:00 > pm. > > -- > Cheers, > Curtis Poe > Senior Programmer > ONSITE! Technology, Inc. > www.onsitetech.com > 503-233-1418 > > Taking e-Business and Internet Technology To The Extreme! > > _______________________________________________ > Pdx-pm-list mailing list > Pdx-pm-list@mail.pm.org > http://mail.pm.org/mailman/listinfo/pdx-pm-list > From tex at off.org Tue Jul 30 17:26:25 2002 From: tex at off.org (Austin Schutz) Date: Mon Aug 2 21:34:11 2004 Subject: [Pdx-pm] Michael Schwern and Brian Ingerson In-Reply-To: <009401c23813$5095bdc0$1a01a8c0@ot.onsitetech.com>; from cp@onsitetech.com on Tue, Jul 30, 2002 at 02:51:51PM -0700 References: <3D4033FC.DE5EAF74@lclark.edu> <20020725190203.GH13315@eli.net> <016a01c23420$e9d3e0d0$1a01a8c0@ot.onsitetech.com> <20020725220149.GO13315@eli.net> <018e01c23428$f3793ba0$1a01a8c0@ot.onsitetech.com> <001701c237e4$75f66b70$1a01a8c0@ot.onsitetech.com> <009401c23813$5095bdc0$1a01a8c0@ot.onsitetech.com> Message-ID: <20020730152625.O8712@gblx.net> On Tue, Jul 30, 2002 at 02:51:51PM -0700, Curtis Poe wrote: > I have been informed that Personal TelCo is meeting at the Lucky Lab > tomorrow. I have no idea how many people they are or whether or not there > will be space for us. Since I haven't had many replies, it looks like this > isn't a problem, but I wanted to give people a heads up. Let me know if > you're going to be there tomorrow and, if we have a large crowd, maybe we > can rethink the location. > PTP is maybe 25-40 people. They'll probably occupy the back room. If this is a social even that's probably not a big deal. Austin From tex at off.org Tue Jul 30 17:59:07 2002 From: tex at off.org (Austin Schutz) Date: Mon Aug 2 21:34:11 2004 Subject: [Pdx-pm] Michael Schwern and Brian Ingerson In-Reply-To: <009401c23813$5095bdc0$1a01a8c0@ot.onsitetech.com>; from cp@onsitetech.com on Tue, Jul 30, 2002 at 02:51:51PM -0700 References: <3D4033FC.DE5EAF74@lclark.edu> <20020725190203.GH13315@eli.net> <016a01c23420$e9d3e0d0$1a01a8c0@ot.onsitetech.com> <20020725220149.GO13315@eli.net> <018e01c23428$f3793ba0$1a01a8c0@ot.onsitetech.com> <001701c237e4$75f66b70$1a01a8c0@ot.onsitetech.com> <009401c23813$5095bdc0$1a01a8c0@ot.onsitetech.com> Message-ID: <20020730155907.Q8712@gblx.net> > > At Perl Conference 5, Brian Ingerson, shared with Neil Watkiss an award > for > > Best Module. This module, of course, was Inline, and is one of the > coolest > > toys you can lay your hands on, assuming that you happen to know another > > language that you can embed in Perl. Had never heard of it before today. What an incredible tool! Works like XS without the bed of nails. Austin From cp at onsitetech.com Tue Jul 30 18:03:12 2002 From: cp at onsitetech.com (Curtis Poe) Date: Mon Aug 2 21:34:11 2004 Subject: [Pdx-pm] Michael Schwern and Brian Ingerson References: <3D4033FC.DE5EAF74@lclark.edu> <20020725190203.GH13315@eli.net> <016a01c23420$e9d3e0d0$1a01a8c0@ot.onsitetech.com> <20020725220149.GO13315@eli.net> <018e01c23428$f3793ba0$1a01a8c0@ot.onsitetech.com> <001701c237e4$75f66b70$1a01a8c0@ot.onsitetech.com> <009401c23813$5095bdc0$1a01a8c0@ot.onsitetech.com> <20020730155907.Q8712@gblx.net> Message-ID: <00bc01c2381d$483a42e0$1a01a8c0@ot.onsitetech.com> ----- Original Message ----- From: "Austin Schutz" > Had never heard of [Inline] before today. What an incredible tool! Works > like XS without the bed of nails. > > Austin No kidding. It's pretty awesome. I've only played with it once (http://www.perlmonks.org/index.pl?node_id=135353), but it was a heck of a lot of fun. Incidentally, it sounds like there's no problem with the Lucky Lab tomorrow, so I'll see all y'all there. (yee haw)d -- Cheers, Curtis Poe Senior Programmer ONSITE! Technology, Inc. www.onsitetech.com 503-233-1418 Taking e-Business and Internet Technology To The Extreme! From cfrjlr at yahoo.com Tue Jul 30 19:45:08 2002 From: cfrjlr at yahoo.com (charles radley) Date: Mon Aug 2 21:34:11 2004 Subject: [Pdx-pm] Michael Schwern and Brian Ingerson References: <3D4033FC.DE5EAF74@lclark.edu> <20020725190203.GH13315@eli.net> <016a01c23420$e9d3e0d0$1a01a8c0@ot.onsitetech.com> <20020725220149.GO13315@eli.net> <018e01c23428$f3793ba0$1a01a8c0@ot.onsitetech.com> <001701c237e4$75f66b70$1a01a8c0@ot.onsitetech.com> <009401c23813$5095bdc0$1a01a8c0@ot.onsitetech.com> <20020730155907.Q8712@gblx.net> <00bc01c2381d$483a42e0$1a01a8c0@ot.onsitetech.com> Message-ID: <3D473314.D9E4C497@yahoo.com> Where / when is Lucky Lab ? -------------- next part -------------- A non-text attachment was scrubbed... Name: cfrjlr.vcf Type: text/x-vcard Size: 498 bytes Desc: Card for charles radley Url : http://mail.pm.org/pipermail/pdx-pm-list/attachments/20020730/31345371/cfrjlr.vcf From cfrjlr at yahoo.com Mon Jul 1 18:38:25 2002 From: cfrjlr at yahoo.com (charles radley) Date: Wed Aug 4 00:05:37 2004 Subject: Seeking experienced web site developer - part-time contract References: <6E9F28B7-8B99-11D6-A8DF-000A2792192A@mac.com> Message-ID: <3D20E7F1.FC60E77D@yahoo.com> I am a member of a non-profit who is looking for an experienced web site developer for a part-time contract, up to 20 hours/month initially. Proven (verifiable) experience required. Naturally I thought of you guys first..... Contact me if interested. Charles F. Radley -------------- next part -------------- A non-text attachment was scrubbed... Name: cfrjlr.vcf Type: text/x-vcard Size: 482 bytes Desc: Card for charles radley Url : http://mail.pm.org/archives/pdx-pm-list/attachments/20020701/5be97309/cfrjlr.vcf From al at shadowed.net Tue Jul 2 18:58:40 2002 From: al at shadowed.net (Allison Randal) Date: Wed Aug 4 00:05:38 2004 Subject: a book I want In-Reply-To: <000801c21f7f$84e3e270$1a01a8c0@ot.onsitetech.com> References: <20020107152503.GB3673@shadowed.net> <000801c21f7f$84e3e270$1a01a8c0@ot.onsitetech.com> Message-ID: <20020702235840.GA24233@shadowed.net> Wow, that message is 6 months old. I feel a bit like someone's been reading through my high-school year-book. ;) Ah, well, I guess it's a good opportunity for an update. On Sat, Jun 29, 2002 at 08:13:25AM -0700, Curtis Poe wrote: > ----- Original Message ----- > From: "Allison Randal" > To: > Sent: Monday, January 07, 2002 8:25 AM > Subject: a book I want > > I understand that Damian Conway has something "planned", but I don't > know the details yet. What he has planned at the moment is a published version of the Apocalypses and Exegeses (and maybe the Synopses now). Of course, they'll all have to be revised to fit with later changes. But, we made good progress on that in the Perl 6 meetings in St. Louis before YAPC. Do I still think we need another book? Hmmmm... I don't know. There may be a niche for one. I'll reserve judgement until I see the drafts for the revised Camel and Llama. :) > However, since the only guarantee about Perl 6 is that everything is > in flux, I don't think there is any reasonable way such a thing could > be constructed at this time. Can you imagine the wholesale revisions > that would be necessary if, for some reason, they decided to change > the concatenation operator again (what is this time, by the way?). It's settled on a steady C<_>. You'd be surprised how much is steady now. > For that reason, I don't think one will be coming out any time within the > next year. Of course, since you mentioned that "the book should be released > a few months before the full production version of Perl 6", then I suspect > we'll wait at least two years for the book :( I agree, a book wouldn't be appropriate yet. What is appropriate is training in a more flexible format. It's no good to just wait until Perl 6 is released and then learn it. I mean, you could, but you'll be way behind the curve. More and more "Perl 6" features are being released in Perl 5. And even more you can play with in the Perl6::... modules. The current projections are to have a usable interpreter in 12-18 months. And looking at the progress they've made on Parrot, I wouldn't be at all surprised if it happened. Allison TIMTOWTDI From poec at yahoo.com Tue Jul 2 19:01:44 2002 From: poec at yahoo.com (Ovid) Date: Wed Aug 4 00:05:38 2004 Subject: a book I want In-Reply-To: <20020702235840.GA24233@shadowed.net> Message-ID: <20020703000144.26120.qmail@web9105.mail.yahoo.com> --- Allison Randal wrote: > Wow, that message is 6 months old. I feel a bit like someone's been > reading through my high-school year-book. ;) > > Ah, well, I guess it's a good opportunity for an update. Whoops! I guess I must have sorted on date and not been paying attention :) Cheers, Curtis ===== "Ovid" on http://www.perlmonks.org/ Someone asked me how to count to 10 in Perl: push@A,$_ for reverse q.e...q.n.;for(@A){$_=unpack(q|c|,$_);@a=split//; shift@a;shift@a if $a[$[]eq$[;$_=join q||,@a};print $_,$/for reverse @A __________________________________________________ Do You Yahoo!? Sign up for SBC Yahoo! Dial - First Month Free http://sbc.yahoo.com TIMTOWTDI From jhoblitt at mysun.com Wed Jul 3 15:51:14 2002 From: jhoblitt at mysun.com (josh hoblitt) Date: Wed Aug 4 00:05:38 2004 Subject: meetings? Message-ID: <25df1252f7.252f725df1@mysun.com> What are the odds of a meeting happening between July 24th and August 13ish? -Joshua Hoblitt -- jhoblitt@mysun.com TIMTOWTDI From cp at onsitetech.com Wed Jul 3 16:15:51 2002 From: cp at onsitetech.com (Curtis Poe) Date: Wed Aug 4 00:05:38 2004 Subject: meetings? References: <25df1252f7.252f725df1@mysun.com> Message-ID: <006b01c222d6$cfb0c750$1a01a8c0@ot.onsitetech.com> ----- Original Message ----- From: "josh hoblitt" To: Sent: Wednesday, July 03, 2002 1:51 PM Subject: meetings? > What are the odds of a meeting happening between July 24th and August 13ish? > > -Joshua Hoblitt Joshua, You're the one who moved to Hawaii, aren't you? My memory is a bit hazy, so forgive me if I'm wrong :) If so, I'm guessing that you're visiting Portland in that time period. We have no scheduled meetings at that time, but I'm sure that a few Mongers might be up for an impromptu social night. If you're interested, pick a good night and maybe a few of us can get together. -- Cheers, Curtis Poe Senior Programmer ONSITE! Technology, Inc. www.onsitetech.com 503-233-1418 Taking e-Business and Internet Technology To The Extreme! TIMTOWTDI From cb at onsitetech.com Wed Jul 3 18:09:42 2002 From: cb at onsitetech.com (Christian Brink) Date: Wed Aug 4 00:05:38 2004 Subject: Website update or lack thereof Message-ID: It seems pm.org was hacked http://www.pm.org/whynologin.html and will not allow me to update the site (albeit I'm already late updating it). So I thought I would resend the meeting info. The July meeting is July 1oth chromatic will be giving a presentation titled "Introduction to Testing with Test::More". Test::More is available in the Test::Simple distribution available from CPAN - http://theoryx5.uwinnipeg.ca/scripts/CPAN/authors/id/M/MS/MSCHWERN/Test-Simp le-0.45.tar.gz chromatic is a frequent contributor to Perl and the Perl community. He joined the Perl QA group after being chastised for breaking bleadperl by not testing a proposed patch. In the past year, he has added tests for many of the core modules, and wrote the backend Test::Builder module. Additionally, he co-wrote "Running Weblogs with Slash" and may have another book about software development and Perl up his sleeve. Place: Onsite! Technology, Inc. Address: 333 SE 3rd, Portland, OR Date and Time: 2002-07-10 at 7:00 PM URL: www.onsitetech.com There will be a social meeting at Rose and Raindrop at 6:00 PM. The address is 532 S.E. Grand and it's about 3 blocks from the Onsite! Technology offices. Christian Brink CTO ONSITE! Technology www.onsitetech.com 503.233.1418 cb@onsitetech.com Taking e-Business and Internet Technology To The Extreme! TIMTOWTDI From jasona at inetarena.com Wed Jul 3 18:14:31 2002 From: jasona at inetarena.com (Jason White) Date: Wed Aug 4 00:05:38 2004 Subject: Variable variable name Message-ID: <007301c222e7$63805620$5b86fc83@archer> Here is some code. my $functionToCall = "foo"; ???????( ) sub foo(){ print "FOO!\n"; } How can I use the variable $functionToCall to replace ??????? with foo( ) ? Jason White -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/archives/pdx-pm-list/attachments/20020703/aff4dc17/attachment.htm From cp at onsitetech.com Wed Jul 3 18:48:01 2002 From: cp at onsitetech.com (Curtis Poe) Date: Wed Aug 4 00:05:38 2004 Subject: Variable variable name References: <007301c222e7$63805620$5b86fc83@archer> Message-ID: <007c01c222ec$11d170c0$1a01a8c0@ot.onsitetech.com> ----- Original Message ----- From: Jason White To: pdx-Pm-List@pm.org Sent: Wednesday, July 03, 2002 4:14 PM Subject: Variable variable name Here is some code. my $functionToCall = "foo"; ???????( ) sub foo(){ print "FOO!\n"; } How can I use the variable $functionToCall to replace ??????? with foo( ) ? --------------------- Jason, You don't want to use variable variable names. Here's a great explanation. http://perl.plover.com/varvarname.html http://perl.plover.com/varvarname2.html http://perl.plover.com/varvarname3.html As for what you want to do, there are several solutions. How about a dispatch table? my %dispatch_to = ( foo => \&foo, bar => \&bar, baz => \&baz ); # later if ( exists $dispatch_to{ $some_func } ) { $dispatch_to{ $some_func }->( @args ); } If you're not sure what the above does, read "perldoc perlreftut". Hope this helps! -- Cheers, Curtis Poe Senior Programmer ONSITE! Technology, Inc. www.onsitetech.com 503-233-1418 Taking e-Business and Internet Technology To The Extreme! TIMTOWTDI From russj at dimstar.net Wed Jul 3 19:06:03 2002 From: russj at dimstar.net (Russ Johnson) Date: Wed Aug 4 00:05:38 2004 Subject: sub call not getting params?? Message-ID: <20020703170603.7e0e65ef.russj@dimstar.net> I have this in a script I'm writing: foreach $tag ( @tags ) { if ( "$$tag" ) { $writer->startTag("$tag"); $writer->characters("$$tag"); $writer->endTag("$tag"); } } Which works fine. However, the part inside the if statement is repeated elsewhere, so I tried this: foreach $tag ( @tags ) { if ( "$$tag" ) { &writer( "$tag", "$$tag" ); } } sub writer { $writer->startTag("$_[0]"); $writer->characters("$_[1]"); $writer->endTag("$_[0]"); } When I run this, I get value undefined in line ### where line ### is the line with $_[0] in it. So why are my parameters not making it to writer? Thanks in advance! -- "The power to untie is stronger than the power to tie." Well, yeah, otherwise my shoes would tie themselves. --- Russ Johnson Stargate Online http://www.dimstar.net telnet://telnet.dimstar.net ICQ: 3739685:Airneil TIMTOWTDI From mark at drapple.com Wed Jul 3 19:26:06 2002 From: mark at drapple.com (Mark Hartley) Date: Wed Aug 4 00:05:38 2004 Subject: Variable variable name In-Reply-To: <007301c222e7$63805620$5b86fc83@archer>; from jasona@inetarena.com on Wed, Jul 03, 2002 at 04:14:31PM -0700 References: <007301c222e7$63805620$5b86fc83@archer> Message-ID: <20020703172606.A27948@drapple.com> On Wed, Jul 03, 2002 at 04:14:31PM -0700, Jason White wrote: > Here is some code. > > my $functionToCall = "foo"; > > ???????( ) > > sub foo(){ > > print "FOO!\n"; > > } > > > How can I use the variable $functionToCall to replace ??????? with foo( ) ? > > Jason White &$functionToCall(); (page 254 of Camel book - revision 2) :-) Mark. TIMTOWTDI From joe at joppegaard.com Wed Jul 3 19:56:51 2002 From: joe at joppegaard.com (Joe Oppegaard) Date: Wed Aug 4 00:05:38 2004 Subject: Variable variable name In-Reply-To: <007301c222e7$63805620$5b86fc83@archer> Message-ID: On Wed, 3 Jul 2002, Jason White wrote: > How can I use the variable $functionToCall to replace ??????? with foo( ) ? > You can make the variable a reference to a subroutine, then just deref it as a sub to call it, like: #!/usr/bin/perl -w use strict; my $functionToCall = \&foo; $functionToCall->(); sub foo { print "FOO!\n"; } -- -Joe Oppegaard http://joppegaard.com TIMTOWTDI From chromatic at wgz.org Wed Jul 3 20:13:04 2002 From: chromatic at wgz.org (chromatic) Date: Wed Aug 4 00:05:38 2004 Subject: Variable variable name In-Reply-To: <007301c222e7$63805620$5b86fc83@archer> References: <007301c222e7$63805620$5b86fc83@archer> Message-ID: <200207031813.04104.chromatic@wgz.org> On Wednesday 03 July 2002 16:14, Jason White wrote: > Here is some code. > > my $functionToCall = "foo"; > > ???????( ) > > sub foo(){ > > print "FOO!\n"; > > } > > > How can I use the variable $functionToCall to replace ??????? with foo( ) You could look in the symbol table for a glob of the appropriate name and check to see if there's something in the CODE slot, but I sometimes prefer can(): my $sub = UNIVERSAL::can( __PACKAGE__, $functionToCall ); $sub->() if $sub and defined &$sub; -- c TIMTOWTDI From m_pm_pdx at wickline.org Wed Jul 3 20:32:05 2002 From: m_pm_pdx at wickline.org (matthew wickline) Date: Wed Aug 4 00:05:38 2004 Subject: Variable variable name Message-ID: <3D23A595.7438FE80@wickline.org> Jason White wrote: > my $functionToCall = "foo"; > ???????( ); > sub foo( ){ print "FOO!\n"; }; I think you may want use strict; my $todo = "foo"; my %funcs = ( # hash of subroutine references 'foo' => sub { print "FOO!"; }, 'bar' => sub { print "BAR!"; }, 'baz' => sub { print "BAZ!"; }, ); &{ $funcs{$todo} }; # or $funcs{$todo}->(); or maybe you want use strict; my $todo = "foo"; sub foo() { print "FOO!"; } sub bar() { print "BAR!"; } sub baz() { print "BAZ!"; } my %funcs = ( # hash of subroutine references 'foo' => \&foo, 'bar' => \&bar, 'baz' => \&baz, ); &{ $funcs{$todo} }; # or $funcs{$todo}->(); do either of those seem like they'd work for you? see also: http://www.perldoc.com/perl5.6.1/pod/func/sub.html The first example above uses the sub BLOCK form http://www.perldoc.com/perl5.6.1/lib/strict.html what you're trying to do in the original form is a violation of stricture (unless you want to do it in a particularly funky way) because that sort of practice is more likely to lead to accidental errors that are difficult to track down. http://perldoc.com/perl5.6.1/pod/perlreftut.html http://perldoc.com/perl5.6.1/pod/perlref.html the first is a quick tutorial on references but doesn't address subroutine references. Once you've got a handle on references to scalars, arrays and hashes, move onto the second one for more info on references. ... more links provided from those resources. -matt TIMTOWTDI From tkil at scrye.com Wed Jul 3 21:36:39 2002 From: tkil at scrye.com (Tkil) Date: Wed Aug 4 00:05:38 2004 Subject: sub call not getting params?? In-Reply-To: <20020703170603.7e0e65ef.russj@dimstar.net> References: <20020703170603.7e0e65ef.russj@dimstar.net> Message-ID: >>>>> "Russ" == Russ Johnson writes: Russ> When I run this, I get value undefined in line ### where line Russ> ### is the line with $_[0] in it. So why are my parameters not Russ> making it to writer? Is $writer defined in sub writer? t. TIMTOWTDI From rb-pdx-pm at redcat.com Wed Jul 3 21:41:35 2002 From: rb-pdx-pm at redcat.com (Tom Phoenix) Date: Wed Aug 4 00:05:38 2004 Subject: sub call not getting params?? In-Reply-To: <20020703170603.7e0e65ef.russj@dimstar.net> Message-ID: On Wed, 3 Jul 2002, Russ Johnson wrote: > I have this in a script I'm writing: > > foreach $tag ( @tags ) { > if ( "$$tag" ) { Whenever I see unnecessary(?) quote marks like that, I always have to wonder whether the author thought they were functional. And, if so, what could their function possibly be? You may be thinking that they're harmless, and functionally they (probably) are. But, even if they have no other shortcomings, they're extra typing for you, and anyone else who has to look at this code has to spend extra time thinking about them. > $writer->startTag("$tag"); > $writer->characters("$$tag"); > $writer->endTag("$tag"); > } > } What's up with this indentation? I know, it sounds like I'm complaining about something that has nothing to do with functionality. But in general, the regularity of a perl program's indentation is directly proportional to the author's comprehension. So, indent properly, and you'll fool 'em all! Ah, I see it now: You're indenting everything between startTag and endTag. That's cool. It's just the curly braces that threw me off. Or, perhaps I should say, the code in the curly braces isn't indented further than the braces themselves. And I see you using $$tag. That implies that $tag is a reference to a scalar. Okay. But then what does "$tag" mean? I'm coming back to those quote marks for good reason now: If $tag is a reference, then "$tag" is a _string_ like "SCALAR(0x1234FEDC)". That's not (necessarily) useless, but it sure makes me wonder what you're doing with it. (Or maybe $tag is an object with overloaded stringification? If that's it, then the quote marks are intentional and not useless.) > Which works fine. However, the part inside the if statement is repeated > elsewhere, so I tried this: > > foreach $tag ( @tags ) { > if ( "$$tag" ) { > &writer( "$tag", "$$tag" ); > } > } Hmmm... You're passing that stringified reference as the first parameter. And I have to wonder whether you'll always be using the-same-thing-dereferenced as the second argument. Shouldn't you simply pass $tag, and let &writer() do the dereference as needed? > sub writer { > > $writer->startTag("$_[0]"); > $writer->characters("$_[1]"); > $writer->endTag("$_[0]"); > > } What's $writer at this point in the program? Some object, it seems. And from the terminology, you're probably using HTML::Parser or a similar module. (Good for you, for not trying to parse HTML directly!) But if $writer is a global (or a file-scoped my() variable), you should probably say so in a comment at the start of that sub. > When I run this, I get value undefined in line ### where line ### is the > line with $_[0] in it. So why are my parameters not making it to writer? Maybe it's $writer that's undefined. That's what I'd suspect. Did you initialize it to your parser object (or whatever)? Is it still in scope at the time of this sub's declaration? (You are using 'strict', aren't you?) Double check that it's not undef by adding a line like this at the top of the sub, just after your comment about the global-ish $writer: die "Oops: \$writer is undef" unless defined $writer; Hope this helps! --Tom Phoenix TIMTOWTDI From cfrjlr at yahoo.com Mon Jul 8 08:18:37 2002 From: cfrjlr at yahoo.com (charles radley) Date: Wed Aug 4 00:05:38 2004 Subject: Website update or lack thereof References: Message-ID: <3D29912D.83EFE353@yahoo.com> Hmm, I just noticed that the PPM meeting conflicts with the PCUsers Group. Portland PC Users Group: Erik Stromquist of Computer Technology Link talks about computer displays and other products from 7 to 9:30 p.m. at Portland Community College Workforce Training Center, Room 104, 1626 S.E. Water Ave. Free. For details, visit www.ppcug.org. Christian Brink wrote: > > > The July meeting is July 1oth chromatic will be giving a presentation titled > "Introduction to Testing with Test::More". > -------------- next part -------------- A non-text attachment was scrubbed... Name: cfrjlr.vcf Type: text/x-vcard Size: 482 bytes Desc: Card for charles radley Url : http://mail.pm.org/archives/pdx-pm-list/attachments/20020708/d5dbd53a/cfrjlr.vcf From poec at yahoo.com Mon Jul 8 09:49:02 2002 From: poec at yahoo.com (Ovid) Date: Wed Aug 4 00:05:38 2004 Subject: Fwd: Re: Website update or lack thereof Message-ID: <20020708144902.23913.qmail@web9107.mail.yahoo.com> Humph. As usual, I replied to the person and not to the list. --- Ovid wrote: > --- charles radley wrote: > > > > Hmm, I just noticed that the PPM meeting conflicts with the PCUsers Group. > > > > Portland PC Users Group: Erik Stromquist of Computer Technology Link talks about > > computer displays and other products from 7 to 9:30 p.m. at Portland Community > > College Workforce Training Center, Room 104, 1626 S.E. Water Ave. Free. For > > details, visit www.ppcug.org. > > Regrettably, the second Wednesday of every month is the only day that we could get the majority > of > people to agree on. If enough people's situation changes in the future, though, I'm willing to > reconsider this. > > Cheers, > Curtis ===== "Ovid" on http://www.perlmonks.org/ Someone asked me how to count to 10 in Perl: push@A,$_ for reverse q.e...q.n.;for(@A){$_=unpack(q|c|,$_);@a=split//; shift@a;shift@a if $a[$[]eq$[;$_=join q||,@a};print $_,$/for reverse @A __________________________________________________ Do You Yahoo!? Sign up for SBC Yahoo! Dial - First Month Free http://sbc.yahoo.com TIMTOWTDI From poec at yahoo.com Mon Jul 8 14:40:44 2002 From: poec at yahoo.com (Ovid) Date: Wed Aug 4 00:05:38 2004 Subject: Fwd: Free Books from Sams Publishing for your User Group Message-ID: <20020708194044.70586.qmail@web9103.mail.yahoo.com> Hi all, I just received an interesting email from Sam's publishing, included at the bottom of the email. Two word summary: free books. Six word question: what do we do with 'em? I'm sure that no one would object to our picking up free books, but I have to confess that Sam's can be pretty spotty quality. Some of their books are great, others leave a lot to be desired. However, rather than unilaterally making a decision on this, I thought I would pass the buck (book?) to all of you to see if anyone has any creative ideas. Random thoughts follow. 1. Establishing a pdx.pm library would be nice, but who would be the librarian, and where would the library be kept? 2. If we don't establish a library (I don't see how it would be feasible), who gets the books? I could just write back to this person and get an armload of free books, but that doesn't seem very fair. 3. Is anyone willing to write reviews on the books to post on our Web site? 4. [insert your own question here, even if you don't answer it] 5. Legal question: is this income? Do we have to declare it or anything like that? Cheers, Curtis "Ovid" Poe > Hello Curtis, > > We are writing to offer your Perl User Group an opportunity to receive an > introduction to Sams' Developer's Library Series ands other Open Source > related books. I would like to send you a selection of our best-selling > books along with some Sams' promotional materials. > > As dedicated Perl users, your feedback is very important to Sams. I hope > when you receive your kit you will take the time to review the books, and > post those reviews on your Web site and/or email them back to us. Also, > feel free to use the books and other goodies as contest or door prizes at > your meetings. > > If you are interested in receiving this box of goodies from Sams, please > reply and answer the six quick questions following my signature. > > Thanks, > > Matt Klocek and Amy Sorokas, Sams Publishing > > 6 Quick Questions: > > 1. Please provide the correct shipping address and phone number. > 2. How many members are in your group? > 3. How often do you meet? Do you have a set meeting schedule? Would > you be interested in an editor or author presenting to your group? > 4. Does your group regularly review new books? > 5. Does your group have a web site? If so, what is the web site > address? > 6. Do you have another email address that you would prefer that we send > upcoming promotions? ===== "Ovid" on http://www.perlmonks.org/ Someone asked me how to count to 10 in Perl: push@A,$_ for reverse q.e...q.n.;for(@A){$_=unpack(q|c|,$_);@a=split//; shift@a;shift@a if $a[$[]eq$[;$_=join q||,@a};print $_,$/for reverse @A __________________________________________________ Do You Yahoo!? Sign up for SBC Yahoo! Dial - First Month Free http://sbc.yahoo.com TIMTOWTDI From jasona at inetarena.com Mon Jul 8 15:12:27 2002 From: jasona at inetarena.com (Jason White) Date: Wed Aug 4 00:05:38 2004 Subject: Free Books from Sams Publishing for your User Group References: <20020708194044.70586.qmail@web9103.mail.yahoo.com> Message-ID: <003a01c226bb$c825b750$5b86fc83@archer> Ask Sam's if we can get the "online Version"of their developer series. :-) Jason White ----- Original Message ----- From: "Ovid" To: Sent: Monday, July 08, 2002 12:40 PM Subject: Fwd: Free Books from Sams Publishing for your User Group > Hi all, > > I just received an interesting email from Sam's publishing, included at the bottom of the email. > > Two word summary: free books. > Six word question: what do we do with 'em? > > I'm sure that no one would object to our picking up free books, but I have to confess that Sam's > can be pretty spotty quality. Some of their books are great, others leave a lot to be desired. > However, rather than unilaterally making a decision on this, I thought I would pass the buck > (book?) to all of you to see if anyone has any creative ideas. Random thoughts follow. > > 1. Establishing a pdx.pm library would be nice, but who would be the librarian, and where would > the library be kept? > 2. If we don't establish a library (I don't see how it would be feasible), who gets the books? I > could just write back to this person and get an armload of free books, but that doesn't seem very > fair. > 3. Is anyone willing to write reviews on the books to post on our Web site? > 4. [insert your own question here, even if you don't answer it] > 5. Legal question: is this income? Do we have to declare it or anything like that? > > Cheers, > Curtis "Ovid" Poe > > > Hello Curtis, > > > > We are writing to offer your Perl User Group an opportunity to receive an > > introduction to Sams' Developer's Library Series ands other Open Source > > related books. I would like to send you a selection of our best-selling > > books along with some Sams' promotional materials. > > > > As dedicated Perl users, your feedback is very important to Sams. I hope > > when you receive your kit you will take the time to review the books, and > > post those reviews on your Web site and/or email them back to us. Also, > > feel free to use the books and other goodies as contest or door prizes at > > your meetings. > > > > If you are interested in receiving this box of goodies from Sams, please > > reply and answer the six quick questions following my signature. > > > > Thanks, > > > > Matt Klocek and Amy Sorokas, Sams Publishing > > > > 6 Quick Questions: > > > > 1. Please provide the correct shipping address and phone number. > > 2. How many members are in your group? > > 3. How often do you meet? Do you have a set meeting schedule? Would > > you be interested in an editor or author presenting to your group? > > 4. Does your group regularly review new books? > > 5. Does your group have a web site? If so, what is the web site > > address? > > 6. Do you have another email address that you would prefer that we send > > upcoming promotions? > > > ===== > "Ovid" on http://www.perlmonks.org/ > Someone asked me how to count to 10 in Perl: > push@A,$_ for reverse q.e...q.n.;for(@A){$_=unpack(q|c|,$_);@a=split//; > shift@a;shift@a if $a[$[]eq$[;$_=join q||,@a};print $_,$/for reverse @A > > __________________________________________________ > Do You Yahoo!? > Sign up for SBC Yahoo! Dial - First Month Free > http://sbc.yahoo.com > TIMTOWTDI > TIMTOWTDI From rb-pdx-pm at redcat.com Mon Jul 8 15:39:55 2002 From: rb-pdx-pm at redcat.com (Tom Phoenix) Date: Wed Aug 4 00:05:38 2004 Subject: Fwd: Free Books from Sams Publishing for your User Group In-Reply-To: <20020708194044.70586.qmail@web9103.mail.yahoo.com> Message-ID: On Mon, 8 Jul 2002, Ovid wrote: > 2. If we don't establish a library (I don't see how it would be > feasible), who gets the books? We could raffle them off or whatever, then use the resulting funds to pay for refreshments^Wmeeting supplies. > 5. Legal question: is this income? Do we have to declare it or > anything like that? Well, you said they were from SAMS... So let's just say that they're worthless. :-) To me, it seems no different than other in-kind donations that the group has (tacitly) accepted: the meeting space and refreshments from onsite, the waived presentation fees, web hosting and web page maintenance, and anything else I can't think of right now. If you're worried, we could draw up a charter as a non-profit. (pm.org should give user groups a sample charter; maybe we should suggest that to them.) It sure sounds as if SAMS is fishing for reviews. Not that there's anything wrong with that. But if (_if_) somebody wants to review these and post the review on the website, then (A) the reviewer should get to keep the reviewed book and (B) we should get at least one other publisher to contribute books. I'm pretty sure that we could get at least two publishers from the set { O'Reilly, Manning, Addison Wesley } to match the contribution. But it sounds like more trouble than it's worth, unless somebody out there really wants some free books. --Tom TIMTOWTDI From joe at joppegaard.com Mon Jul 8 17:09:07 2002 From: joe at joppegaard.com (Joe Oppegaard) Date: Wed Aug 4 00:05:38 2004 Subject: Fwd: Free Books from Sams Publishing for your User Group In-Reply-To: <20020708194044.70586.qmail@web9103.mail.yahoo.com> Message-ID: On Mon, 8 Jul 2002, Ovid wrote: > 1. Establishing a pdx.pm library would be nice, but who would be the librarian, and where would > the library be kept? Every month someone could volunteer to hold on to the books until the next meeting, and if anyone wanted to use one, whoever was the "librarian" that month could setup a place to meet and exchange books. > 2. If we don't establish a library (I don't see how it would be feasible), who gets the books? I > could just write back to this person and get an armload of free books, but that doesn't seem very > fair. I think the solution above would take care of this. Although, maybe it should be someone who has been around the meeting at least a few times. They also should probably leave some type of contact information (besides email) where someone could get a hold of them to pick up the books if they couldn't make it to the next meeting or whatever. > 3. Is anyone willing to write reviews on the books to post on our Web site? Hard to say, maybe if we saw the titles. I for one would be willing to write reviews for a free book or two. ;) > 4. [insert your own question here, even if you don't answer it] 4. Would people be willing to volunteer to hold on to the books and be responsible for getting them to people who want them? I would expect the common way to deal with that would be for whomever wants the book to make it as easy as possible for the librarian. On Mon, 8 Jul 2002, Tom Phoenix wrote: > But if (_if_) somebody wants to review these and > post the review on the website, then (A) the reviewer should get to keep > the reviewed book and (B) we should get at least one other publisher to > contribute books. I'm pretty sure that we could get at least two > publishers from the set { O'Reilly, Manning, Addison Wesley } to match the > contribution. If that happened, it sounds like this could be a pretty worth while endevor. > But it sounds like more trouble than it's worth, unless > somebody out there really wants some free books. Although, this could turn out to be true also. -- -Joe Oppegaard http://joppegaard.com TIMTOWTDI From lancem at colubs.com Mon Jul 8 17:42:45 2002 From: lancem at colubs.com (Lance Mazon) Date: Wed Aug 4 00:05:38 2004 Subject: Fwd: Free Books from Sams Publishing for your User Group In-Reply-To: Message-ID: I'm a lurker who has yet to attend a meeting, but even so, perhaps a previous experience of mine could help out... A user group I was a member of had both a software and a book library. One person was designated as the Librarian. Basically, this person was responsible for maintaining the libraries. The software library was brought to each monthly meeting, along with a catalog of all books available. If somebody wanted a book from the library, they informed the librarian which book they wanted, and the book was either brought to the next meeting, or the user could travel to the librarian's house if the need was urgent. This worked out well because the software was easily loaded into a small vehicle in less then a couple minutes, and the librarian wasn't constantly lugging the books around. They kept them in a nice secure place, and everybody was happy. Now the other side of the story: Nobody ever checked out books. Occasionally somebody would browse the list and request a book be brought to the next meeting, but, chances are the librarian would forget(which annoyed the user), or the user wouldn't need the book anymore(which annoyed the librarian). I guess what I'm trying to say is that the idea of an online version of the books being maintained is probably much more feasible. Hardcopy books are great, but usually are needed "now", and the typical user will either go buy the needed book, or borrow it from a friend or local library rather than wait for the next meeting to come around. Lance Mazon lancem@colubs.com Senior Programmer - R&D Columbia Ultimate, Inc. > -----Original Message----- > From: owner-pdx-pm-list@pm.org [mailto:owner-pdx-pm-list@pm.org]On > Behalf Of Joe Oppegaard > Sent: Monday, July 08, 2002 3:09 PM > To: Ovid > Cc: pdx-Pm-List@pm.org > Subject: Re: Fwd: Free Books from Sams Publishing for your User Group > > > On Mon, 8 Jul 2002, Ovid wrote: > > > 1. Establishing a pdx.pm library would be nice, but who would > be the librarian, and where would > > the library be kept? > > Every month someone could volunteer to hold on to the books until the > next meeting, and if anyone wanted to use one, whoever was the > "librarian" that month could setup a place to meet and exchange books. > > > 2. If we don't establish a library (I don't see how it would > be feasible), who gets the books? I > > could just write back to this person and get an armload of free > books, but that doesn't seem very > > fair. > > I think the solution above would take care of this. Although, maybe it > should be someone who has been around the meeting at least a few times. > They also should probably leave some type of contact information > (besides email) where someone could get a hold of them to pick up the > books if they couldn't make it to the next meeting or whatever. > > > 3. Is anyone willing to write reviews on the books to post on > our Web site? > > Hard to say, maybe if we saw the titles. I for one would be > willing to write > reviews for a free book or two. ;) > > > 4. [insert your own question here, even if you don't answer it] > 4. Would people be willing to volunteer to hold on to the books and be > responsible for getting them to people who want them? > > I would expect the common way to deal with that would be for whomever > wants the book to make it as easy as possible for the librarian. > > On Mon, 8 Jul 2002, Tom Phoenix wrote: > > But if (_if_) somebody wants to review these and > > post the review on the website, then (A) the reviewer should get to keep > > the reviewed book and (B) we should get at least one other publisher to > > contribute books. I'm pretty sure that we could get at least two > > publishers from the set { O'Reilly, Manning, Addison Wesley } > to match the > > contribution. > > If that happened, it sounds like this could be a pretty worth > while endevor. > > > But it sounds like more trouble than it's worth, unless > > somebody out there really wants some free books. > > Although, this could turn out to be true also. > > -- > -Joe Oppegaard > http://joppegaard.com > > > TIMTOWTDI TIMTOWTDI From gcheong at acm.org Mon Jul 8 19:00:45 2002 From: gcheong at acm.org (Greg Cheong) Date: Wed Aug 4 00:05:38 2004 Subject: Free Books from Sams Publishing for your User Group References: <20020708194044.70586.qmail@web9103.mail.yahoo.com> Message-ID: <001b01c226db$af3b7d40$6501a8c0@isolde> I think the overhead of maintaining the library (finding a physical location, having the books available, passing the books on to another librarian) would be too much compared to the benefits of getting free books from SAMS, or any publisher really. I would suggest the following process: 1. The list of books available for review are posted to the group. 2. Those who really want a particular book can request to review it. First come first serve basis. 3. The left-overs are raffled off one by one at each subsequent meeting. Just my two cents. Cheers, Greg TIMTOWTDI From cp at onsitetech.com Tue Jul 9 15:26:26 2002 From: cp at onsitetech.com (Curtis Poe) Date: Wed Aug 4 00:05:38 2004 Subject: Fw: Mailing list Message-ID: <00af01c22786$e68545f0$1a01a8c0@ot.onsitetech.com> Just to underscore the point of this email that I sent this morning but it appears no one received... Note: this is not the first time that I have sent an email to the list that never arrived. Has anyone else experienced similar problems? If not, I'll see if I can discover anything on my end. ----- Original Message ----- From: "Curtis Poe" To: Sent: Tuesday, July 09, 2002 10:28 AM Subject: Mailing list > Here's the scoop: when the person who was previously running pdx.pm left, > he did not provide any passwords to the pm.org server or to the majordomo > mailing list. I have the pm.org issue cleared up (otherwise, there wouldn't > be a Web site), but I have never had admin access to majordomo. > > Frankly, I'm not sure that I need the access, but I've had some email from > people wanting to remove me from the list. In fact, I received an email > from someone who refused to answer whether or not they had followed my > directions, but instead kept insisting that things are "broken" if I can't > just unsubscribe them. > > Here's the exchange: > > --- Ovid --- > When you say "actually functions correctly", does that > mean that the majordomo unsubscribe information that I > gave in the last email doesn't work? If that's the case, > I'd like to know rather than spread bad information. > > --- the response --- > Bascially [sic] if you cannot get in - passwordwise - to > correct an error or tweak something, it is not functioning > correctly. > > I actually gave this person unsubscribe details twice, but at no time was I > informed as to whether or not they followed the instructions (and yes, I > know that "they" is considered grammatically incorrect :) > > Rather than run the risk of alienating further users, I am proposing > creating a new list and, when this is working well, taking down the old one. > I'd handle subscribing everyone to the new list, so no action would be > required on your part other than confirming the subscription. > > Benefits: > > 1. I'll actually be administering the list and not just a participant. > 2. Bad addresses will be automatically culled from the list (maybe not that > big of a deal?). > 3. I may even be able to set up a list archive. > > Does this sound worthwhile? Some adhere to the notion "if it ain't broke, > don't fix it". Of course, this is all mute if someone knows how to contact > Paul (masque) and get the passwords for me... > > -- > Cheers, > Curtis Poe > Senior Programmer > ONSITE! Technology, Inc. > www.onsitetech.com > 503-233-1418 > > Taking e-Business and Internet Technology To The Extreme! > TIMTOWTDI From akilbey at ci.portland.or.us Tue Jul 9 16:07:01 2002 From: akilbey at ci.portland.or.us (Kilbey, Aaron) Date: Wed Aug 4 00:05:38 2004 Subject: Lynx??? Message-ID: <8B10C83D6E9FD211B1670090272A69E109B90B7E@city04.bit.city> Aloha everybody - I'm attempting to issue an http request through lynx to save an XML file to a local server. Here's the code: ---------------------------------------------------------------------------- ---------- Newsdump.pl ---------------------------------------------------------------------------- ---------- #!/usr/bin/perl system("lynx -dump http://www.moreover.com/cgi-local/page?feed=239&o=xml > news.xml"); ---------------------------------------------------------------------------- ---------- 1. When I do: "bash$ perl newsdump.pl" I get a zero length news.xml 2. When I do: "bash$ perl newsdump.pl > news.xml" I get a news.xml that is a numbered list of the news links which is not XML. 3. When I run http://www.moreover.com/cgi-local/page?feed=239&o=xml in a web browser, I get the XML document. I need to have the ability to call this script to automatically retrieve and save the new file. Please help. -Aaron Kilbey TIMTOWTDI From merlyn at stonehenge.com Tue Jul 9 16:08:56 2002 From: merlyn at stonehenge.com (Randal L. Schwartz) Date: Wed Aug 4 00:05:38 2004 Subject: Fw: Mailing list In-Reply-To: <00af01c22786$e68545f0$1a01a8c0@ot.onsitetech.com> References: <00af01c22786$e68545f0$1a01a8c0@ot.onsitetech.com> Message-ID: <86d6twmwwn.fsf@blue.stonehenge.com> >>>>> "Curtis" == Curtis Poe writes: >> Here's the scoop: when the person who was previously running pdx.pm left, >> he did not provide any passwords to the pm.org server or to the majordomo >> mailing list. I have the pm.org issue cleared up (otherwise, there Curtis> wouldn't >> be a Web site), but I have never had admin access to majordomo. There are people a short email distance away that have access to the majordomo. There's no need to set up a new list. -- 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! TIMTOWTDI From cb at onsitetech.com Tue Jul 9 16:09:48 2002 From: cb at onsitetech.com (Christian Brink) Date: Wed Aug 4 00:05:38 2004 Subject: REPEAT: Website update or lack thereof Message-ID: Since the website is still not available I thought I would send a reminder about the July Meeting: It seems pm.org was hacked http://www.pm.org/whynologin.html and will not allow me to update the site (albeit I'm already late updating it). So I thought I would resend the meeting info. The July meeting is July 10th chromatic will be giving a presentation titled "Introduction to Testing with Test::More". Test::More is available in the Test::Simple distribution available from CPAN - http://theoryx5.uwinnipeg.ca/scripts/CPAN/authors/id/M/MS/MSCHWERN/Test-Simp le-0.45.tar.gz chromatic is a frequent contributor to Perl and the Perl community. He joined the Perl QA group after being chastised for breaking bleadperl by not testing a proposed patch. In the past year, he has added tests for many of the core modules, and wrote the backend Test::Builder module. Additionally, he co-wrote "Running Weblogs with Slash" and may have another book about software development and Perl up his sleeve. Place: Onsite! Technology, Inc. Address: 333 SE 3rd, Portland, OR Date and Time: 2002-07-10 at 7:00 PM URL: www.onsitetech.com There will be a social meeting at Rose and Raindrop at 6:00 PM. The address is 532 S.E. Grand and it's about 3 blocks from the Onsite! Technology offices. Christian Brink CTO ONSITE! Technology www.onsitetech.com 503.233.1418 cb@onsitetech.com Taking e-Business and Internet Technology To The Extreme! TIMTOWTDI From cp at onsitetech.com Tue Jul 9 16:19:17 2002 From: cp at onsitetech.com (Curtis Poe) Date: Wed Aug 4 00:05:38 2004 Subject: Fw: Mailing list References: <00af01c22786$e68545f0$1a01a8c0@ot.onsitetech.com> <86d6twmwwn.fsf@blue.stonehenge.com> Message-ID: <00e001c2278e$48839f20$1a01a8c0@ot.onsitetech.com> ----- Original Message ----- > >>>>> "Curtis" == Curtis Poe writes: > > >> Here's the scoop: when the person who was previously running pdx.pm left, > >> he did not provide any passwords to the pm.org server or to the majordomo > >> mailing list. I have the pm.org issue cleared up (otherwise, there > Curtis> wouldn't > >> be a Web site), but I have never had admin access to majordomo. > > There are people a short email distance away that have access > to the majordomo. There's no need to set up a new list. I suspected that, but the email I received when I started pdx.pm back up implied (to me, at least) that I needed to start the list over if I needed administrative control. I guess I should have read more closely. I'll check that out. Cheers, Curtis TIMTOWTDI From aaronkilbey at hotmail.com Tue Jul 9 16:29:56 2002 From: aaronkilbey at hotmail.com (Aaron Kilbey) Date: Wed Aug 4 00:05:38 2004 Subject: FW: Lynx??? Message-ID: <8B10C83D6E9FD211B1670090272A69E10A8949AF@city04.bit.city> Aloha everybody - I'm attempting to issue an http request through lynx to save an XML file to a local server. Here's the code: ------------------------------------------------------------------------ newsdump.pl ------------------------------------------------------------------------ #!/usr/bin/perl system("lynx -dump http://www.moreover.com/cgi-local/page?feed=239&o=xml > news.xml"); ------------------------------------------------------------------------ 1. When I do: "bash$ perl newsdump.pl" I get a zero length news.xml 2. When I do: "bash$ perl newsdump.pl > news.xml" I get a news.xml that is a numbered list of the news links which is not XML. 3. When I run http://www.moreover.com/cgi-local/page?feed=239&o=xml in a web browser, I get the XML document. I need to have the ability to call this script to automatically retrieve and save the new file. Please help. -Aaron Kilbey TIMTOWTDI From merlyn at stonehenge.com Tue Jul 9 16:29:54 2002 From: merlyn at stonehenge.com (Randal L. Schwartz) Date: Wed Aug 4 00:05:38 2004 Subject: REPEAT: Website update or lack thereof In-Reply-To: References: Message-ID: <868z4kmvxp.fsf@blue.stonehenge.com> >>>>> "Christian" == Christian Brink writes: Christian> Place: Onsite! Technology, Inc. Christian> Address: 333 SE 3rd, Portland, OR Christian> Date and Time: 2002-07-10 at 7:00 PM Christian> URL: www.onsitetech.com I'll be bringing my AirPort again for anyone who wants to be rude and read their email or play nethack during the presentation. :-) -- 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! TIMTOWTDI From tex at off.org Tue Jul 9 16:32:21 2002 From: tex at off.org (Austin Schutz) Date: Wed Aug 4 00:05:38 2004 Subject: Lynx??? In-Reply-To: <8B10C83D6E9FD211B1670090272A69E109B90B7E@city04.bit.city>; from akilbey@ci.portland.or.us on Tue, Jul 09, 2002 at 02:07:01PM -0700 References: <8B10C83D6E9FD211B1670090272A69E109B90B7E@city04.bit.city> Message-ID: <20020709143221.A29857@gblx.net> On Tue, Jul 09, 2002 at 02:07:01PM -0700, Kilbey, Aaron wrote: > Aloha everybody - > I'm attempting to issue an http request through lynx to save an XML file to > a local server. > Here's the code: > > ---------------------------------------------------------------------------- > ---------- > Newsdump.pl > ---------------------------------------------------------------------------- > ---------- > #!/usr/bin/perl > > system("lynx -dump http://www.moreover.com/cgi-local/page?feed=239&o=xml > > news.xml"); > ---------------------------------------------------------------------------- > ---------- > > 1. When I do: "bash$ perl newsdump.pl" I get a zero length news.xml Try running it in a shell. You'll see it try run lynx in the background. This is probably not the desired behavior. Try: system( "lynx -dump " . "'http://www.moreover.com/cgi-local/page?feed=239&o=xml'" . " > news.xml" ); where the ampersand is quoted. See perldoc -f system, and note the bits about sh -c. Austin TIMTOWTDI From poec at yahoo.com Tue Jul 9 16:37:37 2002 From: poec at yahoo.com (Ovid) Date: Wed Aug 4 00:05:38 2004 Subject: FW: Lynx??? In-Reply-To: <8B10C83D6E9FD211B1670090272A69E10A8949AF@city04.bit.city> Message-ID: <20020709213737.27442.qmail@web9104.mail.yahoo.com> --- Aaron Kilbey wrote: > Aloha everybody - > > I'm attempting to issue an http request through lynx to save an XML file > to a local server. > Here's the code: > > ------------------------------------------------------------------------ > newsdump.pl > ------------------------------------------------------------------------ > #!/usr/bin/perl > > system("lynx -dump http://www.moreover.com/cgi-local/page?feed=239&o=xml > > news.xml"); A more portable solution: use LWP::Simple; getstore( $url, $file ); Or better: mirror( $url, $file ); You can verify this from the command line: perl -MLWP::Simple -e 'getprint("http://www.moreover.com/cgi-local/page?feed=239&o=xml")' You'll also want to check the is_success() function in that module. Cheers, Curtis "Ovid" Poe ===== "Ovid" on http://www.perlmonks.org/ Someone asked me how to count to 10 in Perl: push@A,$_ for reverse q.e...q.n.;for(@A){$_=unpack(q|c|,$_);@a=split//; shift@a;shift@a if $a[$[]eq$[;$_=join q||,@a};print $_,$/for reverse @A __________________________________________________ Do You Yahoo!? Sign up for SBC Yahoo! Dial - First Month Free http://sbc.yahoo.com TIMTOWTDI From joshua_keroes at eli.net Tue Jul 9 16:37:33 2002 From: joshua_keroes at eli.net (Joshua Keroes) Date: Wed Aug 4 00:05:38 2004 Subject: FW: Lynx??? In-Reply-To: <8B10C83D6E9FD211B1670090272A69E10A8949AF@city04.bit.city> References: <8B10C83D6E9FD211B1670090272A69E10A8949AF@city04.bit.city> Message-ID: <20020709213733.GH10607@eli.net> If that's all you're doing, a shell script will suffice: #!/bin/sh lynx -dump "http://www.moreover.com/cgi-local/page?feed=239&o=xml" > news.xml If you intend on doing something else with the data, perl is keen. Here's a one-liner to do the same thing, kinda. This one accepts the url as an argument and lets you redirect the output to a file of your choosing. perl -MLWP::Simple -e "getprint(shift)" \ "http://www.moreover.com/cgi-local/page?feed=239&o=xml" \ > news.xml (n.b. the URL has an '&' in it and needed to be quoted) -Joshua On (Tue, Jul 09 14:29), Aaron Kilbey wrote: > Aloha everybody - > > I'm attempting to issue an http request through lynx to save an XML file > to a local server. > Here's the code: > > ------------------------------------------------------------------------ > newsdump.pl > ------------------------------------------------------------------------ > #!/usr/bin/perl > > system("lynx -dump http://www.moreover.com/cgi-local/page?feed=239&o=xml > > news.xml"); > ------------------------------------------------------------------------ > > > 1. When I do: "bash$ perl newsdump.pl" I get a zero length news.xml > > 2. When I do: "bash$ perl newsdump.pl > news.xml" I get a news.xml that > is a numbered list of the news links which is not XML. > > 3. When I run http://www.moreover.com/cgi-local/page?feed=239&o=xml in a > web browser, I get the XML document. > > I need to have the ability to call this script to automatically retrieve > and save the new file. Please help. > > > -Aaron Kilbey > > TIMTOWTDI TIMTOWTDI From tkil at scrye.com Tue Jul 9 17:10:24 2002 From: tkil at scrye.com (Tkil) Date: Wed Aug 4 00:05:38 2004 Subject: FW: Lynx??? In-Reply-To: <8B10C83D6E9FD211B1670090272A69E10A8949AF@city04.bit.city> References: <8B10C83D6E9FD211B1670090272A69E10A8949AF@city04.bit.city> Message-ID: >>>>> "Aaron" == Aaron Kilbey writes: Aaron> I'm attempting to issue an http request through lynx to save an Aaron> XML file to a local server. Here's the code: um... why not just use LWP [http://www.linpro.no/lwp/] ? either LWP::Simple::getstore, or the command-line program of the same name: | $ perl -MLWP::Simple=getstore \ | -lwe 'getstore "http://www.perl.com/", "perl-com.html"' | $ ls -al perl-com.html | -rw-rw-r-- 1 tkil tkil 39697 Jul 9 16:06 perl-com.html f you're just going to read it in, you can also fetch directly to memory with "get", from the same package: | $ perl -MLWP::Simple=get \ | -lwe 'my $s = get "http://www.perl.com/"; print length $s' | 39697 if you really must use an external program, consider "wget": | $ wget -O perl-com-2.html http://www.perl.com/ | --16:08:06-- http://www.perl.com/ | => `perl-com-2.html' | Connecting to www.perl.com:80... connected! | HTTP request sent, awaiting response... 200 OK | Length: unspecified [text/html] | | 0K .......... .......... .......... ........ @ 52.46 KB/s | | 16:08:07 (52.39 KB/s) - `perl-com-2.html' saved [39697] | | $ ls -al perl-com-2.html | -rw-rw-r-- 1 tkil tkil 39697 Jul 9 16:08 perl-com-2.html t. TIMTOWTDI From ckuskie at dalsemi.com Tue Jul 9 17:29:21 2002 From: ckuskie at dalsemi.com (Colin Kuskie) Date: Wed Aug 4 00:05:38 2004 Subject: Problems parsing with Parse::RecDescent Message-ID: <20020709152921.A24733@dalsemi.com> I'm having problems trying to grok Parse::RecDescent. As part of a much larger grammar, I'm trying to parse lines that look like these: Xname node1 node2 node3 model Xname node1 node2 node3 model parName=parValue parName=parValue with this set of rules: #!/usr/bin/perl -w use strict; use lib '~/perl/modules'; use Parse::RecDescent; use Data::Dumper; my ($dump,$tree) = (0,0); $Data::Dumper::Purity = 1; $RD_HINT = 1; my $grammar = <<'EOGRAMMAR'; #rules netlist : element(s) element : comment_line | subckt comment_line : '*' comment { bless { comment => $item{comment} }, $item[0] } subckt : /x/i name node(s) /.*/ "\n" { bless { name => $item{name}, nodes => $item{node} }, $item[0] } node : /\w+/ { $item[1] } name : /\w+/ { $item[1] } comment : /.*/ { $item[1] } EOGRAMMAR #---------------------------------------------------------------- my $parse = Parse::RecDescent->new($grammar) or die "bad grammar"; undef $/; my $text = <netlist($text) or die "bad netlist"; print Dumper($net); -------------------------------------------------------------- The output is generates says it parses all the "comment" lines, but fails to parse any of the "subckt" lines: $VAR1 = [ bless( { 'comment' => '# FILE NAME: /DESIGN/NWDC/NEWDESIGN/DSB17/SIM/HSPICE/CKUSKIE/' }, 'comment_line' ), bless( { 'comment' => 'translinear1/hspiceS/schematic/netlist/translinear1.c.raw' }, 'comment_line' ), bless( { 'comment' => 'Netlist output for hspiceS.' }, 'comment_line' ), bless( { 'comment' => 'Generated on Jul 5 14:17:15 2002' }, 'comment_line' ), bless( { 'comment' => 'File name: DSB17_translinear1_schematic.S.' }, 'comment_line' ), bless( { 'comment' => 'Subcircuit for cell: translinear1.' }, 'comment_line' ), bless( { 'comment' => 'Generated for: hspiceS.' }, 'comment_line' ), bless( { 'comment' => 'Generated on Jul 5 14:17:15 2002.' }, 'comment_line' ) ]; Does anybody have any ideas about a better grammar to use? Colin TIMTOWTDI From merlyn at stonehenge.com Tue Jul 9 17:38:06 2002 From: merlyn at stonehenge.com (Randal L. Schwartz) Date: Wed Aug 4 00:05:38 2004 Subject: FW: Lynx??? In-Reply-To: <20020709213737.27442.qmail@web9104.mail.yahoo.com> References: <20020709213737.27442.qmail@web9104.mail.yahoo.com> Message-ID: <864rf8mss1.fsf@blue.stonehenge.com> >>>>> "Ovid" == Ovid writes: Ovid> A more portable solution: Ovid> use LWP::Simple; Ovid> getstore( $url, $file ); Ovid> Or better: Ovid> mirror( $url, $file ); Or better: lwp-download http://what.ever/that/file/is.xml That's installed when you install LWP. -- 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! TIMTOWTDI From merlyn at stonehenge.com Tue Jul 9 17:42:38 2002 From: merlyn at stonehenge.com (Randal L. Schwartz) Date: Wed Aug 4 00:05:38 2004 Subject: Problems parsing with Parse::RecDescent In-Reply-To: <20020709152921.A24733@dalsemi.com> References: <20020709152921.A24733@dalsemi.com> Message-ID: <86y9ckle01.fsf@blue.stonehenge.com> >>>>> "Colin" == Colin Kuskie writes: Colin> I'm having problems trying to grok Parse::RecDescent. I didn't see anything immediately obvious in your grammar, but I'd try turning on tracing, and also posting to the P::RD mailing list (see lists.perl.org). -- 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! TIMTOWTDI From ckuskie at dalsemi.com Tue Jul 9 18:35:34 2002 From: ckuskie at dalsemi.com (Colin Kuskie) Date: Wed Aug 4 00:05:38 2004 Subject: Problems parsing with Parse::RecDescent In-Reply-To: <86y9ckle01.fsf@blue.stonehenge.com>; from merlyn@stonehenge.com on Tue, Jul 09, 2002 at 03:42:38PM -0700 References: <20020709152921.A24733@dalsemi.com> <86y9ckle01.fsf@blue.stonehenge.com> Message-ID: <20020709163534.E24733@dalsemi.com> On Tue, Jul 09, 2002 at 03:42:38PM -0700, Randal L. Schwartz wrote: > >>>>> "Colin" == Colin Kuskie writes: > > Colin> I'm having problems trying to grok Parse::RecDescent. > > I didn't see anything immediately obvious in your grammar, > but I'd try turning on tracing, and also posting to the P::RD > mailing list (see lists.perl.org). $RD_TRACE redefines verbosity, and it also shows the problem. I kept playing with the grammar while waiting for the perl.org autoresponder. Here's the gist of it: tells the parser what characters to skip _before_ tokens, not after them. Just before the subckt subrule is tried, here's what in the "stack": "\nXP2 VDD VOUT PBBAS IOUT PCH4_D6W_1 \nXP2a VDD VOUT PBBAS IOUT PCH4_D6W_1 M=1.0\nXP1 VDD IOUT N2 VDD PCH4_D6W_1 M=1.0\nXP0 VDD N2 N2 VDD PCH4_D6W_1 M=1.0\nXQ4 IINP N2 IT2 AGND NPN8P0_D6W_G1 M=5.0\nXQ3 IREF IOUT IT2 AGND NPN8P0_D6W_G1 M=5.0\nXQ2 IT1 IT1 IREF AGND NPN8P0_D6W_G1 M=5.0\nXQ1 IT1 IT1 IINP AGND NPN8P0_D6W_G1 M=5.0\n" Note that leading "\n", which is the newline left over from the last comment line. The skip in the subckt production says to make "\n" significant, and since it doesn't match /x/i, the subckt subrule fails. Now I just need to keep chopping away. Even though I took Damian's class last August when he has at OGI, I'm finding that it taught me how to tweak the knobs and that I still don't understand how the beast in the box works. In other words, I don't know how to tell the parser how to do it's job right :) Colin TIMTOWTDI From rb-pdx-pm at redcat.com Wed Jul 10 07:40:19 2002 From: rb-pdx-pm at redcat.com (Tom Phoenix) Date: Wed Aug 4 00:05:38 2004 Subject: Fw: Mailing list In-Reply-To: <00af01c22786$e68545f0$1a01a8c0@ot.onsitetech.com> Message-ID: On Tue, 9 Jul 2002, Curtis Poe wrote: > Note: this is not the first time that I have sent an email to the list that > never arrived. Has anyone else experienced similar problems? Sometimes Majordomo, rather than forwarding something directly out to the list, sends it to the list owner for manual approval. (Of course, that means that they're lost forever, for this list. :-) I don't remember all of the special bounces, but one of the rules tries to keep uns*bscribe requests from going out to the list. If the first few lines of your message have that offensive word, as your original did, it's time for the list owner to step in, 'cause Majordomo thinks you might be saying "Please uns*bscribe me from this list!" Just one of the joys that is Majordomo...! --Tom TIMTOWTDI From aaronkilbey at hotmail.com Wed Jul 10 12:00:14 2002 From: aaronkilbey at hotmail.com (Aaron Kilbey) Date: Wed Aug 4 00:05:38 2004 Subject: Lynx??? Message-ID: <8B10C83D6E9FD211B1670090272A69E10A8949B6@city04.bit.city> So I used the following from yesterday: --------------------------------------- newsdump.pl --------------------------------------- $url="http://www.moreover.com/cgi-local/page?feed=239\&o=xml"; $file="news.xml"; use LWP::Simple; &getstore( $url, $file ); --------------------------------------- ...and when I run "bash$ perl newsdump.pl" it writes news.xml fine, but when I try to do http://myserver/cgi-bin/newsdump.pl in a web browser, news.xml is not updated ??? - a. -----Original Message----- From: Ovid [mailto:poec@yahoo.com] Sent: Tuesday, July 09, 2002 2:38 PM To: Aaron Kilbey; pdx-pm-list@pm.org Subject: Re: FW: Lynx??? --- Aaron Kilbey wrote: > Aloha everybody - > > I'm attempting to issue an http request through lynx to save an XML file > to a local server. > Here's the code: > > ------------------------------------------------------------------------ > newsdump.pl > ------------------------------------------------------------------------ > #!/usr/bin/perl > > system("lynx -dump http://www.moreover.com/cgi-local/page?feed=239&o=xml > > news.xml"); A more portable solution: use LWP::Simple; getstore( $url, $file ); Or better: mirror( $url, $file ); You can verify this from the command line: perl -MLWP::Simple -e 'getprint("http://www.moreover.com/cgi-local/page?feed=239&o=xml")' You'll also want to check the is_success() function in that module. Cheers, Curtis "Ovid" Poe ===== "Ovid" on http://www.perlmonks.org/ Someone asked me how to count to 10 in Perl: push@A,$_ for reverse q.e...q.n.;for(@A){$_=unpack(q|c|,$_);@a=split//; shift@a;shift@a if $a[$[]eq$[;$_=join q||,@a};print $_,$/for reverse @A __________________________________________________ Do You Yahoo!? Sign up for SBC Yahoo! Dial - First Month Free http://sbc.yahoo.com TIMTOWTDI TIMTOWTDI From joshua_keroes at eli.net Wed Jul 10 12:16:21 2002 From: joshua_keroes at eli.net (Joshua Keroes) Date: Wed Aug 4 00:05:38 2004 Subject: Lynx??? In-Reply-To: <8B10C83D6E9FD211B1670090272A69E10A8949B6@city04.bit.city> References: <8B10C83D6E9FD211B1670090272A69E10A8949B6@city04.bit.city> Message-ID: <20020710171621.GN10607@eli.net> Look in your web server's error log. Lots of well, errors and stuff end up there. :-) Are you sure that the webserver has enough access (read: permissions) to change news.xml? Chances are: the webserver is run as "nobody" and you last touched the file as "akilbey" or something. Do you realize that your script won't display a success or failure webpage? You'll need to dynamically write a webpage in this program for that sort of behaviour. See these CGI tutorials for info. Ooh, and lookee! Ovid has a tutorial of his own up there in neon lights and all! http://www.cgi-resources.com/Documentation/CGI_Tutorials/ -Joshua On (Wed, Jul 10 10:00), Aaron Kilbey wrote: > So I used the following from yesterday: > > --------------------------------------- > newsdump.pl > --------------------------------------- > $url="http://www.moreover.com/cgi-local/page?feed=239\&o=xml"; > $file="news.xml"; > > use LWP::Simple; > &getstore( $url, $file ); > --------------------------------------- > > ...and when I run "bash$ perl newsdump.pl" it writes news.xml fine, but > when I try to do http://myserver/cgi-bin/newsdump.pl in a web browser, > news.xml > is not updated ??? - a. TIMTOWTDI From karic at lclark.edu Wed Jul 10 12:19:11 2002 From: karic at lclark.edu (Kari Chisholm) Date: Wed Aug 4 00:05:38 2004 Subject: private usenet servers References: <8B10C83D6E9FD211B1670090272A69E10A8949B6@city04.bit.city> Message-ID: <3D2C6C8F.F760323F@lclark.edu> Hey-- A colleague of mine is looking for a "linux pro" to set up a private usenet server, with global access via passwords. In other words, he wants to host his own private newsgroups, but provide access via password. If you, or anyone you know, has done such a thing, please contact me off-list and we'll see if we can't get you some work. -kari. TIMTOWTDI From chromatic at wgz.org Wed Jul 10 23:56:25 2002 From: chromatic at wgz.org (chromatic) Date: Wed Aug 4 00:05:38 2004 Subject: Introduction to Testing with Test::More Message-ID: <200207102156.25602.chromatic@wgz.org> Hi everyone, I've put the slides from tonight's presentation on my website. You're welcome to download them. (I did correct the one error I noticed in the slides, but not the potential error in Test::More.) http://wgz.org/chromatic/perl/IntroTestMore.pdf You're also welcome to read the two articles I've written for Perl.com. They should be tackled in order: http://www.perl.com/pub/a/2001/12/04/testing.html http://www.perl.com/pub/a/2002/07/10/tmo.html The first is a slightly more prose-ish variant of the slides. The second is a fairly detailed look at the process of "mocking". Enjoy, -- c TIMTOWTDI From markymoon at attbi.com Thu Jul 11 12:50:16 2002 From: markymoon at attbi.com (MarkyMoon) Date: Wed Aug 4 00:05:38 2004 Subject: Introduction to Testing with Test::More References: <200207102156.25602.chromatic@wgz.org> Message-ID: <3D2DC555.95F96683@attbi.com> Hi Kids, First, I wanted to thank chromatic for his presentation last night. Testing (among other things) has been a mystery to me, but it didn't involve nearly as many chicken bones and chanting as I'd feared. Also, since so many of our presenters (Austin's Debug::Toolkit/Randal's many have prepared nifty visual aides for the meetings and there were recent discussions of an online PDX-PM library... is there any chance of archiving the slides (or summaries of the presentations) on the site for future Mongrel... err, Monger viewing? I know that in six month's I'll wish I could remember details from merlyn's explanation of the Stonehenge make-over for example. Oh yeah let's have the next meeting in the Rose and Raindrop's walk in fridge ; ) Send more beer, That pesky Mark guy -- MarkyMoon -- @a = ("a".."z"," ","-","!","\n");foreach $b ( 18,15,4,2,8,5,8,2,0,19,8,14,13,18,26,0,17,4,26, 5,14,17,26,19,7,4,26,22,4,0,10,26,0,13,3,26,19, 8,12,8,3,28) {print $a[$b]};print $a[29]; chromatic wrote: > > Hi everyone, > > I've put the slides from tonight's presentation on my website. You're welcome > to download them. (I did correct the one error I noticed in the slides, but > not the potential error in Test::More.) > > http://wgz.org/chromatic/perl/IntroTestMore.pdf > > You're also welcome to read the two articles I've written for Perl.com. They > should be tackled in order: > > http://www.perl.com/pub/a/2001/12/04/testing.html > http://www.perl.com/pub/a/2002/07/10/tmo.html > > The first is a slightly more prose-ish variant of the slides. The second is a > fairly detailed look at the process of "mocking". > > Enjoy, > -- c > TIMTOWTDI TIMTOWTDI From markymoon at attbi.com Thu Jul 11 12:52:09 2002 From: markymoon at attbi.com (MarkyMoon) Date: Wed Aug 4 00:05:38 2004 Subject: Introduction to Testing with Test::More References: <200207102156.25602.chromatic@wgz.org> Message-ID: <3D2DC5C5.850AEF72@attbi.com> Hi Kids, First, I wanted to thank chromatic for his presentation last night. Testing (among other things) has been a mystery to me, but it didn't involve nearly as many chicken bones and chanting as I'd feared. Also, since so many of our presenters (Austin's Debug::Toolkit/Randal's many talks) have prepared nifty visual aides for the meetings and there were recent discussions of an online PDX-PM library... is there any chance of archiving the slides (or summaries of the presentations) on the site for future Mongrel... err, Monger viewing? I know that in six month's I'll wish I could remember details from merlyn's explanation of the Stonehenge make-over for example. Oh yeah let's have the next meeting in the Rose and Raindrop's walk in fridge ; ) Send more beer, That pesky Mark guy -- MarkyMoon -- @a = ("a".."z"," ","-","!","\n");foreach $b ( 18,15,4,2,8,5,8,2,0,19,8,14,13,18,26,0,17,4,26, 5,14,17,26,19,7,4,26,22,4,0,10,26,0,13,3,26,19, 8,12,8,3,28) {print $a[$b]};print $a[29]; chromatic wrote: > > Hi everyone, > > I've put the slides from tonight's presentation on my website. You're welcome > to download them. (I did correct the one error I noticed in the slides, but > not the potential error in Test::More.) > > http://wgz.org/chromatic/perl/IntroTestMore.pdf > > You're also welcome to read the two articles I've written for Perl.com. They > should be tackled in order: > > http://www.perl.com/pub/a/2001/12/04/testing.html > http://www.perl.com/pub/a/2002/07/10/tmo.html > > The first is a slightly more prose-ish variant of the slides. The second is a > fairly detailed look at the process of "mocking". > > Enjoy, > -- c > TIMTOWTDI TIMTOWTDI From joshua_keroes at eli.net Thu Jul 11 14:18:31 2002 From: joshua_keroes at eli.net (Joshua Keroes) Date: Wed Aug 4 00:05:38 2004 Subject: Meeting Place [was: Introduction to Testing with Test::More] In-Reply-To: <3D2DC5C5.850AEF72@attbi.com> References: <200207102156.25602.chromatic@wgz.org> <3D2DC5C5.850AEF72@attbi.com> Message-ID: <20020711191831.GE10607@eli.net> On (Thu, Jul 11 10:52), MarkyMoon wrote: > [snip] > > Oh yeah let's have the next meeting in the Rose and Raindrop's walk > in fridge ; ) > > Send more beer, > That pesky Mark guy Well... The Rose and Raindrop *does* have a room that seats 22 (bottom floor in the back) It has a $100 minimum for use, which, if we put our minds to it, shouldn't be that hard to clear. It's available one the first or second Weds for the next two months. It's an option, and an air-conditioned one at that. :-) -Joshua TIMTOWTDI From nforrett at wgz.com Thu Jul 11 15:41:29 2002 From: nforrett at wgz.com (n/a) Date: Wed Aug 4 00:05:38 2004 Subject: Meeting Place [was: Introduction to Testing with Test::More] In-Reply-To: <20020711191831.GE10607@eli.net> Message-ID: On Thu, 11 Jul 2002, Joshua Keroes wrote: > On (Thu, Jul 11 10:52), MarkyMoon wrote: > > [snip] > > > > Oh yeah let's have the next meeting in the Rose and Raindrop's walk > > in fridge ; ) > > > > Send more beer, > > That pesky Mark guy > > Well... The Rose and Raindrop *does* have a room that seats 22 (bottom > floor in the back) It has a $100 minimum for use, which, if we put > our minds to it, shouldn't be that hard to clear. > > It's available one the first or second Weds for the next two months. > > It's an option, and an air-conditioned one at that. :-) I have another alternative. My boss is willing to let us use the large conference room at my office. Pros: * Big enough for the group (judging by the turnout the last two months) * Air conditioned * Several bars/taverns relatively close * Large whiteboard, screen and projection unit builtin * Free Cons: * In Beaverton (near Washington Square) * Outside laptops not allowed to connect to LAN as per company policy. There is a laptop that lives in the conference room, however it runs Windows. I'd also be willing to burn CDs of required materials and bring them in. Thoughts? -- Nick .--< Nick Forrette >-------------------------------------------------------. | e-mail: nforrett@wgz.org | | www : http://www.drforehead.net/ | `--------------------------------------------------------------------------' TIMTOWTDI From jhoblitt at mysun.com Thu Jul 11 16:06:10 2002 From: jhoblitt at mysun.com (josh hoblitt) Date: Wed Aug 4 00:05:38 2004 Subject: Switch.pm Message-ID: I'm trying to do some regex matching with switch then use part of the match in the action taken but it seems the values aren't being passed. switch ($mystr) { case /^(somevalue)$/m { print "$_ $1\n"; } . . . } The cases are getting matching correctly but both $1 and $_ seem to be empty... I suspect whats going on is that the regex is getting placed in a sub and then being called (haven't looked at the code for Switch.pm). Is there syntax that will work for me here? Thanks, -Joshua Hoblitt -- jhoblitt@mysun.com TIMTOWTDI From tex at off.org Thu Jul 11 16:34:05 2002 From: tex at off.org (Austin Schutz) Date: Wed Aug 4 00:05:38 2004 Subject: Switch.pm In-Reply-To: ; from jhoblitt@mysun.com on Thu, Jul 11, 2002 at 11:06:10AM -1000 References: Message-ID: <20020711143405.C2873@gblx.net> On Thu, Jul 11, 2002 at 11:06:10AM -1000, josh hoblitt wrote: > > I'm trying to do some regex matching with switch then use part of the > match in the action taken but it seems the values aren't being passed. > > switch ($mystr) { > case /^(somevalue)$/m { print "$_ $1\n"; } > . > . > . > } > > The cases are getting matching correctly but both $1 and $_ seem to be > empty... I suspect whats going on is that the regex is getting placed in > a sub and then being called (haven't looked at the code for Switch.pm). > Is there syntax that will work for me here? > I suspect you can't use $1 et al because they are only scoped inside of case(). If you don't end up getting it to work, here's an equivalent that I use, which IME works as well or better than the stuff in the switch/case FAQ: $foo='foobar'; $_=$foo; SWITCH: { /oo/ && do { print "found foo\n"; }; /(b)a/ && do { print "found ba\n"; print "\$1: $1\n"; # This is equivalent to 'break' in C. last SWITCH; }; /r/ && do { print "r\n"; }; # Default here } Btw, I notice case uses the mysterious { } as a code block, like sort() does. Can it be explained how to do this in 100 words or less? :-) Austin TIMTOWTDI From poec at yahoo.com Thu Jul 11 16:59:29 2002 From: poec at yahoo.com (Ovid) Date: Wed Aug 4 00:05:38 2004 Subject: Switch.pm In-Reply-To: <20020711143405.C2873@gblx.net> Message-ID: <20020711215929.50027.qmail@web9101.mail.yahoo.com> --- Austin Schutz wrote: > I suspect you can't use $1 et al because they are only scoped > inside of case(). While I haven't used Switch.pm, I think you're correct. The ${digit} variables are automatically scoped to the current block and this can cause some surprising behavior. From "perldoc perlvar": $ Contains the subpattern from the corresponding set of capturing parentheses from the last pattern match, not counting patterns matched in nested blocks that have been exited already. (Mnemonic: like \digits.) These variables are all read-only and dynamically scoped to the current BLOCK. Cheers, Curtis "Ovid" Poe ===== "Ovid" on http://www.perlmonks.org/ Someone asked me how to count to 10 in Perl: push@A,$_ for reverse q.e...q.n.;for(@A){$_=unpack(q|c|,$_);@a=split//; shift@a;shift@a if $a[$[]eq$[;$_=join q||,@a};print $_,$/for reverse @A __________________________________________________ Do You Yahoo!? Sign up for SBC Yahoo! Dial - First Month Free http://sbc.yahoo.com TIMTOWTDI From todd_caine at eli.net Thu Jul 11 17:18:23 2002 From: todd_caine at eli.net (Todd Caine) Date: Wed Aug 4 00:05:38 2004 Subject: Switch.pm References: <20020711143405.C2873@gblx.net> Message-ID: <3D2E042F.DD487108@eli.net> Switch.pm uses a source code filter and converts the block into an anonymous subroutine. See Filter::Util::Call for more information on source code filters. Cheers, Todd Austin Schutz wrote: > Btw, I notice case uses the mysterious { } as a code block, like > sort() does. Can it be explained how to do this in 100 words or less? :-) TIMTOWTDI From jhoblitt at mysun.com Thu Jul 11 18:07:22 2002 From: jhoblitt at mysun.com (josh hoblitt) Date: Wed Aug 4 00:05:38 2004 Subject: Switch.pm Message-ID: I agree that this works... but it doesn't make the code any cleaner to read then using a bunch of if statements. I think this falls into the... "If my dog was that ugly I'd shave it's ass and make it walk backwards". Department. -J > > $foo='foobar'; > > $_=$foo; > SWITCH: { > /oo/ && do { > print "found foo\n"; > }; > /(b)a/ && do { > print "found ba\n"; > print "\$1: $1\n"; > # This is equivalent to 'break' in C. > last SWITCH; > }; > /r/ && do { > print "r\n"; > }; > # Default here > } > TIMTOWTDI From todd_caine at eli.net Thu Jul 11 18:55:48 2002 From: todd_caine at eli.net (Todd Caine) Date: Wed Aug 4 00:05:38 2004 Subject: Switch.pm References: Message-ID: <3D2E1B04.F89B4C71@eli.net> josh hoblitt wrote: > I agree that this works... but it doesn't make the code any cleaner to > read then using a bunch of if statements. Although I agree Austin's suggestion doesn't look as clean as the switch statement it is easier to debug using the perl debugger, IMO. Have you ever tried debugging a switch statement with the debugger? Source code filters are a neat concept but they make debugging code that uses them a nightmare. > I think this falls into the... > "If my dog was that ugly I'd shave it's ass and make it walk backwards". > Department. Tell us how you really feel. :) my $two_cents = 'todd'; TIMTOWTDI From cfrjlr at yahoo.com Thu Jul 11 22:32:28 2002 From: cfrjlr at yahoo.com (charles radley) Date: Wed Aug 4 00:05:39 2004 Subject: Meeting Place [was: Introduction to Testing with Test::More] References: Message-ID: <3D2E4DCC.1C7976AF@yahoo.com> Joshua Keroes ? n/a wrote: > Cons: > * In Beaverton (near Washington Square) I live in Tigard so this would be fine for me. I actually skipped the latest meeting, I did not like the neighborhood to be honest. I would feel happier parking and walking around Washington Square. Cheers. Charles F. Radley. -------------- next part -------------- A non-text attachment was scrubbed... Name: cfrjlr.vcf Type: text/x-vcard Size: 482 bytes Desc: Card for charles radley Url : http://mail.pm.org/archives/pdx-pm-list/attachments/20020711/d573730f/cfrjlr.vcf From tex at off.org Fri Jul 12 05:38:19 2002 From: tex at off.org (Austin Schutz) Date: Wed Aug 4 00:05:39 2004 Subject: Switch.pm In-Reply-To: ; from jhoblitt@mysun.com on Thu, Jul 11, 2002 at 01:07:22PM -1000 References: Message-ID: <20020712033819.A1683@gblx.net> On Thu, Jul 11, 2002 at 01:07:22PM -1000, josh hoblitt wrote: > I agree that this works... but it doesn't make the code any cleaner to > read then using a bunch of if statements. > Some perl programmers have a C background, where switch/case are common and familiar. If perl came with its own you would perhaps have a different point of view. I rarely use this type of code, but it can be handy in places where a string is tested several times over. > I think this falls into the... > > "If my dog was that ugly I'd shave it's ass and make it walk backwards". > > Department. If you don't like it, don't use it. TMTOWTDI. Please keep extreme judgements to yourself, or at least make some semblance of politeness about them. I'm sure we all have coding styles which might be considered ugly or inefficient by others. Keep in mind perl was originally designed to be a mishmash of features from C, awk, sed, sh, etc. etc. Austin TIMTOWTDI From SparksC at hlyw.com Fri Jul 12 10:33:00 2002 From: SparksC at hlyw.com (Chris Sparks) Date: Wed Aug 4 00:05:39 2004 Subject: Meeting Place [was: Introduction to Testing with Test::More] Message-ID: This would also workout for me (closer to where I work.) Sparky >>> n/a 07/11/02 01:41PM >>> On Thu, 11 Jul 2002, Joshua Keroes wrote: I have another alternative. My boss is willing to let us use the large conference room at my office. Pros: * Big enough for the group (judging by the turnout the last two months) * Air conditioned * Several bars/taverns relatively close * Large whiteboard, screen and projection unit builtin * Free Cons: * In Beaverton (near Washington Square) * Outside laptops not allowed to connect to LAN as per company policy. There is a laptop that lives in the conference room, however it runs Windows. I'd also be willing to burn CDs of required materials and bring them in. Thoughts? -- Nick .--< Nick Forrette >-------------------------------------------------------. | e-mail: nforrett@wgz.org | | www : http://www.drforehead.net/ | `--------------------------------------------------------------------------' TIMTOWTDI TIMTOWTDI From cp at onsitetech.com Fri Jul 12 10:33:16 2002 From: cp at onsitetech.com (Curtis Poe) Date: Wed Aug 4 00:05:39 2004 Subject: Out of town References: <20020712033819.A1683@gblx.net> Message-ID: <016b01c229b9$71889420$1a01a8c0@ot.onsitetech.com> Just a quick FYI for folks: I will be out of town for the next three days. Several of you have sent me private email regarding some discussions at the last meeting and I *will* respond -- after I get back. I just wanted you to know that I'm not ignoring you (yet :) -- Cheers, Curtis Poe Senior Programmer ONSITE! Technology, Inc. www.onsitetech.com 503-233-1418 Taking e-Business and Internet Technology To The Extreme! TIMTOWTDI From joshua_keroes at eli.net Fri Jul 12 10:47:49 2002 From: joshua_keroes at eli.net (Joshua Keroes) Date: Wed Aug 4 00:05:39 2004 Subject: Meeting Place [was: Introduction to Testing with Test::More] In-Reply-To: References: Message-ID: <20020712154749.GM10607@eli.net> me too! -joshua On (Fri, Jul 12 08:33), Chris Sparks wrote: > This would also workout for me (closer to where I work.) > > > >>> n/a 07/11/02 01:41PM >>> > I have another alternative. My boss is willing to let us use the large > conference room at my office. TIMTOWTDI From gcheong at acm.org Fri Jul 12 15:55:35 2002 From: gcheong at acm.org (Greg Cheong) Date: Wed Aug 4 00:05:39 2004 Subject: Meeting Place [was: Introduction to Testing withTest::More] References: Message-ID: <001b01c229e6$79cba000$6501a8c0@isolde> As long as it is in reach of Trimet, I'm fine with it. Cheers, Greg ----- Original Message ----- From: "Chris Sparks" To: ; Cc: Sent: Friday, July 12, 2002 8:33 AM Subject: Re: Meeting Place [was: Introduction to Testing withTest::More] > This would also workout for me (closer to where I work.) > > Sparky > > >>> n/a 07/11/02 01:41PM >>> > On Thu, 11 Jul 2002, Joshua Keroes wrote: > I have another alternative. My boss is willing to let us use the large > conference room at my office. > > Pros: > * Big enough for the group (judging by the turnout the last two months) > * Air conditioned > * Several bars/taverns relatively close > * Large whiteboard, screen and projection unit builtin > * Free > > Cons: > * In Beaverton (near Washington Square) > * Outside laptops not allowed to connect to LAN as per company policy. > There is a laptop that lives in the conference room, however it runs > Windows. I'd also be willing to burn CDs of required materials and > bring them in. > > Thoughts? > > -- > Nick > > > .--< Nick Forrette >-------------------------------------------------------. > | e-mail: nforrett@wgz.org | > | www : http://www.drforehead.net/ | > `--------------------------------------------------------------------------' > > TIMTOWTDI > > > > TIMTOWTDI > TIMTOWTDI From nforrett at wgz.com Fri Jul 12 16:48:08 2002 From: nforrett at wgz.com (n/a) Date: Wed Aug 4 00:05:39 2004 Subject: Meeting Place [was: Introduction to Testing withTest::More] In-Reply-To: <001b01c229e6$79cba000$6501a8c0@isolde> Message-ID: On Fri, 12 Jul 2002, Greg Cheong wrote: > As long as it is in reach of Trimet, I'm fine with it. It isn't the most convient, but the 76 & 78 come within a couple minutes walk. They both run from the Beverton Transit Center towards Tigard and/or Tualitin. -- Nick > ----- Original Message ----- > From: "Chris Sparks" > To: ; > Cc: > Sent: Friday, July 12, 2002 8:33 AM > Subject: Re: Meeting Place [was: Introduction to Testing withTest::More] > > > > This would also workout for me (closer to where I work.) > > > > Sparky > > > > >>> n/a 07/11/02 01:41PM >>> > > On Thu, 11 Jul 2002, Joshua Keroes wrote: > > I have another alternative. My boss is willing to let us use the large > > conference room at my office. > > > > Pros: > > * Big enough for the group (judging by the turnout the last two > months) > > * Air conditioned > > * Several bars/taverns relatively close > > * Large whiteboard, screen and projection unit builtin > > * Free > > > > Cons: > > * In Beaverton (near Washington Square) > > * Outside laptops not allowed to connect to LAN as per company policy. > > There is a laptop that lives in the conference room, however it runs > > Windows. I'd also be willing to burn CDs of required materials and > > bring them in. > > > > Thoughts? > > > > -- > > Nick > > > > > > .--< Nick Forrette > >-------------------------------------------------------. > > | e-mail: nforrett@wgz.org > | > > | www : http://www.drforehead.net/ > | > > > `--------------------------------------------------------------------------' > > > > TIMTOWTDI > > > > > > > > TIMTOWTDI > > > > TIMTOWTDI > -- ,--< Nick Forrette >--------------------------. | e-mail: nforrett@wgz.org | | www : http://www.drforehead.net/ | `---------------------------------------------' TIMTOWTDI From dora.raymaker at xo.com Fri Jul 12 17:07:37 2002 From: dora.raymaker at xo.com (Raymaker, Dora) Date: Wed Aug 4 00:05:39 2004 Subject: Meeting Place [was: Introduction to Testing with Test::More] Message-ID: <45EDA71CFF25D411A2E400508B6FC52A05E595AD@orportexch1.internal.nextlink.net> For what it's worth, the current location is highly convenient for me; a Beaveron location will be much more difficult. I (and the guy I usually come with) both have to leave work at our PDX downtown location early to attend meetings. Adding extra commute could become unhappy and not consistently do-able. -D. TIMTOWTDI From jasona at inetarena.com Fri Jul 12 23:16:35 2002 From: jasona at inetarena.com (Jason White) Date: Wed Aug 4 00:05:39 2004 Subject: PHP? Message-ID: <007b01c22a24$14247cc0$5b86fc83@archer> Please don't throw anything at me..... Given my choice, I would almost ALWAYS use perl, however, I am required to use PHP on a specific project. I am having some troubles with inheritance and I am looking for a good PHP mailing list. Does anybody out there subscribe to one? I'll keep you annonymous ;-) Jason White -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/archives/pdx-pm-list/attachments/20020712/c97779d7/attachment.htm From karic at lclark.edu Mon Jul 15 00:40:31 2002 From: karic at lclark.edu (Kari Chisholm) Date: Wed Aug 4 00:05:39 2004 Subject: arbitrary sorting... Message-ID: So, here's my weekend stumper: I've got an array: @foo = qw/apple porsche ferrari wilma barney banana/; I want to sort it, but I don't want to sort it alphabetically or in any other predictable way. Instead, I've got an arbitrary best order. Using my example, let's say that I've got 50 items in my preferred order (@bar) such that the fruit are grouped first, then cars, then flintstones. What I want is to compare @foo to @bar such that I'm able to reorder @foo into: apple banana porsche ferrari wilma barney. Does that make any sense? Am I missing something obvious? Thanks... -kari. TIMTOWTDI From rb-pdx-pm at redcat.com Mon Jul 15 01:21:04 2002 From: rb-pdx-pm at redcat.com (Tom Phoenix) Date: Wed Aug 4 00:05:39 2004 Subject: arbitrary sorting... In-Reply-To: Message-ID: On Sun, 14 Jul 2002, Kari Chisholm wrote: > What I want is to compare @foo to @bar such that I'm able to reorder @foo Do you mean that you want to sort @foo in "the same order that @bar is sorted in"? So if @bar is in order fruit-car-people, that's what you want for @foo? If that's not what you're saying, then what's @bar got to do with it? I think you probably want to sort items by category, which is easy to do if you have a hash as a category lookup table. You may want a second hash to hold the category sort order, too. Deriving that second hash from @bar should be straightforward. Cheers! --Tom Phoenix TIMTOWTDI From tkil at scrye.com Mon Jul 15 01:26:59 2002 From: tkil at scrye.com (Tkil) Date: Wed Aug 4 00:05:39 2004 Subject: arbitrary sorting... In-Reply-To: References: Message-ID: >>>>> "Kari" == Kari Chisholm writes: Kari> I want to sort it, but I don't want to sort it alphabetically or Kari> in any other predictable way. Instead, I've got an arbitrary Kari> best order. Using my example, let's say that I've got 50 items Kari> in my preferred order (@bar) such that the fruit are grouped Kari> first, then cars, then flintstones. Kari> What I want is to compare @foo to @bar such that I'm able to reorder @foo Kari> into: apple banana porsche ferrari wilma barney. if you know that @foo is a subset of @bar (that is, there are no elements of @foo that are not also in @bar), then you can do: | my %bar_score = do | { | my $i = 0; | map { $_ => ++i } reverse @bar; | }; | my @foo_by_bar = sort { $bar_score{$a} <=> $bar_score{$b} } @foo if you think that foo might have elements not in @bar, you can do something like this: | my @foo_in_bar = sort { $bar_score{$a} <=> $bar_score{$b} } | grep exists($bar_score{$_}) @bar; | my @foo_not_in_bar = grep !exists($bar_score{$_}), @foo; | my @foo_by_bar_with_stragglers = ( @foo_by_bar, @foo_not_in_bar ); the basic idea is to preprocess the "preferred order" (@bar) to establish a "score" for each one (%bar_score), then rank the raw data according to that score. the "reverse" in the bar_score creation is there so that the first element of @bar has the highest value; you could simplify that in various ways, including some that are dynamic (as you see new elements, you can add them to the end of the list with lower ranking; this resembles a "first come, first served" arrangement where elements might appear again, and should be filed with others of their ilk. if you really want to sort by type, you can extend this idea with another level of indirection (which describes a very great many computer science solutions!): | my @info = ( { type => 'car', | preference => 1000, | elements => [ qw( porsche ferrari | bmw audi subaru ) ] }, | { type => 'fruit', | preference => 500, | elements => [ qw( bananna pear apple | mango merlyn fig ) ] }, | | { type => 'toons', | preference => 100, | elements => [ qw( fred wilma betty barnie | stan kyle cartman kenny ) ] } ); | | my %pref_of_thing; | foreach $i (@info) | { | my $el = $i->{elements}; | @pref_of_thing{ @$el } = ( $i->{preference} ) x @$el; | } | | my @bar_by_preference = | sort { $pref_of_thing{$a} <=> $pref_of_thing{$b} } @bar; note that @info could easily come from a database. in this particular case, the "type" information isn't really used, but you can see how you might prefer to use that instead... i also don't know how stable perl's sort is; if a bunch of things compare equal, i don't know if they will be reordered or not in the output. t. TIMTOWTDI From creelan at engr.orst.edu Mon Jul 15 21:43:02 2002 From: creelan at engr.orst.edu (Tyler F. Creelan) Date: Wed Aug 4 00:05:39 2004 Subject: Self-reproducing Spiral In-Reply-To: Message-ID: Can anyone explain how this (very awesome!) perl code works? "This self-reproducing code prints a turning spiral filled with it's own code." #!/usr/bin/perl $_=' $q ="\ 47"; wh ile ($ ;= $z += .5 ){ %c= $r=0;$/ ="";whi le(2 0+ $z>($;+=.05)){$c{int$ _+ 2 6+ 2*($ r+= .0 2) * s in$ ;}{1 -$_ +1 0+ int $r*c o s $ ;} =1for(0. .1) }$ t =r ever se;$ /. =` c le ar `. " #! / usr /bi n/ pe rl \n\ $_ =$q \n" ; fo r$y (1..20){$c{$_} { $ y }? $ /.=chop$t : ($/ . =" \4 0") for(0. .53) ; $/. ="\n"}pri nt"$/$ q; s; ". chr(9 2)."s;;g;eval\n "} ';s;\s;;g;eval Source: http://www.perlmonks.org/index.pl?node_id=176043 Also a Win32 version: #!/usr/bin/perl $_=' $q ="\ 47"; wh ile ($ ;= $z += .5 ){ %c= $r=0;$/ ="";whi le(2 0+ $z>($;+=.05)){$c{int$ _+ 2 6+ 2*($ r+= .0 2) * s in$ ;}{1 -$_ +1 0+ int $r*c o s $ ;} =1for(0. .1) }$ t =r ever se;$ /. =` c le ar `. " #! / usr /bi n/ pe rl \n\ $_ =$q \n" ; fo r$y (1..20){$c{$_} { $ y }? $ /.=chop$t : ($/ . =" \4 0") for(0. .53) ; $/. ="\n"}pri nt"$/$ q; s; ". chr(9 2)."s;;g;eval\n "} ';s;\s;;g;eval TIMTOWTDI From nforrett at wgz.com Tue Jul 16 00:13:12 2002 From: nforrett at wgz.com (n/a) Date: Wed Aug 4 00:05:39 2004 Subject: Self-reproducing Spiral In-Reply-To: Message-ID: On Mon, 15 Jul 2002, Tyler F. Creelan wrote: > Can anyone explain how this (very awesome!) perl code works? I've attached my attempt. Once you reformat the code in a sane manner, and see through all the distractions, it is not nearly so terrifying. =) [snip] -- Nick ,--< Nick Forrette >--------------------------. | e-mail: nforrett@wgz.org | | www : http://www.drforehead.net/ | `---------------------------------------------' -------------- next part -------------- On Mon, 15 Jul 2002, Tyler F. Creelan wrote: > Can anyone explain how this (very awesome!) perl code works? > > "This self-reproducing code prints a turning spiral filled with it's own > code." > > #!/usr/bin/perl > $_=' > $q ="\ 47"; wh > ile ($ ;= > $z += .5 ){ > %c= $r=0;$/ ="";whi le(2 > 0+ $z>($;+=.05)){$c{int$ _+ 2 > 6+ 2*($ r+= .0 2) * > s in$ ;}{1 -$_ > +1 0+ int $r*c o s > $ ;} =1for(0. .1) }$ > t =r ever se;$ /. =` > c le ar `. " #! > / usr /bi n/ pe > rl \n\ $_ =$q \n" ; > fo r$y (1..20){$c{$_} { > $ y }? $ /.=chop$t : > ($/ . =" \4 > 0") for(0. .53) ; > $/. ="\n"}pri nt"$/$ q; > s; ". chr(9 2)."s;;g;eval\n "} Set $_ to be a rather large string of (poorly) formatted perl code. > ';s;\s;;g; # Remove all the whitespace from $_ > eval Evaluate the whitespaceless $_. Now if we remove the whitespace earlier, and strategicly add some back in to clarify the ccdes intent, you get something like this... $q = "\47" ; while( $; = $z += .5) { %c = $r= 0 ; $/ = "" ; while( 20 + $z > ($; += .05)) { $c{int $_ + 26 + 2 * ($r += .02) * sin $;}{1 - $_ + 10 + int $r * cos $;} = 1 for(0 .. 1) } $t = reverse ; $/ . = `clear` . "#!/usr/bin/perl\n\$_=$q\n" ; for $y (1 .. 20) { $c{$_}{$y} ? $/ .= chop $t : ($/ .= "\40") for(0 .. 53); $/ .= "\n" } print "$/$q;s;" . chr(92) . "s;;g;eval\n" } With some added comments, and rewriting the inner while loop, you get the following. # Set $q to ascii octal 47, or the single quote $q = "\47" ; # Increment the subscript separator (perldoc perlvar) and $z by .5 while( $; = $z += .5) { %c = $r = 0 ; # Set the INPUT_RECORD_SEPARATOR to the empty string (perldoc perlvar) $/ = "" ; # The first time through the outer loop... # Increment the subscript separator to .55, and loop while it is < 20+$z # ($z is .5 at the start of the loop) while( 20 + $z > ($; += .05)) { # $_ == 0 and $r == 0 and $; == .55 the first time through the loop # $_ == 1 and $r == .02 and $; == .55 the second time through the loop for (0 .. 1) { # Set $c{26}{11} = 1 the first time through the loop # Set $c{27}{10} = 1 the second time through the loop $c{int $_ + 26 + 2 * ($r += .02) * sin $;}{1 - $_ + 10 + int $r * cos $;} = 1 ; } # Repeat the while loop, with $; (subscript separator) == .06 } # $t is empty the first time through the outer loop $t = reverse ; # This clears the screen and represents the first two lines of replicated # code in each iteration of the outer while loop $/ . = `clear` . "#!/usr/bin/perl\n\$_=$q\n" ; # Some yet to be determined magic happens here. This combined with the # previous inner while/for loops eventually manages to recreate the # spiralized bit of code in the middle. If I was more familiar with how # sin/cos fit in with mathematical formulas for spirals, this would be a tad # easier. Maybe someone else could shed a little light (and/or wait for me # to do a bit more digging around). for $y (1 .. 20) { $c{$_}{$y} ? $/ .= chop $t : ($/ .= "\40") for(0 .. 53); $/ .= "\n" } # And here, you can forget all the other mumbo-jumbo in the previous while # loops, and sine/cosine stuff because the code never futzed with $q. # It just clears the screen, prints the first two lines, the body of the # code, and constructs the last two lines in not-terrible obvious manner # (ascii 92 is backslash). print "$/$q;s;" . chr(92) . "s;;g;eval\n" # Repeat the loop a bunch of times needlessly. } From rb-pdx-pm at redcat.com Tue Jul 16 00:18:18 2002 From: rb-pdx-pm at redcat.com (Tom Phoenix) Date: Wed Aug 4 00:05:39 2004 Subject: Self-reproducing Spiral In-Reply-To: Message-ID: On Mon, 15 Jul 2002, Tyler F. Creelan wrote: > "This self-reproducing code prints a turning spiral filled with it's own > code." Well, the whole spiral is just a single-quoted string. Just after that string is assigned to $_, the code at the bottom is the engine: s;\s;;g;eval The engine strips out the whitespace and evals that code. (The eval operator, used like this, compiles and runs whatever Perl code is found in $_. Using eval on a string is a bad idea in general, unless you totally understand why it's a bad idea.) Of course, that code looks like this without the whitespace: $q="\47";while($;=$z+=.5){%c=$r=0;$/="";while(20+$z>($;+=.05)){$c{int$_+26+2*($r+=.02)*sin$;}{1-$_+10+int$r*cos$;}=1for(0..1)}$t=reverse;$/.=`clear`."#!/usr/bin/perl\n\$_=$q\n";for$y(1..20){$c{$_}{$y}?$/.=chop$t:($/.="\40")for(0..53);$/.="\n"}print"$/$q;s;".chr(92)."s;;g;eval\n"} So I'll put the whitespace back, in the right places, by using B::Deparse with a command like this: perl -MO=Deparse source >deparsed , then I'll fix up one extra long line to get this: $q = q[']; while ($; = $z += 0.5) { %c = ($r = 0); $/ = ''; while (20 + $z > ($; += 0.05)) { foreach $_ (0 .. 1) { $c {int $_ + 26 + 2 * ($r += 0.02) * sin($;)} {1 - $_ + 10 + int($r * cos($;))} = 1; } } $t = reverse; $/ .= `clear` . "#!/usr/bin/perl\n\$_=$q\n"; foreach $y (1 .. 20) { foreach $_ (0 .. 53) { $c{$_}{$y} ? ($/ .= chop $t) : ($/ .= ' '); } $/ .= "\n"; } print "$/$q;s;" . '\\' . "s;;g;eval\n"; } Here, let me annotate that: $q = q[']; # A single quote. The actual source uses # neither single quotes nor whitespace. while ($; = $z += 0.5) { # Although $; is one of Perl's internal variables, it's # being used here as an ordinary one. Pretend it's # $semi if you'd rather. It is an angle expressed in # radians. Of course, the while loop is a decoy; it's # an infinite loop. This program runs until you break # out of it. $z is an initial rotation parameter. %c = ($r = 0); # This is erasing the contents of %c, although it's an # odd way to do it. %c is being used to hold a picture of # the spiral. (Not a normal use of a hash!) The value of # $c{$x}{$y} will be true if the spiral intersects # position $x, $y. $r is the radius of the spiral. # $x ranges from 0 to 53, $y from 1 to 20. $/ = ''; # This is another internal variable being used for the # author's own purposes. This one is collecting the # output as one big multi-line string. while (20 + $z > ($; += 0.05)) { foreach $_ (0 .. 1) { $c {int $_ + 26 + 2 * ($r += 0.02) * sin($;)} # That's the X-coord in the spiral picture. The # constant 26 is half of the width of the # spiral, roughly. {1 - $_ + 10 + int($r * cos($;))} # That's the Y-coord; 10 is half of the height. = 1; } } $t = reverse; # That reverses $_ (which holds this program's source, # remember?) storing the resulting string into $t. It's # being reversed so that chop() will remove characters # in the proper order. $/ .= `clear` . "#!/usr/bin/perl\n\$_=$q\n"; # The output of clear (external command being run in # backticks) is your system's "clear screen" code. foreach $y (1 .. 20) { foreach $_ (0 .. 53) { $c{$_}{$y} ? ($/ .= chop $t) : ($/ .= ' '); # Either a space or some code, depending upon # the spiral table, %c. It would be better, # if you must use the ternary op, to write # that like this: # $/ .= $c{$_}{$y} ? chop $t : ' ' } $/ .= "\n"; } print "$/$q;s;" . '\\' . "s;;g;eval\n"; # That outputs the engine at the bottom, spoiling # the look of the spiral. } The author of this code missed a number of opportunites to improve it (although whether my changes would be improvements is a matter of debate). In fact, a number of features make me wonder whether the author wrote it originally for Perl 4, working around the lack of references by using something like "$_!$y" as a hash key. (As far as I can see, this code should work fine in Perl 4 with that mod. But I don't keep Perl 4 around for testing.) If I've missed anything, I hope someone else will jump in. Hope this helps! --Tom TIMTOWTDI From nforrett at wgz.com Tue Jul 16 00:28:38 2002 From: nforrett at wgz.com (n/a) Date: Wed Aug 4 00:05:39 2004 Subject: Self-reproducing Spiral In-Reply-To: Message-ID: On Mon, 15 Jul 2002, Tyler F. Creelan wrote: > Can anyone explain how this (very awesome!) perl code works? Yeah. Crap. Got a little over-eager and forgot that $q was single-quote, rather than the eval'd string from the beginning. Time to A: get some sleep, and B: dig into the formula for spirals. -- Nick ,--< Nick Forrette >--------------------------. | e-mail: nforrett@wgz.org | | www : http://www.drforehead.net/ | `---------------------------------------------' TIMTOWTDI From erike at visi.com Tue Jul 16 03:07:54 2002 From: erike at visi.com (Rev. Dr. Erik C Elmshauser) Date: Wed Aug 4 00:05:39 2004 Subject: Hello Message-ID: <1026806875.764.1686.camel@nexus> Hi, I am new to the list, is there an FAQ of any kind I should read? I attended a few PM meetings in Minneapolis when I lived in Minnesota, but I have been here in portland for years now, and I am just getting back into perl. I hope this post isn't too out of line for the list. --Erik TIMTOWTDI From rb-pdx-pm at redcat.com Tue Jul 16 03:35:42 2002 From: rb-pdx-pm at redcat.com (Tom Phoenix) Date: Wed Aug 4 00:05:39 2004 Subject: Hello In-Reply-To: <1026806875.764.1686.camel@nexus> Message-ID: On 16 Jul 2002, Rev. Dr. Erik C Elmshauser wrote: > I am new to the list, is there an FAQ of any kind I should read? Nothing that isn't obvious. :-) By which I mean that you should at least scan the Perl docs before asking about Perl.... This list runs pretty informally. So long as you don't do something amazingly stupid, you'll fit in just fine. The main topic is our monthly gatherings, then comes anything perl-related. Occasionally there's some job-hunting-related stuff, but there seems to be a consensus that if that gets to be more than occasional, we'll move it to another list. Did that answer your question? Cheers! --Tom Phoenix TIMTOWTDI From merlyn at stonehenge.com Tue Jul 16 10:08:05 2002 From: merlyn at stonehenge.com (Randal L. Schwartz) Date: Wed Aug 4 00:05:39 2004 Subject: Hello In-Reply-To: <1026806875.764.1686.camel@nexus> References: <1026806875.764.1686.camel@nexus> Message-ID: <86ofd7sobu.fsf@blue.stonehenge.com> >>>>> "Rev" == Rev Dr Erik C <" Elmshauser > writes: Rev> I am new to the list, is there an FAQ of any kind I should read? You have to have Frequently Asked Questions before you can have a FAQ. :) So far, the only FAQ is "where's the next meeting, and what's it about" and the answer to that is as unpredictable as Schrodinger's Animal Supply. Stay tuned... :) -- 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! TIMTOWTDI From nforrett at wgz.com Tue Jul 16 13:01:48 2002 From: nforrett at wgz.com (n/a) Date: Wed Aug 4 00:05:39 2004 Subject: Self-reproducing Spiral In-Reply-To: Message-ID: On Mon, 15 Jul 2002, Tyler F. Creelan wrote: > Can anyone explain how this (very awesome!) perl code works? Ok, I think I've redeemed myself. ;-) See attached. -- Nick ,--< Nick Forrette >--------------------------. | e-mail: nforrett@wgz.org | | www : http://www.drforehead.net/ | `---------------------------------------------' -------------- next part -------------- On Mon, 15 Jul 2002, Tyler F. Creelan wrote: > Can anyone explain how this (very awesome!) perl code works? > > "This self-reproducing code prints a turning spiral filled with it's own > code." > > #!/usr/bin/perl > $_=' > $q ="\ 47"; wh > ile ($ ;= > $z += .5 ){ > %c= $r=0;$/ ="";whi le(2 > 0+ $z>($;+=.05)){$c{int$ _+ 2 > 6+ 2*($ r+= .0 2) * > s in$ ;}{1 -$_ > +1 0+ int $r*c o s > $ ;} =1for(0. .1) }$ > t =r ever se;$ /. =` > c le ar `. " #! > / usr /bi n/ pe > rl \n\ $_ =$q \n" ; > fo r$y (1..20){$c{$_} { > $ y }? $ /.=chop$t : > ($/ . =" \4 > 0") for(0. .53) ; > $/. ="\n"}pri nt"$/$ q; > s; ". chr(9 2)."s;;g;eval\n "} Set $_ to be a rather large string of (poorly) formatted perl code. > ';s;\s;;g; # Remove all the whitespace from $_ > eval Evaluate the whitespaceless $_. Now if we remove the whitespace earlier, and strategicly add some back in to clarify the ccdes intent, you get something like this... $q = "\47" ; while( $; = $z += .5) { %c = $r= 0 ; $/ = "" ; while( 20 + $z > ($; += .05)) { $c{int $_ + 26 + 2 * ($r += .02) * sin $;}{1 - $_ + 10 + int $r * cos $;} = 1 for(0 .. 1) } $t = reverse ; $/ . = `clear` . "#!/usr/bin/perl\n\$_=$q\n" ; for $y (1 .. 20) { $c{$_}{$y} ? $/ .= chop $t : ($/ .= "\40") for(0 .. 53); $/ .= "\n" } print "$/$q;s;" . chr(92) . "s;;g;eval\n" } With some added comments, and rewriting the inner while loop, you get the following. # Set $q to ascii octal 47, or the single quote $q = "\47" ; # Increment $; and $z by .5. It appears that $; is used to obfusticate things, # as is $/ (in other words, they could have used normal variables) while( $; = $z += .5) { %c = $r = 0 ; $/ = "" ; # This loop actually constructs the spiral. The hash %c is used to store the # legal locations that characters can be stored in the final result. The # first key is the Y screen coordinate, the second hash key is the X # coordinate. If a character is allowed at that point on the screen, the # appropriate hash entry is set to 1. while( 20 + $z > ($; += .05)) { for (0 .. 1) { # Formula for spiral of archimedes: # x = t cos t # y = t sin t # where x and y are rectangular coordinates, and t is time. # in this case, $c{Y-coord}{X-coord}, and $; represents time # the rest seems to be fudge factor $c{int $_ + 26 + 2 * ($r += .02) * sin $;}{1 - $_ + 10 + int $r * cos $;} = 1 ; } } # Here is where the magic happens. Remember that $_ was s/\s//g -ified, and # then evaled. Now $_ still contains the whitespace stripped code. However, # the code that was whitepsace stripped was capable of reconstructing the # original spiral (stored in %c). So $t ends up with the reverse of the body # code $t = reverse ; # This clears the screen and represents the first two lines of replicated # code in each iteration of the outer while loop $/ . = `clear` . "#!/usr/bin/perl\n\$_=$q\n" ; # Loop over the X/Y coordinates for $y (1 .. 20) { for (0 .. 53) { # if the spiral calculator determined that there should be a character # here, chop a character off the end and append it to $/ (which contains # the screen clearing, and first two lines of code already. Remember # that $t is the code backwards, so this will be the first character of # the code forwards. If there is not supposed to be a character here, # then put a space character in that location. $c{$_}{$y} ? $/ .= chop $t : ($/ .= "\40") ; } $/ .= "\n" } # Here we print out the first two lines, and the spiralized body code, then # the last s;\s;; and eval. print "$/$q;s;" . chr(92) . "s;;g;eval\n" # The outer loop is purely for effect. It has the net effect of making the # spiral appear to rotate. However, I found that you have to have a suitable # slow machine to actually see the spiraling. Strictly speaking, it is not # needed. } From jeff at vpservices.com Tue Jul 16 20:27:34 2002 From: jeff at vpservices.com (Jeff Zucker) Date: Wed Aug 4 00:05:39 2004 Subject: Broadband options in PDX? References: <200207102156.25602.chromatic@wgz.org> Message-ID: <3D34C806.2000602@vpservices.com> No Perl content here, but I was hoping some fellow techies would have a suggestion for getting broadband at home other than ATT. I'm near Mt. Tabor, can't get DSL, probably have too many trees for a dish or antennae. Anyone know of other options? -- Jeff TIMTOWTDI From nat at powning.org Tue Jul 16 22:50:56 2002 From: nat at powning.org (Nathaniel Powning) Date: Wed Aug 4 00:05:39 2004 Subject: Broadband options in PDX? In-Reply-To: <3D34C806.2000602@vpservices.com> Message-ID: <20020716205014.B48270-100000@marglar.powning.org> Make sure you check out the node map at http://maps.personaltelco.net, there may be someone close enough that's sharing bandwidth over 802.11b. On 16 Jul 2002, Jeff Zucker wrote: > No Perl content here, but I was hoping some fellow techies would have a > suggestion for getting broadband at home other than ATT. I'm near Mt. > Tabor, can't get DSL, probably have too many trees for a dish or > antennae. Anyone know of other options? > > -- > Jeff > > TIMTOWTDI > TIMTOWTDI From jeff at vpservices.com Wed Jul 17 13:29:27 2002 From: jeff at vpservices.com (Jeff Zucker) Date: Wed Aug 4 00:05:39 2004 Subject: Broadband options in PDX? References: <200207102156.25602.chromatic@wgz.org> <3D34C806.2000602@vpservices.com> <20020716211742.C10327@patch.com> Message-ID: <3D35B787.4090703@vpservices.com> Thanks all for the many helpful answers. I guess TIMTOWTDI with broadband too :-). mikeraz@PATCH.COM wrote: > A letter to the PUC has helped others get DSL in the past. Now that is a very interesting idea. Do you have any pointers to relevant regulatory info to help me understand what Qwest and PUC *ought* to be doing (as distinct from what they actually do)? -- Jeff TIMTOWTDI From jhoblitt at mysun.com Wed Jul 17 16:36:12 2002 From: jhoblitt at mysun.com (josh hoblitt) Date: Wed Aug 4 00:05:39 2004 Subject: HTML filtering Message-ID: <438e6427e2.427e2438e6@mysun.com> I know there are several web developers on this list so please excuse my rant as to how much flash/shockwave sucks. Even if it wasn't so irritating it's just not an option on all platforms. I'm going to scream if mozilla prompts me one more time to install a plugin that doens't exist for solaris. (maybe I should rant on perlmonks.org) Anyways I've decided to build a lightweight proxy to strip flash from HTML. Anyone have suggestions on how to proceed? I see Toms Proxy::HTML but I think I'm going to have to use HTML::Parser directly. Would anyone like to work on this with me? Thanks, -Joshua Hoblitt -- jhoblitt@mysun.com TIMTOWTDI From merlyn at stonehenge.com Wed Jul 17 16:59:57 2002 From: merlyn at stonehenge.com (Randal L. Schwartz) Date: Wed Aug 4 00:05:39 2004 Subject: HTML filtering In-Reply-To: <438e6427e2.427e2438e6@mysun.com> References: <438e6427e2.427e2438e6@mysun.com> Message-ID: <86vg7ekobm.fsf@blue.stonehenge.com> >>>>> "josh" == josh hoblitt writes: josh> I know there are several web developers on this list so please excuse my josh> rant as to how much flash/shockwave sucks. Even if it wasn't so josh> irritating it's just not an option on all platforms. I'm going to josh> scream if mozilla prompts me one more time to install a plugin that josh> doens't exist for solaris. (maybe I should rant on perlmonks.org) josh> Anyways I've decided to build a lightweight proxy to strip flash from josh> HTML. Anyone have suggestions on how to proceed? I see Toms josh> Proxy::HTML but I think I'm going to have to use HTML::Parser directly. josh> Would anyone like to work on this with me? in google, type site:stonehenge.com http proxy -- 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! TIMTOWTDI From jasona at inetarena.com Wed Jul 17 19:02:10 2002 From: jasona at inetarena.com (Jason White) Date: Wed Aug 4 00:05:39 2004 Subject: Object IO Message-ID: <01b801c22dee$5de79680$5b86fc83@archer> What is the best method to read and write objects from file? Should I serialize the object? I've heard Data::Dumper mentioned for saving hashes, is it good for this purpose as well? Jason White -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/archives/pdx-pm-list/attachments/20020717/c39e0b5d/attachment.htm From kawsmo at ryefish.com Wed Jul 17 19:17:19 2002 From: kawsmo at ryefish.com (Tim Riley) Date: Wed Aug 4 00:05:39 2004 Subject: HTML filtering In-Reply-To: <438e6427e2.427e2438e6@mysun.com> Message-ID: <5.1.0.14.2.20020717170425.02341c80@mail.slip.net> In addition to stripping out flash/shockwave, consider supporting SVG (scalar vector graphics), an xml based alternative to flash. There just happens to be a perl module to dynamically generate SVG files. SVG rendering engines seem not as fast as flash right now, but because its xml some browsers are already beginning to support SVG natively. Best of luck stripping out flash :) Tim At 11:36 AM 7/17/2002 -1000, josh hoblitt wrote: >I know there are several web developers on this list so please excuse my >rant as to how much flash/shockwave sucks. Even if it wasn't so >irritating it's just not an option on all platforms. I'm going to >scream if mozilla prompts me one more time to install a plugin that >doens't exist for solaris. (maybe I should rant on perlmonks.org) > >Anyways I've decided to build a lightweight proxy to strip flash from >HTML. Anyone have suggestions on how to proceed? I see Toms >Proxy::HTML but I think I'm going to have to use HTML::Parser directly. > Would anyone like to work on this with me? > >Thanks, > >-Joshua Hoblitt > >-- >jhoblitt@mysun.com > >TIMTOWTDI TIMTOWTDI From merlyn at stonehenge.com Thu Jul 18 01:32:09 2002 From: merlyn at stonehenge.com (Randal L. Schwartz) Date: Wed Aug 4 00:05:39 2004 Subject: Object IO In-Reply-To: <01b801c22dee$5de79680$5b86fc83@archer> References: <01b801c22dee$5de79680$5b86fc83@archer> Message-ID: <86sn2hk0ly.fsf@blue.stonehenge.com> >>>>> "Jason" == Jason White writes: Jason> What is the best method to read and write objects from file? Jason> Should I serialize the object? I've heard Data::Dumper Jason> mentioned for saving hashes, is it good for this purpose as Jason> well? Data::Dumper does too much work, making Perl code on the way out, and then having to eval it on the way in. My favorite is Storable, now part of the Perl core, but easily found in the CPAN for older Perls. Also look into Tie::MLDBM, which gives an indexed way to partition a file, using Storable automatically to store and retrieve complex objects. If you want something more interesting, look at Tangram, which provides an object to relational-database mapping. -- 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! TIMTOWTDI From erike at pbgnw.com Thu Jul 18 12:45:02 2002 From: erike at pbgnw.com (Elmshauser, Erik) Date: Wed Aug 4 00:05:39 2004 Subject: perl -e is acting funny in a chroot jail Message-ID: <0FD2E5E35F0C0D41AEA66C9C6F39F30D4784@HERMES.pbgnw.com> Skipped content of type multipart/alternative-------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: image/gif Size: 2310 bytes Desc: image001.gif Url : http://mail.pm.org/archives/pdx-pm-list/attachments/20020718/2513763a/attachment.gif From merlyn at stonehenge.com Thu Jul 18 12:52:50 2002 From: merlyn at stonehenge.com (Randal L. Schwartz) Date: Wed Aug 4 00:05:39 2004 Subject: perl -e is acting funny in a chroot jail In-Reply-To: <0FD2E5E35F0C0D41AEA66C9C6F39F30D4784@HERMES.pbgnw.com> References: <0FD2E5E35F0C0D41AEA66C9C6F39F30D4784@HERMES.pbgnw.com> Message-ID: <86fzyghqj1.fsf@blue.stonehenge.com> >>>>> "Elmshauser," == Elmshauser, Erik writes: Elmshauser,> I am working on setting up apache and mod_perl to run in a chroot jail. Elmshauser,> I have done this in the past without a problem, but this time It's Elmshauser,> acting up. When I try to give it the -e flag it treats it like a file Elmshauser,> name, not a flag. Here is a little clip from the shell: Do you have a /tmp in the jail? Backrev versions of Perl (prior to 5.8) write a small file in /tmp to run the -e script. So the error message perhaps is accurate... :) In 5.8, this was eliminated, because it can lead to a security hole. -- 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! TIMTOWTDI From erike at pbgnw.com Thu Jul 18 13:22:09 2002 From: erike at pbgnw.com (Elmshauser, Erik) Date: Wed Aug 4 00:05:39 2004 Subject: perl -e is acting funny in a chroot jail Message-ID: <0FD2E5E35F0C0D41AEA66C9C6F39F30D4785@HERMES.pbgnw.com> > Do you have a /tmp in the jail? Backrev versions of Perl (prior to > 5.8) write a small file in /tmp to run the -e script. So the error > message perhaps is accurate... :) > In 5.8, this was eliminated, because it can lead to a security hole. Yeah, there was a /tmp there, but it was set to 755. Setting it to 777 does not seem to have resolved the issue. root@charon:/# chmod 777 tmp/ root@charon:/# ./usr/local/bin/perl -e 'exit' Can't open perl script "-e": No such file or directory Also, that error looks like it is trying to use '-e' as a filename, I'm not sure, but I doubt that this is what perl would use for a temp file name... --Erik Rev. Dr. Erik C Elmshauser D.D. Head of I.T. Pacific Benefits Group NW LLC erike@pbgnw.com Phone - 800.259.0455 Fax - 800.662.0082 There are 10 kinds of people in the world, Those that can do binary arithmetic, and those that can't. TIMTOWTDI From tex at off.org Thu Jul 18 13:30:09 2002 From: tex at off.org (Austin Schutz) Date: Wed Aug 4 00:05:39 2004 Subject: perl -e is acting funny in a chroot jail In-Reply-To: <0FD2E5E35F0C0D41AEA66C9C6F39F30D4785@HERMES.pbgnw.com>; from erike@pbgnw.com on Thu, Jul 18, 2002 at 11:22:09AM -0700 References: <0FD2E5E35F0C0D41AEA66C9C6F39F30D4785@HERMES.pbgnw.com> Message-ID: <20020718113009.S27293@gblx.net> On Thu, Jul 18, 2002 at 11:22:09AM -0700, Elmshauser, Erik wrote: > > Do you have a /tmp in the jail? Backrev versions of Perl (prior to > > 5.8) write a small file in /tmp to run the -e script. So the error > > message perhaps is accurate... :) > > > In 5.8, this was eliminated, because it can lead to a security hole. > > Yeah, there was a /tmp there, but it was set to 755. Setting it to 777 > does not seem to have resolved the issue. > /tmp should be set to 1777 to prevent other folks from monkeying with your /tmp files. It is a security issue w/out the 1. > root@charon:/# chmod 777 tmp/ > root@charon:/# ./usr/local/bin/perl -e 'exit' > Can't open perl script "-e": No such file or directory > > Also, that error looks like it is trying to use '-e' as a filename, I'm > not sure, but I doubt that this is what perl would use for a temp file > name... Try running truss/strace on it. That will show you what it's trying to do. Austin TIMTOWTDI From erike at pbgnw.com Thu Jul 18 15:02:43 2002 From: erike at pbgnw.com (Elmshauser, Erik) Date: Wed Aug 4 00:05:39 2004 Subject: perl -e is acting funny in a chroot jail Message-ID: <0FD2E5E35F0C0D41AEA66C9C6F39F30D4787@HERMES.pbgnw.com> -----Original Message----- From: Austin Schutz [mailto:tex@off.org] Sent: Thursday, July 18, 2002 11:30 AM To: Elmshauser, Erik Cc: pdx-pm-list@pm.org Subject: Re: perl -e is acting funny in a chroot jail /tmp should be set to 1777 to prevent other folks from monkeying with your /tmp files. It is a security issue w/out the 1. Yeah, I wasn't thinking of security inside the chroot jail, but from outside the jail it's important, the sticky bit is now set. Thanks. Try running truss/strace on it. That will show you what it's trying to do. Good idea here too. I used strace to find that it was failing to open /dev/null and dieing. I created a dev null inside the jail and now it's running fine. Thank you Randal and Austin! --Erik TIMTOWTDI From jhoblitt at mysun.com Thu Jul 18 16:33:39 2002 From: jhoblitt at mysun.com (josh hoblitt) Date: Wed Aug 4 00:05:39 2004 Subject: perl -e is acting funny in a chroot jail Message-ID: <10bc3c661.c66110bc3@mysun.com> > There are 10 kinds of people in the world, > Those that can do binary arithmetic, and those that can't. I hate to ask but is that .sig big-endian or little-endian? :) TIMTOWTDI From jhoblitt at mysun.com Thu Jul 18 16:33:56 2002 From: jhoblitt at mysun.com (josh hoblitt) Date: Wed Aug 4 00:05:39 2004 Subject: perl -e is acting funny in a chroot jail Message-ID: > There are 10 kinds of people in the world, > Those that can do binary arithmetic, and those that can't. I hate to ask but is that .sig big-endian or little-endian? :) TIMTOWTDI From karic at lclark.edu Thu Jul 18 18:00:01 2002 From: karic at lclark.edu (Kari Chisholm) Date: Wed Aug 4 00:05:39 2004 Subject: arbitrary sorting... References: Message-ID: <3D374871.10D9C401@lclark.edu> Tkil wrote: > if you know that @foo is a subset of @bar (that is, there are no > elements of @foo that are not also in @bar), then you can do: > > | my %bar_score = do > | { > | my $i = 0; > | map { $_ => ++i } reverse @bar; > | }; > | my @foo_by_bar = sort { $bar_score{$a} <=> $bar_score{$b} } @foo > Bingo. This is exactly what I wanted. I'll give it a shot. Thanks. -kari. TIMTOWTDI From jhoblitt at mysun.com Thu Jul 18 18:16:58 2002 From: jhoblitt at mysun.com (josh hoblitt) Date: Wed Aug 4 00:05:39 2004 Subject: HTML filtering Message-ID: I discovered something interesting: HTTP:Daemon doesn't work correctly on perl 5.6.1/solaris 8. The object will allow one connection then die on the next attempt to call accept. I tried setting some IO::Socket::Inet options with no luck. The problem is fairly lowlevel as the OS is still holding the socket open for sometime after the code exits. (I verified that the code still works on perl 5.6.1/linux 2.4) Anyone have a solaris 8 box to try and replicate the issue? -Joshua Hoblitt -- jhoblitt@mysun.com ----- Original Message ----- From: merlyn@stonehenge.com (Randal L. Schwartz) Date: Wednesday, July 17, 2002 12:32 pm Subject: Re: HTML filtering > of course. just do it when $response->content_type eq "text/html", > andyou'll be fine. > -- > Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 > 777 0095 > target="l">http://www.stonehenge.com/merlyn/>Perl/Unix/security > consulting, Technical writing, Comedy, etc. etc. > See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl > training! TIMTOWTDI From merlyn at stonehenge.com Thu Jul 18 18:23:05 2002 From: merlyn at stonehenge.com (Randal L. Schwartz) Date: Wed Aug 4 00:05:39 2004 Subject: HTML filtering In-Reply-To: References: Message-ID: <86znwoei3q.fsf@blue.stonehenge.com> >>>>> "josh" == josh hoblitt writes: josh> I discovered something interesting: HTTP:Daemon doesn't work correctly josh> on perl 5.6.1/solaris 8. The object will allow one connection then die josh> on the next attempt to call accept. I tried setting some josh> IO::Socket::Inet options with no luck. The problem is fairly lowlevel josh> as the OS is still holding the socket open for sometime after the code josh> exits. (I verified that the code still works on perl 5.6.1/linux 2.4) One of my programs (the preforking server) broke under some OS releases because flock() on the master socket isn't supported properly. I had to switch to including __END__ in the program and then flocking DATA in the same way (a cheap trick, but effective :). -- 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! TIMTOWTDI From tkil at scrye.com Thu Jul 18 18:33:27 2002 From: tkil at scrye.com (Tkil) Date: Wed Aug 4 00:05:39 2004 Subject: arbitrary sorting... In-Reply-To: <3D374871.10D9C401@lclark.edu> References: <3D374871.10D9C401@lclark.edu> Message-ID: I wrote: > if you know that @foo is a subset of @bar (that is, there are no > elements of @foo that are not also in @bar), then you can do: > > | my %bar_score = do > | { > | my $i = 0; > | map { $_ => ++i } reverse @bar; ^^^ > | }; > | my @foo_by_bar = sort { $bar_score{$a} <=> $bar_score{$b} } @foo > Sigh. The things I see when I'm awake. That should be ++$i, of course. One way to avoid the reverse is to start with a higher score, and count down. (Or start with zero and go negative -- same difference.) So, I'd probably really do it more like this: | #!/usr/bin/perl -w | | use strict; | | my @bar = qw( porsche bmw audi buick ford chevy subaru jaguar | horse cow dog cat pig | sushi hamburger fish-n-chips burrito | pear apple mango banana strawberry grapefruit orange ); | | my @foo = qw( banana porsche subaru apple cat oddball buick cow mango ); | | my @foo_by_bar = do | { | my $i = 0; | my %s = map { $_ => ++$i } @bar; | if (my @missing = grep !exists($s{$_}), @foo) | { | warn "not in bar: @missing\n"; | foreach (@missing) { $s{$_} = ++$i; } | } | sort { $s{$a} <=> $s{$b} } @foo; | }; | | print "foo: @foo\n", | "by bar: @foo_by_bar\n"; If you are into micro-optimizations, it might be amusing to compare the "map" scoring with something like: | my %s; | @s{@bar} = 0 .. $#bar; Which might be a bit faster. I wouldn't make any wagers one way or another, though. Heh. You'll have to adjust the backup scoring, too, yielding: | my @foo_by_bar = do | { | my %s; | @s{@bar} = 0 .. $#bar; | if (my @missing = grep !exists($s{$_}), @foo) | { | warn "not in bar: @missing\n"; | @s{@missing} = @bar .. @bar+@missing-1; | } | sort { $s{$a} <=> $s{$b} } @foo; | }; Anyway. Happy nugget polishing, t. TIMTOWTDI From tkil at scrye.com Thu Jul 18 18:40:11 2002 From: tkil at scrye.com (Tkil) Date: Wed Aug 4 00:05:39 2004 Subject: arbitrary sorting... In-Reply-To: References: <3D374871.10D9C401@lclark.edu> Message-ID: <15671.20955.248541.758415@brand.scrye.com> Last response to myself for a while, I hope. >>>>> "Tkil" == tkil writes: Tkil> One way to avoid the reverse is to start with a higher score, Tkil> and count down. (Or start with zero and go negative -- same Tkil> difference.) I did this: | my @foo_by_bar = do | { | my $i = @bar; | my %s = map { $_ => --$i } @bar; | if (my @missing = grep !exists($s{$_}), @foo) | { | warn "not in bar: @missing"; | foreach (@missing) { $s{$_} = ++$i; } | } | sort { $s{$a} <=> $s{$b} } @foo; | }; Which sorted in the opposite order. Giving bigger values to the earlier members of @bar makes sense if they are "weights", but that sort comparison function was expects "ranks". Anyway, I suppose I could have just flipped the comparison, but I ended up deciding that I'd just "score" from zero and sort in ascending order. Hope that makes more sense. t. TIMTOWTDI From jhoblitt at mysun.com Thu Jul 18 19:07:36 2002 From: jhoblitt at mysun.com (josh hoblitt) Date: Wed Aug 4 00:05:39 2004 Subject: HTML filtering Message-ID: Perl CookBook page 628: "On some operating systems, notably Solaris, you connot have multiple children doing an accept on the same socket. You have to use file locking to ensure that only one child can call accept at any particular moment." Randal's code doesn't prefork multiple children so that can't be exactly whats going on but atleast it's a clue. -- jhoblitt@mysun.com ----- Original Message ----- From: merlyn@stonehenge.com (Randal L. Schwartz) Date: Thursday, July 18, 2002 1:23 pm Subject: Re: HTML filtering > >>>>> "josh" == josh hoblitt writes: > > josh> I discovered something interesting: HTTP:Daemon doesn't work > correctlyjosh> on perl 5.6.1/solaris 8. The object will allow one > connection then die > josh> on the next attempt to call accept. I tried setting some > josh> IO::Socket::Inet options with no luck. The problem is fairly > lowleveljosh> as the OS is still holding the socket open for > sometime after the code > josh> exits. (I verified that the code still works on perl > 5.6.1/linux 2.4) > > One of my programs (the preforking server) broke under some OS > releases because flock() on the master socket isn't supported > properly. I had to switch to including __END__ in the program and > then flocking DATA in the same way (a cheap trick, but effective :). > > -- > Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 > 777 0095 > target="l">http://www.stonehenge.com/merlyn/>Perl/Unix/security > consulting, Technical writing, Comedy, etc. etc. > See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl > training!TIMTOWTDI > TIMTOWTDI From merlyn at stonehenge.com Thu Jul 18 19:13:18 2002 From: merlyn at stonehenge.com (Randal L. Schwartz) Date: Wed Aug 4 00:05:39 2004 Subject: HTML filtering In-Reply-To: References: Message-ID: <86ptxkefs1.fsf@blue.stonehenge.com> >>>>> "josh" == josh hoblitt writes: josh> Perl CookBook page 628: josh> "On some operating systems, notably Solaris, you connot have multiple josh> children doing an accept on the same socket. You have to use file josh> locking to ensure that only one child can call accept at any particular josh> moment." No, that's a different problem, one which I thought I had avoided by using flock. :) *That* problem is a bunch of people doing accept() without any kind of flock(). However, as I was dragging around my preforking proxy server from machine to machine, it broke some places, but I can't recall where. Hence, I switched to a different strategy. -- 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! TIMTOWTDI From jhoblitt at mysun.com Thu Jul 18 19:26:39 2002 From: jhoblitt at mysun.com (josh hoblitt) Date: Wed Aug 4 00:05:39 2004 Subject: HTML filtering Message-ID: A blocking call to flock before calling accept on a HTTP::Daemon object and then releasing doesn't seem to solve the problem. But calling sleep 1 after an accept seems to make the problem go away as long as your making serialized connections. This is a snipet from HTTP::Daemon. I suspect I need to add some locking in there but I'm not sure exactly what SUPER is. Any ideas on what needs to be done? sub accept { my $self = shift; my $pkg = shift || "HTTP::Daemon::ClientConn"; my ($sock, $peer) = $self->SUPER::accept($pkg); if ($sock) { ${*$sock}{'httpd_daemon'} = $self; return wantarray ? ($sock, $peer) : $sock; } else { return; } } Thanks, -Joshua Hoblitt -- jhoblitt@mysun.com ----- Original Message ----- From: merlyn@stonehenge.com (Randal L. Schwartz) Date: Thursday, July 18, 2002 1:23 pm Subject: Re: HTML filtering > >>>>> "josh" == josh hoblitt writes: > > josh> I discovered something interesting: HTTP:Daemon doesn't work > correctlyjosh> on perl 5.6.1/solaris 8. The object will allow one > connection then die > josh> on the next attempt to call accept. I tried setting some > josh> IO::Socket::Inet options with no luck. The problem is fairly > lowleveljosh> as the OS is still holding the socket open for > sometime after the code > josh> exits. (I verified that the code still works on perl > 5.6.1/linux 2.4) > > One of my programs (the preforking server) broke under some OS > releases because flock() on the master socket isn't supported > properly. I had to switch to including __END__ in the program and > then flocking DATA in the same way (a cheap trick, but effective :). > > -- > Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 > 777 0095 > target="l">http://www.stonehenge.com/merlyn/>Perl/Unix/security > consulting, Technical writing, Comedy, etc. etc. > See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl > training!TIMTOWTDI > TIMTOWTDI From nforrett at wgz.com Thu Jul 18 20:06:55 2002 From: nforrett at wgz.com (n/a) Date: Wed Aug 4 00:05:39 2004 Subject: HTML filtering In-Reply-To: Message-ID: On Thu, 18 Jul 2002, josh hoblitt wrote: > I discovered something interesting: HTTP:Daemon doesn't work correctly > on perl 5.6.1/solaris 8. The object will allow one connection then die > on the next attempt to call accept. I tried setting some > IO::Socket::Inet options with no luck. The problem is fairly lowlevel > as the OS is still holding the socket open for sometime after the code > exits. (I verified that the code still works on perl 5.6.1/linux 2.4) > > Anyone have a solaris 8 box to try and replicate the issue? It just so happens that I have a Blade 100 lying around. I was trying to install OpenBSD on it yesterday (just for yucks). However, it was getting on 11PM when I finally realize this [and anyone who read my initial analysis of the self reproducing sprial code can attest to the fact that I am not at my sharpest that late at night ;-) ]. If you still want to try a Solaris 8 box, I can hook mine back up and give it a go. -- Nick ,--< Nick Forrette >--------------------------. | e-mail: nforrett@wgz.org | | www : http://www.drforehead.net/ | `---------------------------------------------' TIMTOWTDI From jhoblitt at mysun.com Thu Jul 18 23:10:11 2002 From: jhoblitt at mysun.com (josh hoblitt) Date: Wed Aug 4 00:05:39 2004 Subject: HTML filtering Message-ID: <131c3136a2.136a2131c3@mysun.com> > > If you still want to try a Solaris 8 box, I can hook mine back up > and give it > a go. > That would be great - I upgraded to perl 5.8.0 this morning (saw the announcement on p5p) and it has the same behavior. I suspect this is something do with Sun's c libs. The code I "copied" from merlyn is here: http://www.stonehenge.com/merlyn/WebTechniques/col11.html -J TIMTOWTDI From nforrett at wgz.com Thu Jul 18 23:21:06 2002 From: nforrett at wgz.com (n/a) Date: Wed Aug 4 00:05:39 2004 Subject: HTML filtering In-Reply-To: <131c3136a2.136a2131c3@mysun.com> Message-ID: On Thu, 18 Jul 2002, josh hoblitt wrote: > > If you still want to try a Solaris 8 box, I can hook mine back up > > and give it a go. > > That would be great - I upgraded to perl 5.8.0 this morning (saw the > announcement on p5p) and it has the same behavior. I suspect this is > something do with Sun's c libs. > > The code I "copied" from merlyn is here: > > http://www.stonehenge.com/merlyn/WebTechniques/col11.html I by this I assume that you didn't mod the code (or at least that modding the code is not necessary to reproduce the problem). Anyways, the box is at a friends (and not network accessible at the momement), so I'll have to get in touch with him and get in back online (after work, tomorrow, in all likelyhood). -- Nick ,--< Nick Forrette >--------------------------. | e-mail: nforrett@wgz.org | | www : http://www.drforehead.net/ | `---------------------------------------------' TIMTOWTDI From joshua_keroes at eli.net Fri Jul 19 01:35:15 2002 From: joshua_keroes at eli.net (Joshua Keroes) Date: Wed Aug 4 00:05:39 2004 Subject: [ANNOUNCE] Perl 5.8.0 Released Message-ID: <20020719063514.GE27503@eli.net> For the full announcement and download locations, see http://dev.perl.org/perl5/news/2002/07/18/580ann/ Wuv, Woshua TIMTOWTDI From tex at off.org Fri Jul 19 16:16:25 2002 From: tex at off.org (Austin Schutz) Date: Wed Aug 4 00:05:39 2004 Subject: 5.8 threads Message-ID: <20020719141625.A27293@gblx.net> Anyone had a chance to use them extensively? Are they usably stable? Austin TIMTOWTDI From joshua_keroes at eli.net Fri Jul 19 16:28:37 2002 From: joshua_keroes at eli.net (Joshua Keroes) Date: Wed Aug 4 00:05:40 2004 Subject: 5.8 threads In-Reply-To: <20020719141625.A27293@gblx.net> References: <20020719141625.A27293@gblx.net> Message-ID: <20020719212836.GN6127@eli.net> On (Fri, Jul 19 14:16), Austin Schutz wrote: > Anyone had a chance to use them extensively? Are they usably > stable? Well, all the tests passed when I installed 580. The rumors running around indicate that they are, indeed, stable. For info, see `perldoc perlthrtut` See also http://www.perl.com/pub/a/2002/06/11/threads.html , Artur's article on writing thread-safe modules. Maybe this helped? Joshua TIMTOWTDI From jasona at inetarena.com Fri Jul 19 20:29:26 2002 From: jasona at inetarena.com (Jason White) Date: Wed Aug 4 00:05:40 2004 Subject: Object Reference Message-ID: <002a01c22f8c$e373cfe0$5b86fc83@archer> I'm using Data::Dumper to save and restore objects. Here is my RestoreFromFile function. sub RestoreFromFile($){ my ($filename,$tmp,$VAR1); $filename=shift; $tmp=""; open(INFILE, "$filename"); while(){ $tmp.=$_; } eval $tmp; return $VAR1; # returns a reference to an object # Why does Data::Dumper format the dump so nicely? # I'm going to have to strip out all the newlines before writing to make this more useful } my $tmp = RestoreFromFile("objectfile"); I now have a pointer to my object($tmp) but how do I typedef it or anothr variable to the right object type? $tmp->ObjectMethod() doesn't work, it thinks I'm trying to invoke a method of a scalar (the reference) not the object type. Jason White P.S. There has to be a better serialization strategy, doesn't there? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/archives/pdx-pm-list/attachments/20020719/f99277a6/attachment.htm From jasona at inetarena.com Fri Jul 19 23:42:22 2002 From: jasona at inetarena.com (Jason White) Date: Wed Aug 4 00:05:40 2004 Subject: Data::Dumper Message-ID: <004e01c22fa7$d751c760$5b86fc83@archer> Alright, its probably just my ignorance, but Data::Dumper is crap. Its a great idea. I even find it acceptable as a method, however, I cannot get it to work. The darned eval returns a blessed reference and every time I try to access a method of a read object, I get "can't do some damned thing on unblessed reference." ref($VAR1) is scalar ref($$VAR1) is MyObjectType ref($$$VAR1) is some non-scalar error. I can't access this at any level I don't know how to typedef it to my object type (if that's even the problem). I can't find one solid example of writing an object to file, reading that same object back into memmory, and accessing it. I don't want a pointer to data I can't access, I want my object back. Since I'm not dealing with quantaties of objects here (no more than 10-12 at a time) I'm going to make some wimpy ->To_XML / ->From_XML or ->ToConfigGeneral / -> FromConfigGeneral functions and do it that way. I would still like to use Data::Dumper as I think it is a better model and I hate to think I resorted to an XML parser because I couldn't make a common module work. Jason White -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/archives/pdx-pm-list/attachments/20020719/7fa42091/attachment.htm From rb-pdx-pm at redcat.com Sat Jul 20 02:44:30 2002 From: rb-pdx-pm at redcat.com (Tom Phoenix) Date: Wed Aug 4 00:05:40 2004 Subject: Object Reference In-Reply-To: <002a01c22f8c$e373cfe0$5b86fc83@archer> Message-ID: On Fri, 19 Jul 2002, Jason White wrote: > I'm using Data::Dumper to save and restore objects. Didn't you see what Randal wrote to you about doing this? If you don't want to follow his advice, that's your right. But by doing so, you're implying that you have a good reason for ignoring Randal's suggestions. > sub RestoreFromFile($){ > my ($filename,$tmp,$VAR1); > $filename=shift; > $tmp=""; > open(INFILE, "$filename"); I'm sure that you put those quote marks in there because you wanted to exercise your typing fingers. So why not get even more exercise by pushing the backspace key after you typed them? :-) And it sure looks like you're not checking the return value from open(). Hmmm. > while(){ > $tmp.=$_; > } > eval $tmp; And you should check the result of $@ after an eval(), too, if you really must use eval. But what you're doing here looks a lot like the do() builtin. Right? > return $VAR1; # returns a reference to an object > # Why does Data::Dumper format the dump so nicely? Randal addressed that question in his earlier message. If you've misplaced it, I could send you a copy. :-) In the hope that it'll get you back on track, here's the executive summary of Randal's message: use Storable; Happy coding! --Tom Phoenix TIMTOWTDI From joshua_keroes at eli.net Sat Jul 20 03:00:46 2002 From: joshua_keroes at eli.net (Joshua Keroes) Date: Wed Aug 4 00:05:40 2004 Subject: Object Reference In-Reply-To: <002a01c22f8c$e373cfe0$5b86fc83@archer> References: <002a01c22f8c$e373cfe0$5b86fc83@archer> Message-ID: <20020720080046.GG27503@eli.net> You're making things too hard on yourself. Just require the file. File: test.pl #!/usr/bin/perl -w use strict; our $VAR1; require "stored.pl"; print $VAR1; exit; File: stored.pl $VAR1 = [ [ 'a', 'b', 'c' ], { 'foo' => 'bar', 'baz' => 're', 'qux' => 'quux' } ]; That's all there is to it. The nice thing about using require() is that you'll get an error if there are compilation problems in the data file. -Joshua PS Data::Dumper will let you name those variables using slightly different syntax. Say you had two variables named $foo and $bar. This method takes two arrayrefs. The first one contains the variables you wish to dump. The second one contains the names of the variables. ex. print Data::Dumper->Dump([$foo, $bar], ['foo', 'bar']) If you need to dump arrays or hashes, be sure to pass refs instead. ex. print Data::Dumper->Dump([\%hash, \@array], ['hash', 'array']); PPS There are plenty of serialization methods to choose from. Here are some that I've used: 1. Storable (freeze() / thaw() & store() / retrieve()) 2. YAML (Dump() / Load()) 3. XML::Simple (XMLout() / XMLin()) __END__ On (Fri, Jul 19 18:29), Jason White wrote: > I'm using Data::Dumper to save and restore objects. > > Here is my RestoreFromFile function. > > sub RestoreFromFile($){ > my ($filename,$tmp,$VAR1); > $filename=shift; > $tmp=""; > open(INFILE, "$filename"); > while(){ > $tmp.=$_; > } > eval $tmp; > return $VAR1; # returns a reference to an object > # Why does Data::Dumper format the dump so nicely? > # I'm going to have to strip out all the newlines before writing to make this more useful > } > > > my $tmp = RestoreFromFile("objectfile"); > > I now have a pointer to my object($tmp) but how do I typedef it or anothr variable to the right object type? > $tmp->ObjectMethod() doesn't work, it thinks I'm trying to invoke a method of a scalar (the reference) not the object type. > > Jason White > > P.S. There has to be a better serialization strategy, doesn't there? > TIMTOWTDI From joshua_keroes at eli.net Sat Jul 20 03:14:04 2002 From: joshua_keroes at eli.net (Joshua Keroes) Date: Wed Aug 4 00:05:40 2004 Subject: Object Reference In-Reply-To: <20020720080046.GG27503@eli.net> References: <002a01c22f8c$e373cfe0$5b86fc83@archer> <20020720080046.GG27503@eli.net> Message-ID: <20020720081404.GH27503@eli.net> On (Sat, Jul 20 01:00), Joshua Keroes wrote: > You're making things too hard on yourself. Just require the file. > > File: test.pl > > #!/usr/bin/perl -w > > use strict; > > our $VAR1; > require "stored.pl"; > print $VAR1; Whoops, this should really be: File: test.pl #!/usr/bin/perl -w use strict; use Data::Dumper; our $VAR1; require "stored.pl"; print Dumper($VAR1); Please remind yourself not to drink and reply to email. Think of the children! -Joshua TIMTOWTDI From jasona at inetarena.com Mon Jul 22 17:03:47 2002 From: jasona at inetarena.com (Jason Annin-White) Date: Wed Aug 4 00:05:40 2004 Subject: Object Reference References: Message-ID: <3D3C8143.4090307@inetarena.com> Tom, I didn't recieve the email from Randal. I haven't gotten many messages from the list in a week or so. I assumed it was because everybody was playing with 5.8 but maybe there's a problem someplace. Jason White Tom Phoenix wrote: >On Fri, 19 Jul 2002, Jason White wrote: > >>I'm using Data::Dumper to save and restore objects. >> > >Didn't you see what Randal wrote to you about doing this? If you don't >want to follow his advice, that's your right. But by doing so, you're >implying that you have a good reason for ignoring Randal's suggestions. > >>sub RestoreFromFile($){ >> my ($filename,$tmp,$VAR1); >> $filename=shift; >> $tmp=""; >> open(INFILE, "$filename"); >> > >I'm sure that you put those quote marks in there because you wanted to >exercise your typing fingers. So why not get even more exercise by pushing >the backspace key after you typed them? :-) And it sure looks like you're >not checking the return value from open(). Hmmm. > >> while(){ >> $tmp.=$_; >> } >> eval $tmp; >> > >And you should check the result of $@ after an eval(), too, if you really >must use eval. But what you're doing here looks a lot like the do() >builtin. Right? > >> return $VAR1; # returns a reference to an object >># Why does Data::Dumper format the dump so nicely? >> > >Randal addressed that question in his earlier message. If you've misplaced >it, I could send you a copy. :-) > >In the hope that it'll get you back on track, here's the executive summary >of Randal's message: > > use Storable; > >Happy coding! > >--Tom Phoenix > > > > TIMTOWTDI From jasona at inetarena.com Mon Jul 22 17:25:46 2002 From: jasona at inetarena.com (Jason Annin-White) Date: Wed Aug 4 00:05:40 2004 Subject: Mail list predators Message-ID: <3D3C866A.7050001@inetarena.com> I would just like to comment that not everybody in the list here is a perl pro and some of us are more adept at other languages, are making an effort to learn perl, but don't necesarily have the luxury of taking classes or spending hours reading the manuals. I am doing OOP in perl, I'm not just a jack-ass trying to figure out how to make my webpage catalouge MP3s. I appreciate constructive criticism such as quotes not being necesary when a scalar contains a string value (even if it doesn't come in a constructive format), however, I've gotten emails that were simply disparaging. The code I provide is a functional equivalent and is designed to layout what I am trying to accomplish without revealing intellectual property which I do not have the privillege to share. Sometimes it is lacking traps and such, but I am not here to ask about those things. I don't understand why people who obviouly have the answers to my strait-forward questions respond with violence and condescention rather than taking an equivalent amount of time to be helpful. This is not a stomping ground for the perl elite, it is a place for people like me to get help when they need it. The people doing this know who they are, as a helpful reply is always CC'd to the list while the non-helpful ones are not. If you aren't up to the task of helping others, please don't reply to their requests for help. My fondness for perl is based largely on the community. There are times I feel this list is failing that community, not because of a lack in information, but because of the way competent coders are treated when they ask for the benefit of other's experience. Jason White TIMTOWTDI From cp at onsitetech.com Mon Jul 22 16:37:41 2002 From: cp at onsitetech.com (Curtis Poe) Date: Wed Aug 4 00:05:40 2004 Subject: Mail list predators References: <3D3C866A.7050001@inetarena.com> Message-ID: <01bc01c231c8$0269e5f0$1a01a8c0@ot.onsitetech.com> I am not aware of the email that Jason is receiving, but I can definitely state that I have received some rather nasty email from people who, for whatever reason, fail to copy it to the list. Admittedly it can be difficult to judge intent from an email (which is why I like emoticons :), but let's try to be civil to one another. If we want more people to use Perl, flaming them is not a good way to go about it. If anyone else experiences a problem, feel free to forward the offending email to me and I can try to moderate things. -- Cheers, Curtis Poe Senior Programmer ONSITE! Technology, Inc. www.onsitetech.com 503-233-1418 Taking e-Business and Internet Technology To The Extreme! ----- Original Message ----- From: "Jason Annin-White" To: "Portland Perl Mongers" Sent: Monday, July 22, 2002 3:25 PM Subject: Mail list predators > I would just like to comment that not everybody in the list here is a > perl pro and some of us are more adept at other languages, are making an > effort to learn perl, but don't necesarily have the luxury of taking > classes or spending hours reading the manuals. I am doing OOP in perl, > I'm not just a jack-ass trying to figure out how to make my webpage > catalouge MP3s. I appreciate constructive criticism such as quotes not > being necesary when a scalar contains a string value (even if it doesn't > come in a constructive format), however, I've gotten emails that were > simply disparaging. The code I provide is a functional equivalent and > is designed to layout what I am trying to accomplish without revealing > intellectual property which I do not have the privillege to share. > Sometimes it is lacking traps and such, but I am not here to ask about > those things. > > I don't understand why people who obviouly have the answers to my > strait-forward questions respond with violence and condescention rather > than taking an equivalent amount of time to be helpful. This is not a > stomping ground for the perl elite, it is a place for people like me to > get help when they need it. The people doing this know who they are, as > a helpful reply is always CC'd to the list while the non-helpful ones > are not. If you aren't up to the task of helping others, please don't > reply to their requests for help. > > My fondness for perl is based largely on the community. There are times > I feel this list is failing that community, not because of a lack in > information, but because of the way competent coders are treated when > they ask for the benefit of other's experience. > > Jason White > > > TIMTOWTDI > TIMTOWTDI From rb-pdx-pm at redcat.com Mon Jul 22 16:43:22 2002 From: rb-pdx-pm at redcat.com (Tom Phoenix) Date: Wed Aug 4 00:05:40 2004 Subject: Object Reference In-Reply-To: <3D3C8143.4090307@inetarena.com> Message-ID: On Mon, 22 Jul 2002, Jason Annin-White wrote: > I didn't recieve the email from Randal. I haven't gotten many messages > from the list in a week or so. I assumed it was because everybody was > playing with 5.8 but maybe there's a problem someplace. I can't say about the problem, but you should get this twice (once from the list and once by direct mail). Let us know if you don't get it at all. :-) Here's what Randal wrote. Enjoy! --Tom From merlyn at stonehenge.com Thu Jul 18 01:32:09 2002 From: merlyn at stonehenge.com (Randal L. Schwartz) Date: Wed Aug 4 00:05:40 2004 Subject: Object IO Message-ID: >>>>> "Jason" == Jason White writes: Jason> What is the best method to read and write objects from file? Jason> Should I serialize the object? I've heard Data::Dumper Jason> mentioned for saving hashes, is it good for this purpose as Jason> well? Data::Dumper does too much work, making Perl code on the way out, and then having to eval it on the way in. My favorite is Storable, now part of the Perl core, but easily found in the CPAN for older Perls. Also look into Tie::MLDBM, which gives an indexed way to partition a file, using Storable automatically to store and retrieve complex objects. If you want something more interesting, look at Tangram, which provides an object to relational-database mapping. -- 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! TIMTOWTDI TIMTOWTDI From tkil at scrye.com Mon Jul 22 17:46:55 2002 From: tkil at scrye.com (Tkil) Date: Wed Aug 4 00:05:40 2004 Subject: Mail list predators In-Reply-To: <3D3C866A.7050001@inetarena.com> References: <3D3C866A.7050001@inetarena.com> Message-ID: >>>>> "Jason" == Jason Annin-White writes: Jason> some of us are [...] are making an effort to learn perl, but Jason> don't necesarily have the luxury of taking classes or spending Jason> hours reading the manuals. One way to look at "live" help (especially of the free variety, such as this list, IRC, usenet, etc) is that we can help you reduce those hours to minutes. There's a huge difference between: "Please tell me how to do X, I'm too hurried to read the manual" and "Where can I find out more about X? I've read the Y, Z, and T manual pages, and they seem close, but not quite. Here's what I've tried so far ... and it still doesn't work". If nothing else, the latter shows that you have tried to help yourself (and just need that last nudge over the crest of the hill) vs. expecting someone to lift you the whole way. In this particular case, I belive it was a miscommunication that sparked the worst of it (see below). Jason> I don't understand why people who obviouly have the answers to Jason> my strait-forward questions respond with violence and Jason> condescention rather than taking an equivalent amount of time Jason> to be helpful. It's a variant on the fish fable: Give someone a fish, and they eat for a day; Teach someone to fish, and they eat for a lifetime. In this case, if we just gave you the fish, the odds are that you would be back tomorrow with another question; or maybe you just had a one-time use for perl, and would wander off after we did your work for you. This can lead to bitterness and burnout on the part of the "perl elite". Jason> This is not a stomping ground for the perl elite, it is a place Jason> for people like me to get help when they need it. It's also a place for the "perl elite" to hang out and visit with each other and share insights. There's a reason that FAQ lists are so common -- the wizards get tired of answering the same thing over and over again. Put another way, the "perl elite" ("perlite?") would like to get something out of most of these exchanges: anything from a simple warm fuzzy from helping someone out, to reputation building, to learning new techniques. Having someone ask for help, then ignore it and ask again, pretty much kills all of these, and there's no motivation left (except maybe for people venting, which I agree is poor form). Would you rather get your hand held by wizards when you're first getting started (and have them be burned out when you really need help)? Or would you prefer to be put off a little at the beginning, so that they're available for deeper questions? Jason> If you aren't up to the task of helping others, please don't Jason> reply to their requests for help. Agreed. Jason> My fondness for perl is based largely on the community. Odd; I like perl because it thinks the way I do. Or, I think the way it does. Either way, my appreciation for the language and its power and expressiveness predates my involvement with the community. Jason> There are times I feel this list is failing that community, Please don't try guilt trips. They're very very annoying. Jason> not because of a lack in information, but because of the way Jason> competent coders are treated when they ask for the benefit of Jason> other's experience. I've largely dropped out of the active Perl community for this reason. Even though I know it's only a very few people, they made the experience of trying to help others deeply poisonous by their very presence. It helps to have thick skin in these parts; mine isn't thick enough, but at least e-mail is mellow enough to not get my blood pressure up too high. In my experience, Tom Phoenix is NOT one of these evil people, and neither is Randal. In fact, I think of Tom as a kind, patient, and courteous person on IRC and UseNet. I expect that his sharp reply was due to his perception that you were ignoring Randal and trying to do it your way even after Randal told you a better way. You asked for the benefit of others' experience, and then you seemed to ignore it. Why should they then treat your next query with any respect, since you don't respect them? (I'm not saying that this is how they feel about it, I'm just conjecturing.) Finally, remember that even the "perl elite" are human, and can get up on the wrong side of the bed, and have bad days just like the rest of us. If you do get grumpy e-mail, just let it go. t. p.s. Sorry for being so long-winded about it. This isn't the first time I've hit this phenomenon; when it was happening on the #perl channel, I ended up writing this: http://slinky.scrye.com/~tkil/perl/pound-perl.html TIMTOWTDI From jasona at inetarena.com Mon Jul 22 19:14:34 2002 From: jasona at inetarena.com (Jason Annin-White) Date: Wed Aug 4 00:05:40 2004 Subject: Object IO (Typedef problem) Message-ID: <3D3C9FEA.5030103@inetarena.com> Thank you Randal, I am now using Storable. I am still pretty much in the same boat however. I can't find any perl documentation on how to typedef a reference to a custom object. I have a package which I've named PDX::service. When I store and retrieve an instance of PDX::service I am left with a reference. I know how to typedef a reference to a scalar, array, or hash, however, I do no know how to typedef the reference to be of type PDX::service. I've made pitiful attampts such as PDX::service$objref->method() and $$objref->method() to no avail. ref($objectref) returns main. ref($$objectref) returns PDX::service This makes me think that THIS is the appropriate way to access this object: PDX::service$$objref->method() This returns no errors, like my other attempts did, however, it retuned no data either. Does retrive() is it possible that my retrieved object has members but no methods and doesn't "truly" belong to type PDX::service? Jason White >From merlyn@stonehenge.com Mon Jul 22 14:41:48 2002 Date: 17 Jul 2002 23:32:09 -0700 From: Randal L. Schwartz To: Jason White Cc: perl Subject: Re: Object IO >>>>>>>>>> "Jason" == Jason White writes: >>>>> Jason> What is the best method to read and write objects from file? Jason> Should I serialize the object? I've heard Data::Dumper Jason> mentioned for saving hashes, is it good for this purpose as Jason> well? Data::Dumper does too much work, making Perl code on the way out, and then having to eval it on the way in. My favorite is Storable, now part of the Perl core, but easily found in the CPAN for older Perls. Also look into Tie::MLDBM, which gives an indexed way to partition a file, using Storable automatically to store and retrieve complex objects. If you want something more interesting, look at Tangram, which provides an object to relational-database mapping. -- 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! TIMTOWTDI TIMTOWTDI From masque at pobox.com Mon Jul 22 18:41:06 2002 From: masque at pobox.com (Masque) Date: Wed Aug 4 00:05:40 2004 Subject: Mail list predators In-Reply-To: Message-ID: <7E188C0A-9DCC-11D6-BFE7-000393450866@pobox.com> On Monday, July 22, 2002, at 06:46 PM, Tkil wrote: > It's a variant on the fish fable: > > Give someone a fish, and they eat for a day; > Teach someone to fish, and they eat for a lifetime. And the result, if you don't provide a good-faith basis for your help request (as Tkil so aptly describes,) is that you will find that people use the following variant instead: Build a man a fire and you keep him warm for the night; Set a man on fire and you keep him warm for the rest of his life. Masque. TIMTOWTDI From jasona at inetarena.com Mon Jul 22 20:13:32 2002 From: jasona at inetarena.com (Jason Annin-White) Date: Wed Aug 4 00:05:40 2004 Subject: Mail list predators References: <3D3C866A.7050001@inetarena.com> Message-ID: <3D3CADBC.1040700@inetarena.com> I have my mail set up to leave messages on the server at several locations and I definitley did not receive a response from Randal (Thank you Tom for getting it to me). I was not implicating either Randal or Tom in my unpleasant experiences. I hope it didn't sound that way. For the record, I always at least skim the documentation and read all of the examples given before I ask questions here unless I'm asking advice on which direction I should travel in an unexplored territory (such as Which XML modules are worth my time, etc.). I also perform extensive trial and error prior to asking for help. I had no trouble using Data::Dumper to the extent that is was documented. The trouble I was having was beyond or at least to the side of the scope of Data::Dumper's documentation. I also visited literally hundreds of websites and read through each of the examples given. None of them are doing what I am trying to do, which is straitforward in most other languages. I can't `perldoc typedef` or `perldoc reference` so I dropped in here to ask for help in accessing my restored objects. I didn't come here begging for fish, I came here asking to watch a pro fillet one, which is what the sign over the door offers. I didn't realize that I would have to prove how hard I've already tried before my questions would be worthy. I try not to waste your time with frivilous details about yadda, yadda, yadda. I get tired of reading through what somebody has already done (especilly since it wasn't working) when I recieve hundreds of messages per day. I formulate a question which is strait forward and includes relevent details and code examples. Easy to read, easy to understand, easy to descide if you have the answer or not. I monitor this list as well, if you think you're burnt out by newbie requests on this list, you should try joining some of the lists I contribute to. You can't be too burnt out if you have the time and energy to line-by-line comment through my email. You don't teach how to fish Tkil, you dangle the fish and say you might teach somebody how after you've had sufficient entertainment watching them thrash around knee-deep in water. Get off your high horse and do something useful. Jason White Tkil wrote: >>>>>>"Jason" == Jason Annin-White writes: >>>>>> > >Jason> some of us are [...] are making an effort to learn perl, but >Jason> don't necesarily have the luxury of taking classes or spending >Jason> hours reading the manuals. > >One way to look at "live" help (especially of the free variety, such >as this list, IRC, usenet, etc) is that we can help you reduce those >hours to minutes. There's a huge difference between: > > "Please tell me how to do X, I'm too hurried to read the manual" > >and > > "Where can I find out more about X? I've read the Y, Z, and T > manual pages, and they seem close, but not quite. Here's what I've > tried so far ... and it still doesn't work". > >If nothing else, the latter shows that you have tried to help yourself >(and just need that last nudge over the crest of the hill) vs. >expecting someone to lift you the whole way. > >In this particular case, I belive it was a miscommunication that >sparked the worst of it (see below). > >Jason> I don't understand why people who obviouly have the answers to >Jason> my strait-forward questions respond with violence and >Jason> condescention rather than taking an equivalent amount of time >Jason> to be helpful. > >It's a variant on the fish fable: > > Give someone a fish, and they eat for a day; > Teach someone to fish, and they eat for a lifetime. > >In this case, if we just gave you the fish, the odds are that you >would be back tomorrow with another question; or maybe you just had a >one-time use for perl, and would wander off after we did your work for >you. > >This can lead to bitterness and burnout on the part of the "perl >elite". > >Jason> This is not a stomping ground for the perl elite, it is a place >Jason> for people like me to get help when they need it. > >It's also a place for the "perl elite" to hang out and visit with each >other and share insights. There's a reason that FAQ lists are so >common -- the wizards get tired of answering the same thing over and >over again. > >Put another way, the "perl elite" ("perlite?") would like to get >something out of most of these exchanges: anything from a simple warm >fuzzy from helping someone out, to reputation building, to learning >new techniques. Having someone ask for help, then ignore it and ask >again, pretty much kills all of these, and there's no motivation left >(except maybe for people venting, which I agree is poor form). > >Would you rather get your hand held by wizards when you're first >getting started (and have them be burned out when you really need >help)? Or would you prefer to be put off a little at the beginning, >so that they're available for deeper questions? > >Jason> If you aren't up to the task of helping others, please don't >Jason> reply to their requests for help. > >Agreed. > >Jason> My fondness for perl is based largely on the community. > >Odd; I like perl because it thinks the way I do. Or, I think the way >it does. Either way, my appreciation for the language and its power >and expressiveness predates my involvement with the community. > >Jason> There are times I feel this list is failing that community, > >Please don't try guilt trips. They're very very annoying. > >Jason> not because of a lack in information, but because of the way >Jason> competent coders are treated when they ask for the benefit of >Jason> other's experience. > >I've largely dropped out of the active Perl community for this >reason. Even though I know it's only a very few people, they made the >experience of trying to help others deeply poisonous by their very >presence. It helps to have thick skin in these parts; mine isn't >thick enough, but at least e-mail is mellow enough to not get my blood >pressure up too high. > >In my experience, Tom Phoenix is NOT one of these evil people, and >neither is Randal. In fact, I think of Tom as a kind, patient, and >courteous person on IRC and UseNet. > >I expect that his sharp reply was due to his perception that you were >ignoring Randal and trying to do it your way even after Randal told >you a better way. You asked for the benefit of others' experience, >and then you seemed to ignore it. Why should they then treat your >next query with any respect, since you don't respect them? (I'm not >saying that this is how they feel about it, I'm just conjecturing.) > >Finally, remember that even the "perl elite" are human, and can get up >on the wrong side of the bed, and have bad days just like the rest of >us. If you do get grumpy e-mail, just let it go. > >t. > >p.s. Sorry for being so long-winded about it. This isn't the first > time I've hit this phenomenon; when it was happening on the #perl > channel, I ended up writing this: > > http://slinky.scrye.com/~tkil/perl/pound-perl.html > > > TIMTOWTDI From nforrett at wgz.com Mon Jul 22 18:56:28 2002 From: nforrett at wgz.com (n/a) Date: Wed Aug 4 00:05:40 2004 Subject: Object IO (Typedef problem) In-Reply-To: <3D3C9FEA.5030103@inetarena.com> Message-ID: On Mon, 22 Jul 2002, Jason Annin-White wrote: > Thank you Randal, I am now using Storable. > > I am still pretty much in the same boat however. I can't find any perl > documentation on how to typedef a reference to a custom object. I have a > package which I've named PDX::service. When I store and retrieve an > instance of PDX::service I am left with a reference. I know how to > typedef a reference to a scalar, array, or hash, however, I do no know how > to typedef the reference to be of type PDX::service. > > I've made pitiful attampts such as PDX::service$objref->method() and > $$objref->method() to no avail. > > ref($objectref) returns main. > ref($$objectref) returns PDX::service $obj = $$objectref ; ... should do the trick. Just like a pointer to a pointer to a struct in C. -- Nick ,--< Nick Forrette >--------------------------. | e-mail: nforrett@wgz.org | | www : http://www.drforehead.net/ | `---------------------------------------------' TIMTOWTDI From tkil at scrye.com Mon Jul 22 19:09:26 2002 From: tkil at scrye.com (Tkil) Date: Wed Aug 4 00:05:40 2004 Subject: Object IO (Typedef problem) In-Reply-To: <3D3C9FEA.5030103@inetarena.com> References: <3D3C9FEA.5030103@inetarena.com> Message-ID: >>>>> "Jason" == Jason Annin-White writes: Jason> I am still pretty much in the same boat however. I can't find Jason> any perl documentation on how to typedef a reference to a Jason> custom object. "typedef" is a concept from C, and there's no particular correlate in Perl (that I can think of, anyway). Perhaps you mean "typecast"? Jason> I have a package which I've named PDX::service. When I store Jason> and retrieve an instance of PDX::service I am left with a Jason> reference. I know how to typedef a reference to a scalar, Jason> array, or hash, however, I do no know how to typedef the Jason> reference to be of type PDX::service. Um ... it already is (or should be) a reference to a PDX::service object; why do you need to cast it further? Jason> ref($objectref) returns main. Jason> ref($$objectref) returns PDX::service Ah. It looks like you tried to freeze it using something like: my $serialized = freeze \$obj; Which freezes a reference to a reference, and that's what you get back. Since you already have a reference, you don't need the extra level of indirection; just freeze $obj itself. Jason> This makes me think that THIS is the appropriate way to access Jason> this object: Jason> PDX::service$$objref->method() I think that ($$objref)->method() should work... let me try it. Yup: | #!/usr/bin/perl -w | | use strict; | | use Storable qw( freeze thaw ); | | # ---------------------------------------------------------------------- | | package Foo; | | sub new | { | my ($package, $info) = @_; | return bless { info => $info }; | } | | sub babble | { | my ($self, $label) = @_; | print "$label: I'm a " . ref($self) . ", and I know $self->{info}\n"; | } | | # ---------------------------------------------------------------------- | | package main; | | my $foo1 = Foo->new("eeba deeba!"); | $foo1->babble('$foo1'); | | my $stored_foo1 = freeze $foo1; | | my $foo2 = thaw $stored_foo1; | $foo2->babble('$foo2'); | | my $stored_foo_ref = freeze \$foo1; | my $foo3 = thaw $stored_foo_ref; | print 'ref($foo3)=', ref($foo3), "\n"; | print 'ref($$foo3)=', ref($$foo3), "\n"; | | ($$foo3)->babble('$$foo3'); | | exit 0; Which gives us: | $ ./jason1 | $foo1: I'm a Foo, and I know eeba deeba! | $foo2: I'm a Foo, and I know eeba deeba! | ref($foo3)=REF | ref($$foo3)=Foo | $$foo3: I'm a Foo, and I know eeba deeba! Jason> This returns no errors, like my other attempts did, however, it Jason> retuned no data either. Does retrive() is it possible that my Jason> retrieved object has members but no methods and doesn't "truly" Jason> belong to type PDX::service? What you got back was a reference to an object. If you dereference it once, you have just the object, and you can do normal method calls on it. Does this clear it up? t. TIMTOWTDI From plumpy at krimedawg.org Mon Jul 22 19:13:02 2002 From: plumpy at krimedawg.org (Michael P) Date: Wed Aug 4 00:05:40 2004 Subject: Object IO (Typedef problem) In-Reply-To: <3D3C9FEA.5030103@inetarena.com> Message-ID: On Mon, 22 Jul 2002, Jason Annin-White wrote: > I am still pretty much in the same boat however. I can't find any perl > documentation on how to typedef a reference to a custom object. You 'bless' it. 'perldoc -f bless'. But, see below. > ref($objectref) returns main. > ref($$objectref) returns PDX::service I mean this, of course, in the least condescending way possible: I think you're doing it wrong. The reference you get back from Storable should already be blessed into the package it was originally in. You shouldn't have to do anything special to it. See the sample code below. > This makes me think that THIS is the appropriate way to access this object: > PDX::service$$objref->method() $$objectref->method() might work. It's hard to say, though, depending on what other magic you're doing elsewhere. Here's some extremely pared-down code that might help you with basic Storable usage: #!/usr/bin/perl use strict; use Storable; my $created = PDXPM->new(); $created->set_name("Jason"); $created->hello(); # Save this newly created object in the file "pdxpm.store". store($created, "pdxpm.store"); # Retrieve the data out of the file. my $loaded = retrieve("pdxpm.store"); $loaded->hello(); # Object definitions... package PDXPM; sub new { my $proto = shift; return bless({}, ref($proto) || $proto); } sub set_name { my $self = shift; $self->{_name} = shift; } sub get_name { my $self = shift; return $self->{_name}; } sub hello { my $self = shift; print "Hello, ", $self->get_name(), "!\n"; } TIMTOWTDI From plumpy at krimedawg.org Mon Jul 22 19:46:34 2002 From: plumpy at krimedawg.org (Michael P) Date: Wed Aug 4 00:05:40 2004 Subject: Object IO (Typedef problem) In-Reply-To: <3D3C9FEA.5030103@inetarena.com> Message-ID: On Mon, 22 Jul 2002, Jason Annin-White wrote: > I know how to typedef a reference to a scalar, array, or hash, however, > I do no know how to typedef the reference to be of type PDX::service. By the way, just for clarification, you're talking about two different things here. In perl, you can have references to scalars, arrays, hashes, code or globs. You can then dereference them to get the original value. "objects" (like PDX::service), however, are not a seperate type. Your PDX::service "object" is not actually its own type, but rather is itself a reference (99% of the time it's a reference to hash, but it could also be a reference to a scalar, array, or anything else). So on most objects, you can treat them as hashrefs and do things like $object->{barf} = "dog"; Your PDX::service object just contains some magic to allow you to call methods on it. You create that magic when you use the bless() function. Using bless() does NOT change the fact that you still have a hashref. It just adds some special magic to the hashref that allows you to say $object->method(); I don't know if that helps clear up any confusion or not. Anyway, the point is: there are no typedefs. TIMTOWTDI From lemming at attbi.com Mon Jul 22 19:56:18 2002 From: lemming at attbi.com (Mark Morgan) Date: Wed Aug 4 00:05:40 2004 Subject: Mail list predators References: <3D3C866A.7050001@inetarena.com> <3D3CADBC.1040700@inetarena.com> Message-ID: <3D3CA9B2.10209@attbi.com> Jason Annin-White wrote: > I have my mail set up to leave messages on the server at several > locations and I definitley did not receive a response from Randal (Thank > you Tom for getting it to me). I was not implicating either Randal or > Tom in my unpleasant experiences. I hope it didn't sound that way. ^^^That was nice. For the record, I didn't read the original thread, but I just checked the new thread. I didn't think Tkil came off that abrasive. Fairly direct and not that bad considering the message he answered. We're all volunteers and sometimes life gets in the way of helping out here. Let's not get into a flame fest. Take sometime to think how a message will come across before sending. Back to life for me, Mark TIMTOWTDI From tkil at scrye.com Mon Jul 22 20:04:41 2002 From: tkil at scrye.com (Tkil) Date: Wed Aug 4 00:05:40 2004 Subject: Mail list predators In-Reply-To: <3D3CADBC.1040700@inetarena.com> References: <3D3C866A.7050001@inetarena.com> <3D3CADBC.1040700@inetarena.com> Message-ID: <15676.43945.403461.307466@brand.scrye.com> >>>>> "Jason" == Jason Annin-White writes: [out of order, but this needed to be answered first.] Jason> I monitor this list as well, if you think you're burnt out by Jason> newbie requests on this list, you should try joining some of Jason> the lists I contribute to. *shrug* I've put in my time on usenet and irc. While I don't do those anymore, I do help out on various Perl and Linux lists. I wouldn't refer to myself as a wizard, but I do have relatively deep knowledge of a few fields. When a hard question in one of those fields comes up, I try to contribute usefully. Jason> You can't be too burnt out if you have the time and energy to Jason> line-by-line comment through my email. Believe it or not, I was trying to be courteous. I happen to find the point-by-point style much more useful than having the original and response in two different chunks; the interleaved style used to be the majority, until various MUAs and newsreaders started changing their default behavior. Jason> You don't teach how to fish Tkil, you dangle the fish and say Jason> you might teach somebody how after you've had sufficient Jason> entertainment watching them thrash around knee-deep in water. Jason> Get off your high horse and do something useful. Hm. I disagree with this assessment, and I suspect that some of the people who knew me back when I had more energy would also disagree. [back to the original order] Jason> I was not implicating either Randal or Tom in my unpleasant Jason> experiences. I hope it didn't sound that way. I apologize for coming to this erroneous conclusion; Tom's response was the only one I saw publicly, and it did sound a bit sharp to me (particularly given that Tom is, in my experience, very patient and mellow with people). Sorry about that. Jason> None of them are doing what I am trying to do, which is Jason> straitforward in most other languages. I think that this touches very close to what set me off with some of your questions: - They don't do *exactly* what you're doing. Well, what can you generalize from them? What small-scale experiments did you run, to try to determine the behavior of perl, to verify your assumptions, try different solutions to smaller and more focused problems? The sample program I included in a different message is the sort of small-scale experiment that I'm referring to. - "straightforward in most other languages". That's a loaded phrase; which other languages are you referring to? Object serialization is hardly trivial in traditional 3rd-gen languages (C, C++); Java has it, and it is indeed straightforward there. Visual Basic? Lisp? Prolog? Python (which does have a very nice freeze/thaw system, IIRC). Assembly? Ha. :) And when you say straightforward, does that take into account portability between architectures, little-/big-endian, network byte order, end-of-stream signaling, database persistence...? In this instance, it seems that the fundamental issue (after Randal steered you towards Storable as being superior to Data::Dumper) was an unclear understanding of references and objects in perl. That's nothing to be ashamed about -- but without us asking some questions that can sound hard at times, we never would have found out where your code was really having the problem. Jason> I can't `perldoc typedef` or `perldoc reference` so I dropped Jason> in here to ask for help in accessing my restored objects. perlref was probably the one you were looking for (and also perlobj; there are corresponding tutorials, "perlreftut" and "perltoot"). These are listed if you do "perldoc perl". Jason> I didn't come here begging for fish, I came here asking to Jason> watch a pro fillet one, which is what the sign over the door Jason> offers. To continue this analogy, I saw you asking "how do i filet this nice bit of trout here?" Randal suggested "lengthwise"; due to a mis- communication, you went ahead cutting it straight across, then asked us how to remove the bones. Jason> I get tired of reading through what somebody has already done Jason> (especilly since it wasn't working) Ah, but the history of what you've tried (as well as an idea of what your overall comfort level is) will help us figure out what the real question is. Most importantly, it tells us *what* you're trying to do, not *how* you're trying to do it. (The former is obviously much more valuable than the latter, since the latter isn't working -- would you rather help someone by understanding their real needs, or by reverse-engineering code that you know isn't really doing what they want anyway?) There's a phrase we used on the IRC channel: "the X-Y problem": They ask how to do X, but that's because they really want to do Y but think X will get them there Jason> when I recieve hundreds of messages per day. Might I suggest a better mail-reading setup? I see about 500 messages a day (as well as following linux-kernel on a private newsgroup feed, so that's another 150-ish per day). A combination of procmail and a newsreader does wonders for dealing with high volumes of mail. Jason> I formulate a question which is strait forward and includes Jason> relevent details and code examples. Easy to read, easy to Jason> understand, easy to descide if you have the answer or not. At least one of your replies clarified things (the bit about trying to preserve the format/structure of an existing codebase, and the implicit desire to alter the structure of that code as little as possible while adding the necessary functionality). That was completely missing in the original post. Anyway. I didn't mean to pick on you in particular; I was just trying to explain why some people tend to fly off the handle at some questions, and maybe some ideas that you could incorporate to get better responses (both less hostile and more informative). If you are based in the PDX area and are interested, maybe I can stand you a pint the next time I'm in the area. Thanks, t. TIMTOWTDI From lemming at attbi.com Mon Jul 22 23:25:34 2002 From: lemming at attbi.com (Mark Morgan) Date: Wed Aug 4 00:05:40 2004 Subject: Mail list fishing References: <3D3C866A.7050001@inetarena.com> <3D3CADBC.1040700@inetarena.com> <15676.43945.403461.307466@brand.scrye.com> Message-ID: <3D3CDABE.5080902@attbi.com> Tkil wrote: >>>>>>"Jason" == Jason Annin-White writes > Jason> I didn't come here begging for fish, I came here asking to > Jason> watch a pro fillet one, which is what the sign over the door > Jason> offers. > > To continue this analogy, I saw you asking "how do i filet this nice > bit of trout here?" Randal suggested "lengthwise"; due to a mis- > communication, you went ahead cutting it straight across, then asked > us how to remove the bones. Well, if we're talking fish: http://www.perlmonks.org/index.pl?node_id=85541 TIMTOWTDI From cp at onsitetech.com Tue Jul 23 10:17:25 2002 From: cp at onsitetech.com (Curtis Poe) Date: Wed Aug 4 00:05:40 2004 Subject: STOP: Re: Mail list fishing References: <3D3C866A.7050001@inetarena.com> <3D3CADBC.1040700@inetarena.com> <15676.43945.403461.307466@brand.scrye.com> <3D3CDABE.5080902@attbi.com> Message-ID: <021e01c2325c$0d5faff0$1a01a8c0@ot.onsitetech.com> Okay everyone, some of the comments in this thread have crossed the line. End this thread. -- Cheers, Curtis Poe Senior Programmer ONSITE! Technology, Inc. www.onsitetech.com 503-233-1418 Taking e-Business and Internet Technology To The Extreme! TIMTOWTDI From masque at pobox.com Tue Jul 23 12:20:00 2002 From: masque at pobox.com (Masque) Date: Wed Aug 4 00:05:40 2004 Subject: STOP: Re: Mail list fishing In-Reply-To: <021e01c2325c$0d5faff0$1a01a8c0@ot.onsitetech.com> Message-ID: <6B1CD982-9E60-11D6-9BD9-000393450866@pobox.com> On Tuesday, July 23, 2002, at 11:17 AM, Curtis Poe wrote: > Okay everyone, some of the comments in this thread have crossed the > line. > End this thread. Indeed. Especially the light-hearted link to the fish dinner recipe. Not only did it lighten the discussion, it made me hungry. This will not be tolerated. Masque. TIMTOWTDI From masque at pobox.com Tue Jul 23 12:07:15 2002 From: masque at pobox.com (Masque) Date: Wed Aug 4 00:05:40 2004 Subject: Mail list predators In-Reply-To: <15676.43945.403461.307466@brand.scrye.com> Message-ID: On Monday, July 22, 2002, at 09:04 PM, Tkil wrote: > Jason> You don't teach how to fish Tkil, you dangle the fish and say > Jason> you might teach somebody how after you've had sufficient > Jason> entertainment watching them thrash around knee-deep in water. > Jason> Get off your high horse and do something useful. > > Hm. I disagree with this assessment, and I suspect that some of the > people who knew me back when I had more energy would also disagree. I wholeheartedly disagree with Jason's assessment as well. Tkil has proven to be one of the more helpful (and reasonable) perlers around time and time again. Masque. TIMTOWTDI From tex at off.org Tue Jul 23 12:43:48 2002 From: tex at off.org (Austin Schutz) Date: Wed Aug 4 00:05:40 2004 Subject: 5.8 threads In-Reply-To: <20020719212836.GN6127@eli.net>; from joshua_keroes@eli.net on Fri, Jul 19, 2002 at 02:28:37PM -0700 References: <20020719141625.A27293@gblx.net> <20020719212836.GN6127@eli.net> Message-ID: <20020723104348.B4503@gblx.net> On Fri, Jul 19, 2002 at 02:28:37PM -0700, Joshua Keroes wrote: > On (Fri, Jul 19 14:16), Austin Schutz wrote: > > Anyone had a chance to use them extensively? Are they usably > > stable? > > Well, all the tests passed when I installed 580. The rumors running > around indicate that they are, indeed, stable. > Was hoping for actual operational experience. Thus 'use them extensively'. > For info, see `perldoc perlthrtut` > > See also http://www.perl.com/pub/a/2002/06/11/threads.html , Artur's > article on writing thread-safe modules. > > Maybe this helped? Somewhat. The thread safe article is interesting. I appreciate the pointers. Austin TIMTOWTDI From cp at onsitetech.com Tue Jul 23 13:34:50 2002 From: cp at onsitetech.com (Curtis Poe) Date: Wed Aug 4 00:05:40 2004 Subject: Mailing list etiquette References: <6B1CD982-9E60-11D6-9BD9-000393450866@pobox.com> Message-ID: <02cf01c23277$a2dcedc0$1a01a8c0@ot.onsitetech.com> It appears that there needs to be some clarification regarding how to behave ourselves on this mailing list. I don't want to be the heavy, but sometimes that is what is necessary. Incidentally, I had originally applied to the "mail list fishing" email by Mark Morgan. I was referring to some of the personal attacks in the mail list predators thread. Sorry if there was any confusion. Mark's a great guy and I appreciated his email. Thanks for pointing that out, masque. Here's why I wanted the "mail list predators" thread ended: some of the comments in the thread were personal attacks. That's not appropriate. Even if someone deserves the comments hurled at them, they're out of place in a public forum. If someone must chip away at someone else, they can do so privately without copying it to the list. We don't need public spats. This is a common problem with virtually community, so all I'm asking is that we remain civil to one another in public. Here are my ad-hoc rules for posting (as you can tell, I'm making this up as I go along). Note that these are general guidelines and do not necessarily reflect behavior that I have seen on this list. This list, for the most part, has been pretty good. 1. It's okay to tell someone to RTFM, but the F had better be silent. Also, a link to where they can R the FM would be nice. Many people new to Perl (or to computers in general) are either unaware of the documentation or don't know where to find it. Honestly, many people don't even *know* about "perlthrtut", yet will ask questions answered there. 2. No profanity directed at another in anger. I don't necessarily want to see profanity on the list, but I don't want to censor anyone, either, so I'll keep my piece -- until someone tells someone else that /^s?he's$/ an /f[[:alpha:]]{3}ing/ idiot. 3. No insults. It's okay to tell me that I wrote a bad piece of code, but telling me that I'm stupid is out of line (this is just an example). It may be true that I'm stupid, but if you must say it, keep it private. Side note: while some may find it emotionally satisfying to tell someone else off in public, it still tends to leave a bad taste in the mouths of others. If I tell someone that they're a moron, many might agree with me, but still think it rude that I say so publicly. If you don't understand why, then you're a moron :) (ooh... I just know I'm going to hear it for that one). Please email me *privately* on whether or not you agree with this. I don't want a flame-fest. If enough people feel that the right to insult one another publicly should be preserved, then I'll relent. Cheers, Curtis "Ovid" Poe TIMTOWTDI From nforrett at wgz.com Tue Jul 23 13:36:14 2002 From: nforrett at wgz.com (n/a) Date: Wed Aug 4 00:05:40 2004 Subject: STOP: Re: Mail list fishing In-Reply-To: <6B1CD982-9E60-11D6-9BD9-000393450866@pobox.com> Message-ID: On Tuesday, July 23, 2002, at 11:17 AM, Curtis Poe wrote: > Okay everyone, some of the comments in this thread have crossed the > line. > End this thread. I don't know. The way things have been going, someone is bound to trigger Godwin's Law pretty soon. ;-) For those not familiar with Godwin's Law: http://www.tuxedo.org/~esr/jargon/html/entry/Godwin's-Law.html -- Nick ,--< Nick Forrette >--------------------------. | e-mail: nforrett@wgz.org | | www : http://www.drforehead.net/ | `---------------------------------------------' TIMTOWTDI From tex at off.org Tue Jul 23 14:32:37 2002 From: tex at off.org (Austin Schutz) Date: Wed Aug 4 00:05:40 2004 Subject: STOP: Re: Mail list fishing In-Reply-To: ; from nforrett@wgz.com on Tue, Jul 23, 2002 at 11:36:14AM -0700 References: <6B1CD982-9E60-11D6-9BD9-000393450866@pobox.com> Message-ID: <20020723123237.C4503@gblx.net> A few brief observations, all IMO: Perl's community has a very strong reputation for being severely abrasive. That has been true in my own experience, and doesn't seem to be true of other communities, e.g. Python. This holds true for usenet, irc, perl monks, etc. People will make judgements of a group from a very small sampling of negative data. I have made a point of steering clear of perl monks based upon my first and only experience, which was quite negative. TMTOWTDI means that even though there is usually a well known way to do something, someone else's method isn't dumb. In fact, it's probably done in the core modules in an undocumented fashion. Turn down the flame thrower. Aah, I dunno. Where's the beer? Austin TIMTOWTDI From mikeraz at patch.com Tue Jul 23 15:49:48 2002 From: mikeraz at patch.com (mikeraz@patch.com) Date: Wed Aug 4 00:05:40 2004 Subject: Mailing list etiquette In-Reply-To: <02cf01c23277$a2dcedc0$1a01a8c0@ot.onsitetech.com>; from cp@onsitetech.com on Tue, Jul 23, 2002 at 11:34:50AM -0700 References: <6B1CD982-9E60-11D6-9BD9-000393450866@pobox.com> <02cf01c23277$a2dcedc0$1a01a8c0@ot.onsitetech.com> Message-ID: <20020723134948.B12796@patch.com> On Tue, Jul 23, 2002 at 11:34:50AM -0700, Curtis Poe typed: > 2. No profanity directed at another in anger. I don't necessarily want to > see profanity on the list, but I don't want to censor anyone, either, so > I'll keep my piece -- until someone tells someone else that /^s?he's$/ an > /f[[:alpha:]]{3}ing/ idiot. farting? I know yeasty microbrews contribute to flatulence but . . . OT - Oregon Brewers Festival this weekend. ID me and ID yourself as a pdx-pm contributor and I'll buy you a sample of something. Free Beer as in, well, Free Beer. > 3. No insults. It's okay to tell me that I wrote a bad piece of code, but > telling me that I'm stupid is out of line (this is just an example). It may > be true that I'm stupid, but if you must say it, keep it private. -- Michael Rasmussen aka mikeraz Be appropriate && Follow your curiosity http://www.patch.com/ http://wiki.patch.com/ http://blog.patch.com/sandbox/ "They that give up essential liberty to obtain temporary safety, deserve neither liberty nor safety." -- Benjamin Franklin and the fortune cookie says: Associate with well-mannered persons and your manners will improve. Run with decent folk and your own decent instincts will be strengthened. Keep the company of bums and you will become a bum. Hang around with rich people and you will end by picking up the check and dying broke. -- Stanley Walker TIMTOWTDI From cp at onsitetech.com Tue Jul 23 16:04:26 2002 From: cp at onsitetech.com (Curtis Poe) Date: Wed Aug 4 00:05:40 2004 Subject: Fw: Switching mailing lists Message-ID: <033201c2328c$87e2e780$1a01a8c0@ot.onsitetech.com> Hmm... this apparently didn't go through. I suspect that's due to the offense s*u_b*s_c*r_i*b_e word being filtered. I've replaced that below. You should be getting your s*u_b*s_c*r_i*b_e email about now. (/me idly wonders if the majordomo software is smart enough to parse that word...) -- Cheers, Curtis Poe Senior Programmer ONSITE! Technology, Inc. www.onsitetech.com 503-233-1418 Taking e-Business and Internet Technology To The Extreme! ----- Original Message ----- From: "Curtis Poe" To: "pdx-pm-list" Sent: Tuesday, July 23, 2002 10:27 AM Subject: Switching mailing lists > Here's the scoop: for various reasons, we are switching this mailing list > from majordomo to mailman. From the email that I received: > > > I'll "mass ********" your current members. They will all get an email > > with their password (primarily for ********* stuff). You will get one > > too as the list owner. The mailing address for the list stays the same, > > but the interface to ***************/*************/admin is web instead of > > email. > > > > You'll need to change the instructions on your web site for signup (look > > at austin.pm.org). > > Yes, that means you're all going to get an extra email. Deal with it :) > For most of us, this change should be completely transparent. > > Please note that you should probably be using passwords that aren't related > to anything else (you were doing that anyway, right?) as the Web interface > is not encrypted. > > -- > Cheers, > Curtis Poe > Senior Programmer > ONSITE! Technology, Inc. > www.onsitetech.com > 503-233-1418 > > Taking e-Business and Internet Technology To The Extreme! > TIMTOWTDI