From jobs-noreply at seattleperl.org Fri Nov 3 12:15:17 2006 From: jobs-noreply at seattleperl.org (SPUG Jobs) Date: Fri, 3 Nov 2006 12:15:17 -0800 (PST) Subject: SPUG: JOB: Perl application developer, Seattle Message-ID: My name is Jake Vallejo from LincolnBay Company. We are an IT staffing company in Seattle and we currently have a client in the ecommerce industry [in Seattle] that is looking to hire a Perl application developer. The 4+ yr Perl developer must have experience/knowledge with Apache, mod_perl and, OO Perl in a Unix environment.. This is a permanent position starting ASAP and will pay based on experience. The benefits package includes: employer-paid health benefits, disability, life insurance, matching 401(k) and stock options. Sorry telecommuting is not possible for this position. If you are interested you can email me at jakev at lincolnbay.com Thanks Jake Vallejo Lincoln Bay Co. 206.438.5706 1000 2nd Ave Suite 1900 Seattle, WA 98104 jakev at lincolnbay.com www.lincolnbay.com From cos at indeterminate.net Fri Nov 3 13:29:04 2006 From: cos at indeterminate.net (John Costello) Date: Fri, 3 Nov 2006 13:29:04 -0800 (PST) Subject: SPUG: Signals: Best Practices? In-Reply-To: <20061019035856.GA30800@jumpy.consultix-inc.com> Message-ID: On Wed, 18 Oct 2006, Tim Maher wrote: > Clarifying the subject, and focusing more, in the hope of sparking > some discussion. > -Tim > > On Wed, Oct 18, 2006 at 11:27:44AM -0700, Tim Maher wrote: > > SPUGsters, > > > > Using Sys::SigAction for setting all signal handlers and timeouts > > would seem to have the potential for making these tools more reliable > > and portable, but .. I wonder how intelligent this module > > really is. ... > > > > Can somebody offer some guidelines, or "Best Practices", or actual > > documentation, on how to use Perl signals reliably and portably with > > the 5.8.* versions of Perl? I can't vouch for the module's intelligence. It seems like the approach goes beyond intelligent-space ("I know it works") and faith-space ("I hope it works") to caveat space ("CYA"). I looked at Sys::SigAction, POSIX, and perlipc on CPAN. I don't claim expertise on the topic, but researching skills help a bit (and might stimulate conversation). Sys::SigAction: "Perl 5.8.0 and later versions implements 'safe' signal handling on platforms which support the POSIX sigaction() function." POSIX: "Furthermore, some evil vendors will claim 1003.1 compliance, but in fact are not so: they will not pass the PCTS (POSIX Compliance Test Suites)." And some ports don't have 1003.1 compliance - I can't image that Windows 3.1 does, but I could be wrong. perlipc: "Because Perl's signal mechanism is currently based on the signal(3) function from the C library, you may sometimes be so misfortunate as to run on systems where that function is 'broken', that is, it behaves in the old unreliable SysV way rather than the newer, more reasonable BSD and POSIX fashion." and perlipc again: "For more complex signal handling, you might see the standard POSIX module. Lamentably, this is almost entirely undocumented, but the t/lib/posix.t file from the Perl source distribution has some examples in it." I think it would help focus the discussion further if you if you indicated on what platforms you want the scripts to function, on what platforms you expect they will be used, and on what platforms you think they have a good chance of running. Last, the Sys::SigAction source at least checks whether the OS supports signals; warns if you are using < 5.8.2; and does a couple of other cautious things depending on your perl version. John From iheffner at gmail.com Sun Nov 5 00:01:16 2006 From: iheffner at gmail.com (Ivan Heffner) Date: Sun, 5 Nov 2006 00:01:16 -0800 Subject: SPUG: Signals: Best Practices? In-Reply-To: References: <20061019035856.GA30800@jumpy.consultix-inc.com> Message-ID: I recently had a run-in with signals at work. "Growing up" on a Perl that used the "old unreliable SysV way" I was bitten when Perl 5.8.6 did not behave the same way. We have a fairly mixed environment at work where newer applications are built on what is considered "stable" technology at the time, so some older applications use Apache/mod_perl 1.x built on Perl 5.6.x while newer applications are using Apache/mod_perl 2.x using Perl 5.8.6. We have several Perl modules that are shared across applications and, therefore, across platforms. One of these shared modules had some signal handling code in it which was not behaving "correctly" on our newer systems. After some brief trouble shooting, someone remembered that the newer Perl handles signals differently. After some debate (and research), we decided to use Sys::SigAction in this module. IIRC, our implementation pretty closely followed example #2 in the POD for Sys::SigAction and I don't think we've had a problem with that code since. -- Ivan Heffner Sr. Software Engineer DAS Lead WhitePages.com From jerry.gay at gmail.com Mon Nov 6 12:14:17 2006 From: jerry.gay at gmail.com (jerry gay) Date: Mon, 6 Nov 2006 12:14:17 -0800 Subject: SPUG: request for speakers Message-ID: <1d9a3f400611061214xa71991dsf2ba0483399ddf72@mail.gmail.com> hey all! we had a great summer full of meetings, much of it due to behind the scenes work in order to get speakers. well, that's changing, as seattle's a much less attractive travel destination this time of year. also, i'd like to make sure seattle's perl mongers keep involved in the community, and especially in our local group. so, i'm making a public request for speakers. i know i've spoken to some people individually about doing presentations. please forgive me, but your names have slipped my mind. whether i've spoken to you or not, i'd like to hear from some volunteers for presentations (any length is fine, any topic is fine.) we don't have anybody lined up for the foreseeable future, and i'd like to change that quickly. last month we had a discussion of what folks are working on, and what topics they found interesting. i was introduced to some new ideas there, and i think others were, too. i liked the informality, because it encouraged folks who were maybe not prepared or willing to do a formal presentation to share their ideas. so, i think in future meetings we should consider spending some time (~1hr) on presentations, and we can fill the remainder with news, events, and freeform discussion. so, this thread is also a place to collect ideas for discussion topics. perhaps there'll be some speakers and some discussion topics we can fit together nicely over the coming months. oh, and feel free to take the initiative and modify the wiki.seattleperl.org with a speaker registration page, or interesting topics page we can use in the future. please, speak up. spug would love to here from you. ~jerry From jobs-noreply at seattleperl.org Mon Nov 6 12:53:22 2006 From: jobs-noreply at seattleperl.org (SPUG Jobs) Date: Mon, 6 Nov 2006 12:53:22 -0800 (PST) Subject: SPUG: JOB: Software Engineer at CarDomain Message-ID: Software Engineer CarDomain Network Do you have a desire to work at one of Washington's fastest growing companies? CarDomain Network operates the web's largest community for auto enthusiasts and an industry-leading online store, visited by over 1.8 million unique users per month. The company operates two primary lines of business: Media and Retail. Founded in 1998, CarDomain Network is privately held and is headquartered in Seattle, Washington. We seek intelligent, energetic, highly motivated people who want to be part of building a leading consumer brand. We offer a competitive compensation and benefits package that includes: employer-paid health benefits, disability, life insurance, matching 401(k), stock options, free lunch Fridays and a great Lake Union location. Come make a difference at a growing company! The Opportunity We are seeking an experienced Software Engineer to join our growing engineering team. This individual will assist in the development of online applications for our web properties. The position entails close interaction with both technical and business staff and requires sensitivity to end-user business requirements. Responsibilities * Technical design and implementation of secure, scalable, and high-performance online systems and applications. * Lead technical planning on assigned engineering initiatives. * Successfully translate business requirements into technical specifications and finished products/services. * Assist in Quality Assurance as needed. * Create and maintain high-quality documentation of all relevant specifications, systems, and procedures. * Provide mentoring and training for junior staff. Qualifications * BS or advanced degree in computer science or related technical field. * Excellent knowledge of OO Perl. * 5+ years of work experience in website and software application development in UNIX environment. * Thorough understanding of relational databases and SQL. Extensive experience with Oracle and/or MySQL. * Strong knowledge of Version Control Systems. * Thorough knowledge of Apache and mod_perl. * Extensive experience with the full software development life cycle. * In-depth experience with Linux/UNIX and desire to work with Open Source technology. * Desire to work in fast-paced team environment. Contact: Lara Zwerling, HR Recruiter/Generalist lzwerling at cardomain.com Direct: (206) 926-2136 Fax: (206) 926-2299 1633 Westlake Avenue North, Suite 100, Seattle, WA 98109 From jobs-noreply at seattleperl.org Tue Nov 7 09:57:57 2006 From: jobs-noreply at seattleperl.org (SPUG Jobs) Date: Tue, 7 Nov 2006 09:57:57 -0800 (PST) Subject: SPUG: JOB: Contract (W2) Perl Programmer - Seattle onsite Message-ID: International transportation is one of the three fastest growing industries. Our Client, a Fortune 1000 company, is a leader in this growth sector. Their culture of organic growth, promotion from within, combined with a strong management team and unique compensation structure makes them one of the top in their field. They are highly trained, motivated, focused and are committed to their customers. Their job is to make sure that from raw material to finished goods sitting on the retail shelf, they provide the critical services and information necessary to give their clients a competitive advantage in the management of their supply chains. They are seeking a Perl programmer to upgrade and fix bugs in their customized version of Bugzilla. The programmer should be proficient with MySQL, Unix and capable of maintaining Bugzilla code. You will direct our Unix System Administrators to accomplish the following tasks. Responsibilities: Fix Data Corruption Issues in customized Bugzilla application * Upgrade MySQL to version 4.0-stable or 4.1-stable * Convert database tables to use InnoDB tablespaces * Upgrade Perl, if necessary * Upgrade Perl DBI/DBD, if necessary * Align the customized Bugzilla database schema with the official Bugzilla 2.18 release (the only difference being the categories) * Perform necessary data cleanup * Identify & isolate the custom code. Original & current versions were checked into CVS so diffs are easy. * Fix the customized Bugzilla codebase to align it with official Bugzilla 2.18 database schema Upgrade customized Bugzilla to Version 2.20-stable * Fix installers to not overwrite schema customizations * Integrate custom code with Version 2.20 If you or someone you know is interested, please contact Andrea Estes, Recruiting Lead with Chameleon Technologies, at andrea at chameleontechinc.com or 425-827-1173. Thank you! From cos at indeterminate.net Tue Nov 7 17:17:08 2006 From: cos at indeterminate.net (John Costello) Date: Tue, 7 Nov 2006 17:17:08 -0800 (PST) Subject: SPUG: Amazon wishlists Message-ID: I see that some people were nice enough to write modules to simplify queries of Amazon wishlists. What I haven't found is whether there is an API method that would allow me to update my own wishlist, using just the ASINs and my wishlist's token. Why would I program this? For one, I found someone's list of things they want on their non-AMZN page. I'd rather create a form that scrapes their page, lists each one with a check box, and then updates my wishlist with my selections. For another, the person's list is for items from amazon.co.uk, while my list is on amazon.com. ASINs appear to be identical between sites. I don't see a link on Amazon's site to APIs, but perhaps I'm not looking in the right spot. John From jmates at sial.org Tue Nov 7 21:37:22 2006 From: jmates at sial.org (Jeremy Mates) Date: Tue, 7 Nov 2006 21:37:22 -0800 Subject: SPUG: Amazon wishlists In-Reply-To: References: Message-ID: <20061108053722.GK4432@neamh.sial.org> * John Costello > Why would I program this? For one, I found someone's list of things > they want on their non-AMZN page. I'd rather create a form that > scrapes their page, lists each one with a check box, and then updates > my wishlist with my selections. Present a form to a browser (or grant WWW::Mechanize login rights to Amazon somehow, and POST the form data, following redirects):
Shamelessly lifted from Amazon Hacks, p.150: http://www.amazon.com/o/ASIN/0596005423 > I don't see a link on Amazon's site to APIs, but perhaps I'm not > looking in the right spot. The XML REST/SOAP interface documentation lives at: http://developer.amazonwebservices.com/connect/kbcategory.jspa?categoryID=19 Which quotes: "Currently, it is not possible to add items to a list using ECS. Use an Amazon web site to add items to a list." Jeremy From bob at hiltners.com Tue Nov 7 21:44:59 2006 From: bob at hiltners.com (Bob Hiltner) Date: Tue, 7 Nov 2006 21:44:59 -0800 Subject: SPUG: Amazon wishlists In-Reply-To: Message-ID: <00de01c702f9$0a91ad60$6601a8c0@SawBones> The amazon web services pages http://www.amazon.com/gp/browse.html?node=3435361 searching solutions catalog for "wishlist" Looks pretty promising... http://developer.amazonwebservices.com/connect/kbsearch.jspa?parentCatID=60& searchQuery=wishlist -----Original Message----- From: spug-list-bounces+bob=hiltners.com at pm.org [mailto:spug-list-bounces+bob=hiltners.com at pm.org] On Behalf Of John Costello Sent: Tuesday, November 07, 2006 5:17 PM To: spug-list at pm.org Subject: SPUG: Amazon wishlists I see that some people were nice enough to write modules to simplify queries of Amazon wishlists. What I haven't found is whether there is an API method that would allow me to update my own wishlist, using just the ASINs and my wishlist's token. Why would I program this? For one, I found someone's list of things they want on their non-AMZN page. I'd rather create a form that scrapes their page, lists each one with a check box, and then updates my wishlist with my selections. For another, the person's list is for items from amazon.co.uk, while my list is on amazon.com. ASINs appear to be identical between sites. I don't see a link on Amazon's site to APIs, but perhaps I'm not looking in the right spot. John _____________________________________________________________ Seattle Perl Users Group Mailing List POST TO: spug-list at pm.org SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list MEETINGS: 3rd Tuesdays WEB PAGE: http://seattleperl.org/ From tim at consultix-inc.com Tue Nov 7 22:13:48 2006 From: tim at consultix-inc.com (Tim Maher) Date: Tue, 7 Nov 2006 22:13:48 -0800 Subject: SPUG: Minimal Perl talk at UW on Thursday Message-ID: <20061108061348.GA28721@jumpy.consultix-inc.com> The next Seattle Area System Administrator's Guild meeting is Thursday, November 9, 2006 at 7pm. There will be dinner sponsored by Silicon Mechanics. Check them out at http://www.siliconmechanics.com/ There will also be several CACert assurers present. The meeting will be at the Electrical Engineering building on the University of Washington Campus, aka EE1. Directions are linked to the EE Department's web site below. Parking is $5 after 4pm. --- Next meeting: Thursday November 9, 2006 at 7:00 PM Topic: Minimal Perl for UNIX and Linux People Presenters: Tim Maher Location: EE1 Building (Electrical Engineering) Room 403 University of Washington Campus Directions: http://www.ee.washington.edu/directions.html Web Site: http://www.sasag.org/ ------------- Talk Abstract ------------- Perl is one of the most expressive, powerful, versatile, OS- portable, and /fun/ languages for general purpose programming, and certainly one of the best choices for applications involving text, HTML, or XML processing, CGI or Database programming, or system administration. However, the language as it is generally taught is overly complex and confusing, being replete with redundant and esoteric features that confuse and discourage novices. This talk discusses a strategically crafted /subset/ of Perl, which was developed and tested on corporate engineers. It pares the language down to an easily learned and sensible set of core features, which are easily assimilated because they capitalize on the learner's existing knowledge of key UNIX/Linux concepts and commands that are shared by Perl. ----------- Speaker Bio ----------- Since 1982, Dr. Tim Maher of Seattle-based Consultix has taught many thousands of software professionals to program in Unix-related languages. He's a former employee of AT&T, U.C. Berkeley, and the University of Utah, the developer of the first Perl beautifier, the founder of the Seattle Perl Users Group (SPUG), the author of "Minimal Perl for UNIX and Linux People", a winner of the Perl community's White Camel award, and the guy who brought to Perl the only Unix shell loop that Larry left out--"select". --- This is FREE and open to the public and a wonderful opportunity. The Seattle Area System Administrator's Guild (SASAG) is a local group for system & network administrators in Greater Seattle Area. We are a local chapter of both SAGE and LOPSA, but membership in either is not a requirement. We sponsor a regular monthly meeting open to the public on the second Thursday if each month at 7 p.m. Check out our Web site for more information: http://www.sasag.org/ -------------- Special Thanks -------------- Special thanks to Silicon Mechanics (www.siliconmechanics.com) for providing our server and to Blue Gecko (www.bluegecko.net) for giving it a home! _______________________________________________ Members mailing list Members at lists.sasag.org http://lists.sasag.org/mailman/listinfo/members From cos at indeterminate.net Wed Nov 8 10:45:19 2006 From: cos at indeterminate.net (John Costello) Date: Wed, 8 Nov 2006 10:45:19 -0800 (PST) Subject: SPUG: Amazon wishlists In-Reply-To: <00de01c702f9$0a91ad60$6601a8c0@SawBones> Message-ID: On Tue, 7 Nov 2006, Bob Hiltner wrote: > The amazon web services pages > http://www.amazon.com/gp/browse.html?node=3435361 > > searching solutions catalog for "wishlist" Looks pretty promising... > http://developer.amazonwebservices.com/connect/kbsearch.jspa?parentCatID=60& > searchQuery=wishlist Thanks! From cos at indeterminate.net Wed Nov 8 10:47:03 2006 From: cos at indeterminate.net (John Costello) Date: Wed, 8 Nov 2006 10:47:03 -0800 (PST) Subject: SPUG: Amazon wishlists In-Reply-To: <20061108053722.GK4432@neamh.sial.org> Message-ID: On Tue, 7 Nov 2006, Jeremy Mates wrote: > > The XML REST/SOAP interface documentation lives at: > > http://developer.amazonwebservices.com/connect/kbcategory.jspa?categoryID=19 > > Which quotes: "Currently, it is not possible to add items to a list > using ECS. Use an Amazon web site to add items to a list." Hm. Thanks much for thoses links and that tidbit. From MichaelRWolf at att.net Wed Nov 8 11:54:33 2006 From: MichaelRWolf at att.net (Michael R. Wolf) Date: Wed, 8 Nov 2006 14:54:33 -0500 Subject: SPUG: September meeting question In-Reply-To: Message-ID: <000301c7036f$ba3001b0$6701a8c0@mlaptop> > > Perl::Critic? > > Yes, that. There's also B::Lint. It's going to be dual-lifed anyday > now. The version in beadperl works on threaded perls and supports > plugins. It still doesn't have an extensive library of stuff to look > for but it does cover some things that Perl::Critic can't. What does "dual-lifed" mean? -- Michael R. Wolf All mammals learn by playing! MichaelRWolf at att.net From ppcook at gmail.com Wed Nov 8 11:59:17 2006 From: ppcook at gmail.com (Paul Cook) Date: Wed, 8 Nov 2006 11:59:17 -0800 Subject: SPUG: September meeting question In-Reply-To: <000301c7036f$ba3001b0$6701a8c0@mlaptop> References: <000301c7036f$ba3001b0$6701a8c0@mlaptop> Message-ID: Here is what Josh ben Jore said in response to my same question: ------------------------- On 10/29/06, Paul Cook wrote: > Thanks Josh. I'm a novice. What does dual-lifed mean? It lives soley in core perl right now but will be available separately on CPAN soon. This allows you to upgrade the module without upgrading perl. Josh ------------------------------- On 11/8/06, Michael R. Wolf wrote: > > > > Perl::Critic? > > > > Yes, that. There's also B::Lint. It's going to be dual-lifed anyday > > now. The version in beadperl works on threaded perls and supports > > plugins. It still doesn't have an extensive library of stuff to look > > for but it does cover some things that Perl::Critic can't. > > What does "dual-lifed" mean? > > -- > Michael R. Wolf > All mammals learn by playing! > MichaelRWolf at att.net > > > > _____________________________________________________________ > Seattle Perl Users Group Mailing List > POST TO: spug-list at pm.org > SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list > MEETINGS: 3rd Tuesdays > WEB PAGE: http://seattleperl.org/ > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/spug-list/attachments/20061108/65abdd19/attachment.html From twists at gmail.com Wed Nov 8 13:57:10 2006 From: twists at gmail.com (Joshua ben Jore) Date: Wed, 8 Nov 2006 13:57:10 -0800 Subject: SPUG: September meeting question In-Reply-To: References: <000301c7036f$ba3001b0$6701a8c0@mlaptop> Message-ID: On 11/8/06, Paul Cook wrote: > Here is what Josh ben Jore said in response to my same question: > > ------------------------- > > On 10/29/06, Paul Cook wrote: > > Thanks Josh. I'm a novice. What does dual-lifed mean? > > > It lives soley in core perl right now but will be available separately > on CPAN soon. This allows you to upgrade the module without upgrading > perl. So it's a nice thought but my home is full of boxes and I don't have the computer with ~/src uncrated so I figure "soon" is pretty relative. The latest B::Lint (http://public.activestate.com/pub/apc/perl-current/ext/B/B/Lint.pm) fixes it to work on threaded perls (that's the major bug, I think), and adds some new stuff like making it use plugins. I also make all uses of <> a warning because it's evil. Most people should write linty things in Perl::Critic. Some things can't be done in P::C because the interpreter has to compile the code first for it to be sane (things like "does this function exist?" aren't possible in P::C). When it's impossible in P::C, write it in B::Lint. The plugin interface sucks right now though. It should use Module::Pluggable. As an example, here's a plugin I wrote to find uses of C which occurred to someone else's co-worker and probably anyone who is expecting something C++ like. package B::Lint::Plugin::SortOperator; use B::Lint; B::Lint->register_plugin( __PACKAGE__ => [qw[ sort-operator ]] ); use List::MoreUtils 'any'; sub match { my $op = shift @_; return unless $op->isa( 'B::LISTOP' ) and $op->name eq 'sort'; # perl -MO=Concise -e 'print sort { $a < $b } @X' # (sort # (pushmark) s ->5 # (null # (scope # (ex-nextstate) # (lt # (ex-rv2sv # (gvsv "a")) # (ex-rv2sv # (gvsv "b"))))) # (rv2av # (gv "X"))) my $comparison_op = eval { $op->first->sibling->first->first->sibling } or return; # <, >, lt, gt return unless $comparison_op->name =~ /^s?[lg]t\z/; B::Lint::warning( 'Invalid use of a comparison operator' ); } Josh From jerry.gay at gmail.com Mon Nov 13 11:44:16 2006 From: jerry.gay at gmail.com (jerry gay) Date: Mon, 13 Nov 2006 11:44:16 -0800 Subject: SPUG: request for speakers In-Reply-To: <1d9a3f400611061214xa71991dsf2ba0483399ddf72@mail.gmail.com> References: <1d9a3f400611061214xa71991dsf2ba0483399ddf72@mail.gmail.com> Message-ID: <1d9a3f400611131144ge04e519nb0eaf1f4ffd7ba45@mail.gmail.com> On 11/6/06, jerry gay wrote: > so, this thread is also a place to collect ideas for discussion > topics. perhaps there'll be some speakers and some discussion topics > we can fit together nicely over the coming months. oh, and feel free > to take the initiative and modify the wiki.seattleperl.org with a > speaker registration page, or interesting topics page we can use in > the future. > > please, speak up. spug would love to here from you. > i'd like to schedule a spug technical meeting for this month. unfortunately, nobody--not one single person--has responded to this request about speaking at spug in the future. there have been no wiki updates, either. if there are still no responses by wednesday, i'll have no choice but to cancel this month's meeting. after all, i can't let our gracious hosts at whitepages.com hold out until the last minute to know whether they'll be staying late to donate their time and space to spug. volunteers welcome. ~jerry From cmeyer at helvella.org Mon Nov 13 12:27:32 2006 From: cmeyer at helvella.org (Colin Meyer) Date: Mon, 13 Nov 2006 12:27:32 -0800 Subject: SPUG: request for speakers In-Reply-To: <1d9a3f400611131144ge04e519nb0eaf1f4ffd7ba45@mail.gmail.com> References: <1d9a3f400611061214xa71991dsf2ba0483399ddf72@mail.gmail.com> <1d9a3f400611131144ge04e519nb0eaf1f4ffd7ba45@mail.gmail.com> Message-ID: <20061113202732.GC19316@funpox.helvella.org> On Mon, Nov 13, 2006 at 11:44:16AM -0800, jerry gay wrote: > On 11/6/06, jerry gay wrote: > > so, this thread is also a place to collect ideas for discussion > > topics. perhaps there'll be some speakers and some discussion topics > > we can fit together nicely over the coming months. oh, and feel free > > to take the initiative and modify the wiki.seattleperl.org with a > > speaker registration page, or interesting topics page we can use in > > the future. > > > > please, speak up. spug would love to here from you. > > > i'd like to schedule a spug technical meeting for this month. > unfortunately, nobody--not one single person--has responded to this > request about speaking at spug in the future. there have been no wiki > updates, either. > > if there are still no responses by wednesday, i'll have no choice but > to cancel this month's meeting. after all, i can't let our gracious > hosts at whitepages.com hold out until the last minute to know whether > they'll be staying late to donate their time and space to spug. How about we not cancel the meeting. If no one is organized enough to present a regular talk, then we can have informal discussions about our projects, and cool stuff (e.g. pugs, parrot and so on). I recently gave a talk on some Perl6 features at work. If there's interest, I can give that (and likely learn more about Perl6 myself, from some of our smart audience). It could be fun to have a mini-hack-a-thon, and write a few P6 tests. -Colin. From twists at gmail.com Mon Nov 13 15:50:28 2006 From: twists at gmail.com (Joshua ben Jore) Date: Mon, 13 Nov 2006 15:50:28 -0800 Subject: SPUG: request for speakers In-Reply-To: <20061113202732.GC19316@funpox.helvella.org> References: <1d9a3f400611061214xa71991dsf2ba0483399ddf72@mail.gmail.com> <1d9a3f400611131144ge04e519nb0eaf1f4ffd7ba45@mail.gmail.com> <20061113202732.GC19316@funpox.helvella.org> Message-ID: On 11/13/06, Colin Meyer wrote: > On Mon, Nov 13, 2006 at 11:44:16AM -0800, jerry gay wrote: > > On 11/6/06, jerry gay wrote: > > if there are still no responses by wednesday, i'll have no choice but > > to cancel this month's meeting. after all, i can't let our gracious > > hosts at whitepages.com hold out until the last minute to know whether > > they'll be staying late to donate their time and space to spug. > > How about we not cancel the meeting. If no one is organized enough to > present a regular talk, then we can have informal discussions about our > projects, and cool stuff (e.g. pugs, parrot and so on). As a comparison, I'd like to mention how Minneapolis.pm usually works. It's a monthly meeting that's usually just meeting in a cafe for chitchat. Very occasionally a local recruiter hosts a presentation night. Josh From tim at consultix-inc.com Mon Nov 13 16:47:33 2006 From: tim at consultix-inc.com (Tim Maher) Date: Mon, 13 Nov 2006 16:47:33 -0800 Subject: SPUG: Minimal Perl talk at UW on Thursday In-Reply-To: <20061108061348.GA28721@jumpy.consultix-inc.com> References: <20061108061348.GA28721@jumpy.consultix-inc.com> Message-ID: <20061114004733.GA26104@jumpy.consultix-inc.com> On Tue, Nov 07, 2006 at 10:13:48PM -0800, Tim Maher wrote: > The next Seattle Area System Administrator's Guild meeting is > Thursday, November 9, 2006 at 7pm. I've posted the slides of my talk at http://MinimalPerl.com; look near the bottom of the home page. -Tim > Next meeting: Thursday November 9, 2006 at 7:00 PM > Topic: Minimal Perl for UNIX and Linux People > Presenters: Tim Maher > Location: EE1 Building (Electrical Engineering) > Room 403 > University of Washington Campus > Directions: http://www.ee.washington.edu/directions.html > Web Site: http://www.sasag.org/ > > ------------- > Talk Abstract > ------------- > > Perl is one of the most expressive, powerful, versatile, OS- portable, > and /fun/ languages for general purpose programming, and certainly one > of the best choices for applications involving text, HTML, or XML > processing, CGI or Database programming, or system administration. > > However, the language as it is generally taught is overly complex and > confusing, being replete with redundant and esoteric features that > confuse and discourage novices. This talk discusses a strategically > crafted /subset/ of Perl, which was developed and tested on corporate > engineers. It pares the language down to an easily learned and > sensible set of core features, which are easily assimilated because > they capitalize on the learner's existing knowledge of key UNIX/Linux > concepts and commands that are shared by Perl. > > ----------- > Speaker Bio > ----------- > > Since 1982, Dr. Tim Maher of Seattle-based Consultix has taught many > thousands of software professionals to program in Unix-related > languages. He's a former employee of AT&T, U.C. Berkeley, and the > University of Utah, the developer of the first Perl beautifier, the > founder of the Seattle Perl Users Group (SPUG), the author of "Minimal > Perl for UNIX and Linux People", a winner of the Perl community's > White Camel award, and the guy who brought to Perl the only Unix shell > loop that Larry left out--"select". > > --- > This is FREE and open to the public and a wonderful opportunity. > > The Seattle Area System Administrator's Guild (SASAG) is a local group > for system & network administrators in Greater Seattle Area. We are a > local chapter of both SAGE and LOPSA, but membership in either is not a > requirement. We sponsor a regular monthly meeting open to the public on > the second Thursday if each month at 7 p.m. > > Check out our Web site for more information: > http://www.sasag.org/ > > -------------- > Special Thanks > -------------- > > Special thanks to Silicon Mechanics (www.siliconmechanics.com) for providing > our server and to Blue Gecko (www.bluegecko.net) for giving it a home! > _______________________________________________ > Members mailing list > Members at lists.sasag.org > http://lists.sasag.org/mailman/listinfo/members > _____________________________________________________________ > Seattle Perl Users Group Mailing List > POST TO: spug-list at pm.org > SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list > MEETINGS: 3rd Tuesdays > WEB PAGE: http://seattleperl.org/ From offby1 at blarg.net Tue Nov 14 12:24:31 2006 From: offby1 at blarg.net (Eric Hanchrow) Date: Tue, 14 Nov 2006 12:24:31 -0800 Subject: SPUG: request for speakers In-Reply-To: <20061113202732.GC19316@funpox.helvella.org> (Colin Meyer's message of "Mon\, 13 Nov 2006 12\:27\:32 -0800") References: <20061113202732.GC19316@funpox.helvella.org> Message-ID: <8764dh7p4w.fsf@offby1.atm01.sea.blarg.net> >>>>> "Colin" == Colin Meyer writes: Colin> How about we not cancel the meeting. If no one is Colin> organized enough to present a regular talk, then we can Colin> have informal discussions about our projects, and cool Colin> stuff (e.g. pugs, parrot and so on). I'd like that. I've never come to a Seattle.pm meeting and was planning on showing up next week. -- In the movie Ghostbusters, there's a sign in the background of one scene that says, "Danger! 10,000 Ohms!" I cannot explain to laymen why people like me think that is uproariously funny. -- Steven den Beste From krahnj at telus.net Tue Nov 14 14:37:12 2006 From: krahnj at telus.net (John W. Krahn) Date: Tue, 14 Nov 2006 14:37:12 -0800 Subject: SPUG: Minimal Perl talk at UW on Thursday In-Reply-To: <20061114004733.GA26104@jumpy.consultix-inc.com> References: <20061108061348.GA28721@jumpy.consultix-inc.com> <20061114004733.GA26104@jumpy.consultix-inc.com> Message-ID: <455A4518.9080001@telus.net> Tim Maher wrote: > On Tue, Nov 07, 2006 at 10:13:48PM -0800, Tim Maher wrote: >>The next Seattle Area System Administrator's Guild meeting is >>Thursday, November 9, 2006 at 7pm. > > I've posted the slides of my talk at http://MinimalPerl.com; look > near the bottom of the home page. I hope you don't mind, :-), some comments on the listfiles script: The file http://minimalperl.com/listfiles.plx appears to be HTML but because of the .plx extention it displays as plain text. > # Doesn't handle ls's -a, etc., so discard > # hyphen-prefixed options, if any > while ( defined $ARGV[0] and $ARGV[0] =~ /^-/ ) { > warn "$0: Ignoring option: '$ARGV[0]'\n"; > shift; > } What if you have file names that begin with a '-' character? > -e $filename or > warn "$0: '$filename'; $!\n" and next; > > $target=""; > # symlinks need to be read using "lstat" > if (-l $filename) { # file is a symlink > (undef, undef, $mode, $nlink, $uid, $gid, > undef, $size, undef, $mtime)=lstat $filename; > $target=(readlink $filename or '(nowhere)'); > } > else { # not a symlink > (undef, undef, $mode, $nlink, $uid, $gid, > undef, $size, undef, $mtime)=stat $filename; > } You are stat()ing the same file three times, why not just once: my ( $mode, $nlink, $uid, $gid, $size, $mtime ) = ( lstat $filename )[ 2 .. 5, 7, 9 ]; -e _ or warn "$0: '$filename'; $!\n" and next; my $target = -l _ ? readlink( $filename ) || '(nowhere)' : ''; > # convert UID-number to string > $uid_name=$uid; # keep numeric ID if can't convert to user-name > my $x=getpwuid $uid; > defined $x and $x =~ /[a-zA-Z]/ and $uid_name=$x; > > # convert GID-number to string > $gid_name=$gid; # keep numeric ID if can't convert to user-name > $x=getgrgid $gid; > defined $x and $x =~ /[a-zA-Z]/ and $gid_name=$x; Is there some Unix or Posix specification that requires the /[a-zA-Z]/ test? Or to put it another way, if the test failed would that be proof that the name was invalid? Or to put it another way, if you got a valid name from getpwuid/getgrgid and it didn't match /[a-zA-Z]/ how did it get into the file in the first place? John -- Perl isn't a toolbox, but a small machine shop where you can special-order certain sorts of tools at low cost and in short order. -- Larry Wall From tim at consultix-inc.com Tue Nov 14 16:56:11 2006 From: tim at consultix-inc.com (Tim Maher) Date: Tue, 14 Nov 2006 16:56:11 -0800 Subject: SPUG: Minimal Perl talk at UW on Thursday In-Reply-To: <455A4518.9080001@telus.net> References: <20061108061348.GA28721@jumpy.consultix-inc.com> <20061114004733.GA26104@jumpy.consultix-inc.com> <455A4518.9080001@telus.net> Message-ID: <20061115005611.GA7758@jumpy.consultix-inc.com> On Tue, Nov 14, 2006 at 02:37:12PM -0800, John W. Krahn wrote: > > I hope you don't mind, :-), some comments on the listfiles script: Be my guest! > The file http://minimalperl.com/listfiles.plx appears to be HTML but > because of the .plx extention it displays as plain text. It was /supposed/ to be plain text; 'twas a Template Toolkit config error--thanks for spotting it! > > # Doesn't handle ls's -a, etc., so discard > > # hyphen-prefixed options, if any > > while ( defined $ARGV[0] and $ARGV[0] =~ /^-/ ) { > > warn "$0: Ignoring option: '$ARGV[0]'\n"; > > shift; > > } > > What if you have file names that begin with a '-' character? ** Then you deserve to have a difficult life! 8-{ ** The program is more interested in advising the user that it doesn't honor the options of /bin/ls than it is in accommodating the existence of non-UNIXy filename conventions. Of course, you can always modify the program to suit your special needs, if appropriate. (A "--" option to signify the end of options could be added.) > > -e $filename or ... > > if (-l $filename) { # file is a symlink ... > > undef, $size, undef, $mtime)=stat $filename; > > You are stat()ing the same file three times, why not just once: That's a good point; I was delaying "optimization" until later to avoid the well-known consequences of doing it prematurely-- but now might be a good time! 8-} > > $x=getgrgid $gid; > > defined $x and $x =~ /[a-zA-Z]/ and $gid_name=$x; > > Is there some Unix or Posix specification that requires the /[a-zA- > Z]/ test? > > Or to put it another way, if the test failed would that be proof > that the name was invalid? Not testing the filename there, but rather whether getgrgid returned a numeric GID (meaning it failed to find the associated user- name) or a verbal GID. Probably should be simply: $x =~ /\D/ > John Thanks for the input! *-------------------------------------------------------------------* | Tim Maher, PhD (206) 781-UNIX (866) DOC-PERL (866) DOC-UNIX | | tim at ( Consultix-Inc, TeachMePerl, or TeachMeUnix ) dot Com | *-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-* | Seattle Classes; 12/11 Shell Prog. 12/14: UNIX/Linux Utilities | | * Download free chapters from my new book at MinimalPerl.com * | *-------------------------------------------------------------------* From krahnj at telus.net Tue Nov 14 19:08:18 2006 From: krahnj at telus.net (John W. Krahn) Date: Tue, 14 Nov 2006 19:08:18 -0800 Subject: SPUG: Minimal Perl talk at UW on Thursday In-Reply-To: <20061115005611.GA7758@jumpy.consultix-inc.com> References: <20061108061348.GA28721@jumpy.consultix-inc.com> <20061114004733.GA26104@jumpy.consultix-inc.com> <455A4518.9080001@telus.net> <20061115005611.GA7758@jumpy.consultix-inc.com> Message-ID: <455A84A2.8050204@telus.net> Tim Maher wrote: > On Tue, Nov 14, 2006 at 02:37:12PM -0800, John W. Krahn wrote: >> >>> $x=getgrgid $gid; >>> defined $x and $x =~ /[a-zA-Z]/ and $gid_name=$x; >>Is there some Unix or Posix specification that requires the /[a-zA- >>Z]/ test? >> >>Or to put it another way, if the test failed would that be proof >>that the name was invalid? > > Not testing the filename there, I never said "filename". > but rather whether getgrgid > returned a numeric GID (meaning it failed to find the associated user- > name) or a verbal GID. Probably should be simply: $x =~ /\D/ $ perl -le' for my $uid ( 1000 .. 1003 ) { $name = getpwuid $uid; print qq[$uid: "$name"] if defined $name } ' 1000: "john" 1001: "june" 1002: "123" $ perl -le' for my $gid ( 1000 .. 1003 ) { $name = getgrgid $gid; print qq[$gid: "$name"] if defined $name } ' 1001: "234" If the value returned from getpwuid/getgrgid is undef then that UID/GID was not in the file[1] but if it is defined then it is in the file[1] and it has returned a valid name. 1) file being either /etc/passwd or /etc/group John -- Perl isn't a toolbox, but a small machine shop where you can special-order certain sorts of tools at low cost and in short order. -- Larry Wall From krahnj at telus.net Wed Nov 15 02:31:18 2006 From: krahnj at telus.net (John W. Krahn) Date: Wed, 15 Nov 2006 02:31:18 -0800 Subject: SPUG: Minimal Perl talk at UW on Thursday In-Reply-To: <20061115005611.GA7758@jumpy.consultix-inc.com> References: <20061108061348.GA28721@jumpy.consultix-inc.com> <20061114004733.GA26104@jumpy.consultix-inc.com> <455A4518.9080001@telus.net> <20061115005611.GA7758@jumpy.consultix-inc.com> Message-ID: <455AEC76.50501@telus.net> Tim Maher wrote: > On Tue, Nov 14, 2006 at 02:37:12PM -0800, John W. Krahn wrote: >>I hope you don't mind, :-), some comments on the listfiles script: > > Be my guest! > >>The file http://minimalperl.com/listfiles.plx appears to be HTML but >>because of the .plx extention it displays as plain text. > > It was /supposed/ to be plain text; 'twas a Template Toolkit config > error--thanks for spotting it! I just looked at the new listfiles on your site and I have one more comment that I forgot the last time: > $target and $listing.=sprintf " $symbol $target"; There is no need to use sprintf() and that may break[1] depending on the contents of $target and the version of Perl. $target and $listing .= " $symbol $target"; 1) http://groups.google.com/group/perl.perl5.porters/browse_frm/thread/a523b310487aa709?lnk=st&rnum=9 http://groups.google.com/group/perl.perl5.porters/browse_frm/thread/8fdae8a2372fa9ce?lnk=st&rnum=1 http://groups.google.com/group/perl.perl5.porters/browse_frm/thread/45ccc5bbb3c03e5b?lnk=st&rnum=1 > >>> # Doesn't handle ls's -a, etc., so discard >>> # hyphen-prefixed options, if any >>> while ( defined $ARGV[0] and $ARGV[0] =~ /^-/ ) { >>> warn "$0: Ignoring option: '$ARGV[0]'\n"; >>> shift; >>> } >>What if you have file names that begin with a '-' character? > > ** Then you deserve to have a difficult life! 8-{ ** > > The program is more interested in advising the user that it doesn't honor > the options of /bin/ls than it is in accommodating the existence of non-UNIXy > filename conventions. > > Of course, you can always modify the program to suit your special > needs, if appropriate. (A "--" option to signify the end of options > could be added.) > >>> -e $filename or > ... >>> if (-l $filename) { # file is a symlink > ... >>> undef, $size, undef, $mtime)=stat $filename; >>You are stat()ing the same file three times, why not just once: > > That's a good point; I was delaying "optimization" until later > to avoid the well-known consequences of doing it prematurely-- > but now might be a good time! 8-} > >>> $x=getgrgid $gid; >>> defined $x and $x =~ /[a-zA-Z]/ and $gid_name=$x; >>Is there some Unix or Posix specification that requires the /[a-zA- >>Z]/ test? >> >>Or to put it another way, if the test failed would that be proof >>that the name was invalid? > > Not testing the filename there, but rather whether getgrgid > returned a numeric GID (meaning it failed to find the associated user- > name) or a verbal GID. Probably should be simply: $x =~ /\D/ > >>John > > Thanks for the input! > *-------------------------------------------------------------------* > | Tim Maher, PhD (206) 781-UNIX (866) DOC-PERL (866) DOC-UNIX | > | tim at ( Consultix-Inc, TeachMePerl, or TeachMeUnix ) dot Com | > *-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-* > | Seattle Classes; 12/11 Shell Prog. 12/14: UNIX/Linux Utilities | > | * Download free chapters from my new book at MinimalPerl.com * | > *-------------------------------------------------------------------* > John -- Perl isn't a toolbox, but a small machine shop where you can special-order certain sorts of tools at low cost and in short order. -- Larry Wall From tim at consultix-inc.com Wed Nov 15 07:36:06 2006 From: tim at consultix-inc.com (Tim Maher) Date: Wed, 15 Nov 2006 07:36:06 -0800 Subject: SPUG: Minimal Perl talk at UW on Thursday In-Reply-To: <455AEC76.50501@telus.net> References: <20061108061348.GA28721@jumpy.consultix-inc.com> <20061114004733.GA26104@jumpy.consultix-inc.com> <455A4518.9080001@telus.net> <20061115005611.GA7758@jumpy.consultix-inc.com> <455AEC76.50501@telus.net> Message-ID: <20061115153606.GA13479@jumpy.consultix-inc.com> On Wed, Nov 15, 2006 at 02:31:18AM -0800, John W. Krahn wrote: > > I just looked at the new listfiles on your site and I have one more comment > that I forgot the last time: > > > $target and $listing.=sprintf " $symbol $target"; > > There is no need to use sprintf() ... You're correct; that used to be needed when the coding of that line was different, but it's unnecessary now. Thanks again! 8-} -Tim *-------------------------------------------------------------------* | Tim Maher, PhD (206) 781-UNIX (866) DOC-PERL (866) DOC-UNIX | | tim at ( Consultix-Inc, TeachMePerl, or TeachMeUnix ) dot Com | *-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-* | Seattle Classes; 12/11 Shell Prog. 12/14: UNIX/Linux Utilities | | * Download free chapters from my new book at MinimalPerl.com * | *-------------------------------------------------------------------* From Eric.D.Peterson at alltel.com Wed Nov 15 16:11:20 2006 From: Eric.D.Peterson at alltel.com (Eric.D.Peterson at alltel.com) Date: Wed, 15 Nov 2006 18:11:20 -0600 Subject: SPUG: Slice of HashOfHash Message-ID: <8476CE21F2E6E543851495D6AB09F2A401F3ADB7@scarlitnt642.alltel.com> Given a Hash of a Hash is it possible to make a slice (I presume this will be another hash) of a subset of the HoH based upon a value, not the key? For example: my %HoH = ( flintstones => { husband => "fred", pal => "barney", }, jetsons => { husband => "george", wife => "jane", "his boy" => "elroy", # Key quotes needed. }, jones => { husband => "fred", wife => "linda", }, simpsons => { husband => "homer", wife => "marge", kid => "bart", } ); How can I make a new hash or loop through this HoH where husband = "fred"? I've been reading up on slices and printing hashes, but I can't seem to find an example or description on playing with HoH subsets. I've tried looping through the full HoH and adding those desired elements to a new HoH but that seems awkward and not quite right & cumbersome. So I thought I'd ask ya'll for some help. Cheers Eric ****************************************************************************************** The information contained in this message, including attachments, may contain privileged or confidential information that is intended to be delivered only to the person identified above. If you are not the intended recipient, or the person responsible for delivering this message to the intended recipient, Alltel requests that you immediately notify the sender and asks that you do not read the message or its attachments, and that you delete them without copying or sending them to anyone else. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/spug-list/attachments/20061115/61b98bdc/attachment.html From krahnj at telus.net Wed Nov 15 16:26:08 2006 From: krahnj at telus.net (John W. Krahn) Date: Wed, 15 Nov 2006 16:26:08 -0800 Subject: SPUG: Slice of HashOfHash In-Reply-To: <8476CE21F2E6E543851495D6AB09F2A401F3ADB7@scarlitnt642.alltel.com> References: <8476CE21F2E6E543851495D6AB09F2A401F3ADB7@scarlitnt642.alltel.com> Message-ID: <455BB020.6030204@telus.net> Eric.D.Peterson at alltel.com wrote: > Given a Hash of a Hash is it possible to make a slice (I presume this > will be another hash) A slice is a list. > of a subset of the HoH based upon a value, not the > key? For example: > > my %HoH = ( > flintstones => > { > husband => "fred", > pal => "barney", > }, > jetsons => > { > husband => "george", > wife => "jane", > "his boy" => "elroy", # Key quotes needed. > }, > jones => > { > husband => "fred", > wife => "linda", > }, > simpsons => > { > husband => "homer", > wife => "marge", > kid => "bart", > } > ); > > > How can I make a new hash or loop through this HoH where husband = > "fred"? for my $hash ( @HoH{ qw[ flintstones jetsons jones simpsons ] } ) { if ( $hash->{ husband } eq 'fred' ) { Or maybe you just want: for my $key ( qw[ flintstones jetsons jones simpsons ] ) { if ( $HoH{ $key }{ husband } eq 'fred' ) { > I've been reading up on slices and printing hashes, but I can't seem to > find an example or description on playing with HoH subsets. I've tried > looping through the full HoH and adding those desired elements to a new > HoH but that seems awkward and not quite right & cumbersome. So I > thought I'd ask ya'll for some help. Looping through all 'simpsons' keys would be: @{ $HoH{ simpsons } }{ qw[ husband wife kid ] } John -- Perl isn't a toolbox, but a small machine shop where you can special-order certain sorts of tools at low cost and in short order. -- Larry Wall From cos at indeterminate.net Wed Nov 15 16:32:55 2006 From: cos at indeterminate.net (John Costello) Date: Wed, 15 Nov 2006 16:32:55 -0800 (PST) Subject: SPUG: Slice of HashOfHash In-Reply-To: <8476CE21F2E6E543851495D6AB09F2A401F3ADB7@scarlitnt642.alltel.com> Message-ID: On Wed, 15 Nov 2006 Eric.D.Peterson at alltel.com wrote: > Given a Hash of a Hash is it possible to make a slice (I presume this > will be another hash) of a subset of the HoH based upon a value, not the > key? For example: > > my %HoH = ( > flintstones => > { > husband => "fred", > pal => "barney", > }, > jetsons => > { > husband => "george", > wife => "jane", > "his boy" => "elroy", # Key quotes needed. > }, > jones => > { > husband => "fred", > wife => "linda", > }, > simpsons => > { > husband => "homer", > wife => "marge", > kid => "bart", > } > ); > > > How can I make a new hash or loop through this HoH where husband = > "fred"? > > I've been reading up on slices and printing hashes, but I can't seem to > find an example or description on playing with HoH subsets. I've tried > looping through the full HoH and adding those desired elements to a new > HoH but that seems awkward and not quite right & cumbersome. So I > thought I'd ask ya'll for some help. For looping, you could do the following OUTER: foreach my $key (keys %HoH) { INNER: foreach my $innerkey (keys % { $HoH{$key} }) { if ($HoH{$key}{$innerkey}{'husband'} eq 'fred') { print "Wilma!\n"; } } } John From jerry.gay at gmail.com Wed Nov 15 16:32:29 2006 From: jerry.gay at gmail.com (jerry gay) Date: Wed, 15 Nov 2006 16:32:29 -0800 Subject: SPUG: Slice of HashOfHash In-Reply-To: <455BB020.6030204@telus.net> References: <8476CE21F2E6E543851495D6AB09F2A401F3ADB7@scarlitnt642.alltel.com> <455BB020.6030204@telus.net> Message-ID: <1d9a3f400611151632o2a03789bi1fc32bddf39d390d@mail.gmail.com> On 11/15/06, John W. Krahn wrote: > Eric.D.Peterson at alltel.com wrote: > > Given a Hash of a Hash is it possible to make a slice (I presume this > > will be another hash) > > A slice is a list. > > > of a subset of the HoH based upon a value, not the > > key? For example: > > > > my %HoH = ( > > flintstones => > > { > > husband => "fred", > > pal => "barney", > > }, > > jetsons => > > { > > husband => "george", > > wife => "jane", > > "his boy" => "elroy", # Key quotes needed. > > }, > > jones => > > { > > husband => "fred", > > wife => "linda", > > }, > > simpsons => > > { > > husband => "homer", > > wife => "marge", > > kid => "bart", > > } > > ); > > > > > > How can I make a new hash or loop through this HoH where husband = > > "fred"? > > for my $hash ( @HoH{ qw[ flintstones jetsons jones simpsons ] } ) { > if ( $hash->{ husband } eq 'fred' ) { > > > Or maybe you just want: > > for my $key ( qw[ flintstones jetsons jones simpsons ] ) { > if ( $HoH{ $key }{ husband } eq 'fred' ) { > probably better not to hardcode here: for my $hash ( @HoH{ keys %HoH } ) { if ( $hash->{ husband } eq 'fred' ) { but the if statement is somewhat unsafe. in the case where the subhash doesn't have a key named 'husband', it will be autovivified. this may or may not be a problem. if it is, you'll want something more like: for my $hash ( @HoH{ keys %HoH } ) { if ( exists $hash->{ husband } and $hash->{ husband } eq 'fred' ) { ~jerry From paul at goracke.org Wed Nov 15 16:51:44 2006 From: paul at goracke.org (Paul Goracke) Date: Wed, 15 Nov 2006 16:51:44 -0800 Subject: SPUG: Slice of HashOfHash In-Reply-To: <8476CE21F2E6E543851495D6AB09F2A401F3ADB7@scarlitnt642.alltel.com> References: <8476CE21F2E6E543851495D6AB09F2A401F3ADB7@scarlitnt642.alltel.com> Message-ID: <455BB620.9040100@goracke.org> Eric.D.Peterson at alltel.com wrote: > How can I make a new hash or loop through this HoH where husband = > "fred"? > > I've been reading up on slices and printing hashes, but I can't seem to > find an example or description on playing with HoH subsets. I've tried > looping through the full HoH and adding those desired elements to a new > HoH but that seems awkward and not quite right & cumbersome. So I > thought I'd ask ya'll for some help. Many ways of doing it, all of which use a loop/map/grep that I can think of. Two I can think of w/ your current data structure (I'm a bit paranoid about checking for a defined key before string comparing): # grep filter for entries with 'husband'='fred', # then add that key and its hashref my %sub = map { $_ => $HoH{$_} } grep { $HoH{$_}{'husband'} && $HoH{$_}{'husband'} eq 'fred' } keys %HoH; # or loop through w/ 'each', which makes it easier to follow the key/obj my %sub2 = (); while ( my ($key,$obj) = each %HoH ) { $sub2{$key} = $obj if ( $obj->{'husband'} && $obj->{'husband'} eq 'fred' ); } In a case like this, I tend to "smuggle" the key into the object hashref itself so I can operate on just the hashref, instead of trying to keep track of the key and ref--if you change your data by: while ( my ($key,$obj) = each %HoH ) { $obj->{'_key'} = $key; } you can then do: my %sub3 = map { ($_->{'husband'} && $_->{'husband'} eq 'fred') ? ( $_->{'_key'} => $_ ) : () } values %HoH; # or my %sub4 = (); $sub4{$_->{'_key'}} = $_ for grep { $_->{'husband'} && $_->{'husband'} eq 'fred' } values %HoH; -- pg From sthoenna at efn.org Wed Nov 15 16:53:14 2006 From: sthoenna at efn.org (Yitzchak Scott-Thoennes) Date: Wed, 15 Nov 2006 16:53:14 -0800 (PST) Subject: SPUG: Slice of HashOfHash In-Reply-To: <8476CE21F2E6E543851495D6AB09F2A401F3ADB7@scarlitnt642.alltel.com> References: <8476CE21F2E6E543851495D6AB09F2A401F3ADB7@scarlitnt642.alltel.com> Message-ID: <43264.38.112.225.178.1163638394.squirrel@38.112.225.178> > Given a Hash of a Hash is it possible to make a slice (I presume this > will be another hash) of a subset of the HoH based upon a value, not the > key? For example: > > my %HoH = ( > flintstones => > { > husband => "fred", > pal => "barney", > }, > jetsons => > { > husband => "george", > wife => "jane", > "his boy" => "elroy", # Key quotes needed. > }, > jones => > { > husband => "fred", > wife => "linda", > }, > simpsons => > { > husband => "homer", > wife => "marge", > kid => "bart", > } > ); > > > How can I make a new hash or loop through this HoH where husband "fred"? How to loop through, and how to take a slice are two different questions. If you are looping through, just skip values of the outer hash that don't match your critera, as others have shown. If you want a slice, you can make one with an implicit grep loop in the key list: @HoH{ grep { $HoH{$_}{'husband'} eq 'fred' } keys %HoH } but since you typically want to loop over it, it usually makes sense just to have one explicit loop over all of %HoH instead. Sometimes it's most convinient to make an array of the keys of interest and do various things (loops, slices, etc.) with that instead: @have_husband_fred = grep { $HoH{$_}{'husband'} eq 'fred' } keys %HoH; From naterajj at gmail.com Wed Nov 15 16:39:23 2006 From: naterajj at gmail.com (Juan Jose Natera) Date: Wed, 15 Nov 2006 16:39:23 -0800 Subject: SPUG: Slice of HashOfHash In-Reply-To: <8476CE21F2E6E543851495D6AB09F2A401F3ADB7@scarlitnt642.alltel.com> References: <8476CE21F2E6E543851495D6AB09F2A401F3ADB7@scarlitnt642.alltel.com> Message-ID: <349627440611151639u73814134l8db89f083483c0cd@mail.gmail.com> On the other hand, if you do need to keep a copy of the results: my %matched = map { $_ => $HoH{$_} } grep { $HoH{$_}->{husband} eq 'fred' } keys %HoH; On 11/15/06, Eric.D.Peterson at alltel.com wrote: > > > > Given a Hash of a Hash is it possible to make a slice (I presume this will > be another hash) of a subset of the HoH based upon a value, not the key? > For example: > > my %HoH = ( > flintstones => > { > husband => "fred", > pal => "barney", > }, > jetsons => > { > husband => "george", > wife => "jane", > "his boy" => "elroy", # Key quotes needed. > }, > jones => > { > husband => "fred", > wife => "linda", > }, > simpsons => > { > husband => "homer", > wife => "marge", > kid => "bart", > } > ); > > > How can I make a new hash or loop through this HoH where husband = "fred"? > > I've been reading up on slices and printing hashes, but I can't seem to find > an example or description on playing with HoH subsets. I've tried looping > through the full HoH and adding those desired elements to a new HoH but that > seems awkward and not quite right & cumbersome. So I thought I'd ask ya'll > for some help. > > > Cheers > Eric > > ****************************************************************************************** > The information contained in this message, including attachments, may > contain > privileged or confidential information that is intended to be delivered only > to the > person identified above. If you are not the intended recipient, or the > person > responsible for delivering this message to the intended recipient, Alltel > requests > that you immediately notify the sender and asks that you do not read the > message or its > attachments, and that you delete them without copying or sending them to > anyone else. > > > > _____________________________________________________________ > Seattle Perl Users Group Mailing List > POST TO: spug-list at pm.org > SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list > MEETINGS: 3rd Tuesdays > WEB PAGE: http://seattleperl.org/ > > From cmeyer at helvella.org Wed Nov 15 18:47:56 2006 From: cmeyer at helvella.org (Colin Meyer) Date: Wed, 15 Nov 2006 18:47:56 -0800 Subject: SPUG: Slice of HashOfHash In-Reply-To: <349627440611151639u73814134l8db89f083483c0cd@mail.gmail.com> References: <8476CE21F2E6E543851495D6AB09F2A401F3ADB7@scarlitnt642.alltel.com> <349627440611151639u73814134l8db89f083483c0cd@mail.gmail.com> Message-ID: <20061116024756.GA19014@funpox.helvella.org> On Wed, Nov 15, 2006 at 04:39:23PM -0800, Juan Jose Natera wrote: > On the other hand, if you do need to keep a copy of the results: > > my %matched = map { $_ => $HoH{$_} } grep { $HoH{$_}->{husband} eq > 'fred' } keys %HoH; It is worth noting that the "copy" contains the same references as the original, so that any modifications to the subhashes in the copy also show up in the original. If you need a deep copy, try a slight modification: use Storable 'dclone'; my %matched = map { $_ => dclone( $HoH{$_} ) } grep { $HoH{$_}->{husband} eq 'fred' } keys %HoH; -Colin. From david.dyck at fluke.com Wed Nov 15 21:51:58 2006 From: david.dyck at fluke.com (David Dyck) Date: Wed, 15 Nov 2006 21:51:58 -0800 (PST) Subject: SPUG: Slice of HashOfHash In-Reply-To: <1d9a3f400611151632o2a03789bi1fc32bddf39d390d@mail.gmail.com> References: <8476CE21F2E6E543851495D6AB09F2A401F3ADB7@scarlitnt642.alltel.com><455BB020.6030204@telus.net> <1d9a3f400611151632o2a03789bi1fc32bddf39d390d@mail.gmail.com> Message-ID: Not sure if your advice is cargo-cult, please test it. On Wed, 15 Nov 2006 at 16:32 -0800, jerry gay wrote: >> for my $key ( qw[ flintstones jetsons jones simpsons ] ) { >> if ( $HoH{ $key }{ husband } eq 'fred' ) { >> > probably better not to hardcode here: > for my $hash ( @HoH{ keys %HoH } ) { > if ( $hash->{ husband } eq 'fred' ) { you were right to warn about not hardcoding the keys above as if there is a typo in the above keys (eg s/jones/smith/) then a top level element would be autovivified (eg $HoH{'smith'} = undef) but I suspect that the following advice is wrong: > but the if statement is somewhat unsafe. in the case where the subhash > doesn't have a key named 'husband', it will be autovivified. this may > or may not be a problem. The above _may_ have been true at some version of perl (as I used to write code like below also (using exists) - but it is not now the case when I test the code. I you find a perl doing this (where if ( $hash->{ exhusband } eq 'fred' ) autovivifies some element in %HoH), please let me know, as I couldn't create a test case with recent (6 year old) perl version where the if test needed the exists check that you gave below. > if it is, you'll want something more like: > for my $hash ( @HoH{ keys %HoH } ) { > if ( exists $hash->{ husband } and $hash->{ husband } eq 'fred' ) { From jarich at perltraining.com.au Thu Nov 16 03:27:45 2006 From: jarich at perltraining.com.au (Jacinta Richardson) Date: Thu, 16 Nov 2006 22:27:45 +1100 Subject: SPUG: Slice of HashOfHash In-Reply-To: References: <8476CE21F2E6E543851495D6AB09F2A401F3ADB7@scarlitnt642.alltel.com><455BB020.6030204@telus.net> <1d9a3f400611151632o2a03789bi1fc32bddf39d390d@mail.gmail.com> Message-ID: <455C4B31.9060707@perltraining.com.au> David Dyck wrote: >> but the if statement is somewhat unsafe. in the case where the subhash >> doesn't have a key named 'husband', it will be autovivified. this may >> or may not be a problem. > > The above _may_ have been true at some version of perl (as I used to > write code like below also (using exists) - but it is not now the case when > I test the code. I you find a perl doing this (where > if ( $hash->{ exhusband } eq 'fred' ) > autovivifies some element in %HoH), please let me know, as I couldn't > create a test case with recent (6 year old) perl version where the > if test needed the exists check that you gave below. I agree that the proposed if statement doesn't cause auto-vivication, but it's important to be aware that it *will* cause a warning to be generated if warnings are turned on. Comparing an undefined thing to a string does that. ;) This isn't a big deal but most people don't like their code generating warnings, so Jerry's advice (to check the field first ) is right... just for the wrong reason. Of course, we can also just check it for truth and save a few characters. My personal solution to the given problem is: foreach my $key ( keys %HoH ) { if($Hoh{$key}{husband} && $HoH{$key}{husband} eq "fred") { print "yes\n"; } } The main difference being that I don't understand why someone would recommend taking a hash slice of the whole hash when we can just iterate over the keys. I suspect Damian Conway would suggest instead that we iterate over the values: foreach my $value ( values %HoH ) { if($value->{husband} && $value->{husband} eq "fred") { print "yes\n"; } } because he doesn't like the extra work of dereferencing when values() does the work for us. It's in the PBP book which I don't have handy right now. He's right, but I still prefer keys(). I think the original poster was asking whether there's a way to do something like this: foreach my $husband ( @{$HoH{ _ }{husband} ) { if( $husband eq "fred" ) { print "yes\n"; } } Such that Perl iterates over all the keys and pulls out the husband for each subhash for us. It would be cool, I've wanted to do it myself a few times, but no; there's no way specifically like that. But it's not much less code than the other solutions either. All the best, Jacinta From david.dyck at fluke.com Thu Nov 16 07:24:25 2006 From: david.dyck at fluke.com (David Dyck) Date: Thu, 16 Nov 2006 07:24:25 -0800 (PST) Subject: SPUG: Slice of HashOfHash In-Reply-To: <455C4B31.9060707@perltraining.com.au> References: <8476CE21F2E6E543851495D6AB09F2A401F3ADB7@scarlitnt642.alltel.com><455BB020.6030204@telus.net> <1d9a3f400611151632o2a03789bi1fc32bddf39d390d@mail.gmail.com> <455C4B31.9060707@perltraining.com.au> Message-ID: On Thu, 16 Nov 2006 at 03:27 -0800, Jacinta Richardson I agree that the proposed if statement doesn't cause auto-vivication, but it's > important to be aware that it *will* cause a warning to be generated if warnings > are turned on. Comparing an undefined thing to a string does that. ;) This > isn't a big deal but most people don't like their code generating warnings, so > Jerry's advice (to check the field first ) is right... just for the wrong > reason. Of course, we can also just check it for truth and save a few characters. Thank you for following up -- your observations are correct, and I was focused on the auto-vivication so much that I actually ignored the warnings - which should not be done! From charles.e.derykus at boeing.com Thu Nov 16 10:29:55 2006 From: charles.e.derykus at boeing.com (DeRykus, Charles E) Date: Thu, 16 Nov 2006 10:29:55 -0800 Subject: SPUG: Slice of HashOfHash In-Reply-To: Message-ID: ... >>> for my $key ( qw[ flintstones jetsons jones simpsons ] ) { >>> if ( $HoH{ $key }{ husband } eq 'fred' ) { >>> >> probably better not to hardcode here: >> for my $hash ( @HoH{ keys %HoH } ) { >> if ( $hash->{ husband } eq 'fred' ) { >you were right to warn about not hardcoding the keys above as if there is a typo >in the above keys (eg s/jones/smith/) then a top level element would be autovivified >(eg $HoH{'smith'} = undef) but I suspect that the following advice is wrong: >> but the if statement is somewhat unsafe. in the case where the subhash >> doesn't have a key named 'husband', it will be autovivified. this may >> or may not be a problem. >The above _may_ have been true at some version of perl (as I used to write code like below also >(using exists) - but it is not now the case when I test the code. I you find a perl doing this >(where > if ( $hash->{ exhusband } eq 'fred' ) autovivifies some element in %HoH), please let me know, > as I couldn't create a test case with recent (6 year old) perl version where the if test needed > the exists check that you gave below. Although not directly relevant here, there's an arrow operator autovivification surprise mentioned in 'exists': undef $ref; if (exists $ref->{"Some key"}) { } print $ref; # prints HASH(0x80d3d5c) Although I couldn't conjure up an example, there might be a way to get into trouble here if the top level HoH were a hash reference. I recall a hideous bug where I had to adopt the exists doc workaround: if ( $ref and $ref->{$x} and $ref->{$x}{$y} ... -- Charles DeRykus From iheffner at gmail.com Thu Nov 16 11:24:50 2006 From: iheffner at gmail.com (Ivan Heffner) Date: Thu, 16 Nov 2006 11:24:50 -0800 Subject: SPUG: Slice of HashOfHash In-Reply-To: <455C4B31.9060707@perltraining.com.au> References: <8476CE21F2E6E543851495D6AB09F2A401F3ADB7@scarlitnt642.alltel.com> <455BB020.6030204@telus.net> <1d9a3f400611151632o2a03789bi1fc32bddf39d390d@mail.gmail.com> <455C4B31.9060707@perltraining.com.au> Message-ID: One of the subthreads within this thread has been checking the defined()ness of a value before doing an equality check in order to prevent warnings. The usual approach is this: foreach my $key ( keys %HoH ) { if($Hoh{$key}{husband} && $HoH{$key}{husband} eq "fred") { print "yes\n"; } } This is all fine in a simple case, but know that a hash look-up, while relatively cheap, is not free. Further, taking this example and abstracting it into an object-based interface, it become relatively expensive and incurs useless overhead. foreach my $family ( $cartoon->families() ) { if ($cartoon->$family->husband() && $cartoon->$family->husband() eq 'fred') { print "yes\n"; } } This now does a method call to get the family, then another to get the husband to check if it is "true" then does it all again to check equality. In a big app, these calls get expensive. But there's a short-cut method to do this. Use Perl's short-circuiting logical '||' to make a single method call (or set of method calls): foreach my $family ( $cartoon->families() ) { if ( ( $cartoon->$family->husband() || '' ) eq 'fred') { print "yes\n"; } } This will only do the method calls once, then use an empty string for the equality check if there is no husband. It's a small tweak, but is easier on your CPU and your maintenance developers. -- Ivan Heffner Sr. Software Engineer DAS Lead WhitePages.com From ryan at the-summit.net Thu Nov 16 14:45:20 2006 From: ryan at the-summit.net (Ryan Allen) Date: Thu, 16 Nov 2006 14:45:20 -0800 Subject: SPUG: line breaks in format fields Message-ID: <20061116224520.GA19442@the-summit.net> Does anybody know how to get "\n" in a format field to be preserved in the output? For example, suppose I have this code: #!/usr/bin/perl my $bigTextField = " I am a dynamic figure, often seen scaling walls and crushing ice. I have been known to remodel train stations on my lunch breaks, making them more efficient in the area of heat retention. I translate ethnic slurs for Cuban refugees, I write award-winning operas, I manage time efficiently. Occasionally, I tread water for three days in a row. I woo women with my sensuous and godlike trombone playing, I can pilot bicycles up severe inclines with unflagging speed, and I cook Thirty-Minute Brownies in twenty minutes. I am an expert in stucco, a veteran in love, and an outlaw in Peru. Using only a hoe and a large glass of water, I once single-handedly defended a small village in the Amazon Basin from a horde of ferocious army ants. I play bluegrass cello, I was scouted by the Mets, I am the subject of numerous documentaries. When I'm bored, I build large suspension bridges in my yard. I enjoy urban hang gliding. On Wednesdays, after school, I repair electrical appliances free of charge. "; format STDOUT = +--------------------------------------------------------------------+ | ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ~~ | $bigTextField +--------------------------------------------------------------------+ . write; What I end up with is: +--------------------------------------------------------------------+ | I am a dynamic figure, often seen scaling walls and | | crushing ice. I have been known to remodel train stations | | on my lunch breaks, making them more efficient in the area | | of heat retention. I translate ethnic slurs for Cuban | | refugees, I write award-winning operas, I manage time | | efficiently. Occasionally, I tread water for three days in | | a row. I woo women with my sensuous and godlike trombone | | playing, I can pilot bicycles up severe inclines with | | unflagging speed, and I cook Thirty-Minute Brownies in | | twenty minutes. I am an expert in stucco, a veteran in love, | | and an outlaw in Peru. Using only a hoe and a large glass | | of water, I once single-handedly defended a small village in | | the Amazon Basin from a horde of ferocious army ants. I | | play bluegrass cello, I was scouted by the Mets, I am the | | subject of numerous documentaries. When I'm bored, I build | | large suspension bridges in my yard. I enjoy urban hang | | gliding. On Wednesdays, after school, I repair electrical | | appliances free of charge. | +--------------------------------------------------------------------+ But what I want is: +--------------------------------------------------------------------+ | I am a dynamic figure, often seen scaling walls and | | crushing ice. I have been known to remodel train stations | | on my lunch breaks, making them more efficient in the area | | of heat retention. I translate ethnic slurs for Cuban | | refugees, I write award-winning operas, I manage time | | efficiently. Occasionally, I tread water for three days in | | a row. | | | | I woo women with my sensuous and godlike trombone | | playing, I can pilot bicycles up severe inclines with | | unflagging speed, and I cook Thirty-Minute Brownies in | | twenty minutes. I am an expert in stucco, a veteran in love, | | and an outlaw in Peru. | | | | Using only a hoe and a large glass | | of water, I once single-handedly defended a small village in | | the Amazon Basin from a horde of ferocious army ants. I | | play bluegrass cello, I was scouted by the Mets, I am the | | subject of numerous documentaries. When I'm bored, I build | | large suspension bridges in my yard. I enjoy urban hang | | gliding. On Wednesdays, after school, I repair electrical | | appliances free of charge. | +--------------------------------------------------------------------+ Is there a "trick"? Thanks! -Ryan -- +-----------------------------+ | ryan at the-summit.net | | http://www.the-summit.net | +-----------------------------+ From some_joe_named_jim at yahoo.com Thu Nov 16 15:18:04 2006 From: some_joe_named_jim at yahoo.com (Ben McEldowney) Date: Thu, 16 Nov 2006 15:18:04 -0800 (PST) Subject: SPUG: line breaks in format fields In-Reply-To: <20061116224520.GA19442@the-summit.net> Message-ID: <20061116231804.40960.qmail@web39504.mail.mud.yahoo.com> I'm a bit new to Perl and this may not be the solution you're looking for, but would it be possible to include the "\n" in your original $bigTextField declaration? Ryan Allen wrote: Does anybody know how to get "\n" in a format field to be preserved in the output? For example, suppose I have this code: #!/usr/bin/perl my $bigTextField = " I am a dynamic figure, often seen scaling walls and crushing ice. I have been known to remodel train stations on my lunch breaks, making them more efficient in the area of heat retention. I translate ethnic slurs for Cuban refugees, I write award-winning operas, I manage time efficiently. Occasionally, I tread water for three days in a row. I woo women with my sensuous and godlike trombone playing, I can pilot bicycles up severe inclines with unflagging speed, and I cook Thirty-Minute Brownies in twenty minutes. I am an expert in stucco, a veteran in love, and an outlaw in Peru. Using only a hoe and a large glass of water, I once single-handedly defended a small village in the Amazon Basin from a horde of ferocious army ants. I play bluegrass cello, I was scouted by the Mets, I am the subject of numerous documentaries. When I'm bored, I build large suspension bridges in my yard. I enjoy urban hang gliding. On Wednesdays, after school, I repair electrical appliances free of charge. "; format STDOUT = +--------------------------------------------------------------------+ | ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ~~ | $bigTextField +--------------------------------------------------------------------+ . write; What I end up with is: +--------------------------------------------------------------------+ | I am a dynamic figure, often seen scaling walls and | | crushing ice. I have been known to remodel train stations | | on my lunch breaks, making them more efficient in the area | | of heat retention. I translate ethnic slurs for Cuban | | refugees, I write award-winning operas, I manage time | | efficiently. Occasionally, I tread water for three days in | | a row. I woo women with my sensuous and godlike trombone | | playing, I can pilot bicycles up severe inclines with | | unflagging speed, and I cook Thirty-Minute Brownies in | | twenty minutes. I am an expert in stucco, a veteran in love, | | and an outlaw in Peru. Using only a hoe and a large glass | | of water, I once single-handedly defended a small village in | | the Amazon Basin from a horde of ferocious army ants. I | | play bluegrass cello, I was scouted by the Mets, I am the | | subject of numerous documentaries. When I'm bored, I build | | large suspension bridges in my yard. I enjoy urban hang | | gliding. On Wednesdays, after school, I repair electrical | | appliances free of charge. | +--------------------------------------------------------------------+ But what I want is: +--------------------------------------------------------------------+ | I am a dynamic figure, often seen scaling walls and | | crushing ice. I have been known to remodel train stations | | on my lunch breaks, making them more efficient in the area | | of heat retention. I translate ethnic slurs for Cuban | | refugees, I write award-winning operas, I manage time | | efficiently. Occasionally, I tread water for three days in | | a row. | | | | I woo women with my sensuous and godlike trombone | | playing, I can pilot bicycles up severe inclines with | | unflagging speed, and I cook Thirty-Minute Brownies in | | twenty minutes. I am an expert in stucco, a veteran in love, | | and an outlaw in Peru. | | | | Using only a hoe and a large glass | | of water, I once single-handedly defended a small village in | | the Amazon Basin from a horde of ferocious army ants. I | | play bluegrass cello, I was scouted by the Mets, I am the | | subject of numerous documentaries. When I'm bored, I build | | large suspension bridges in my yard. I enjoy urban hang | | gliding. On Wednesdays, after school, I repair electrical | | appliances free of charge. | +--------------------------------------------------------------------+ Is there a "trick"? Thanks! -Ryan -- +-----------------------------+ | ryan at the-summit.net | | http://www.the-summit.net | +-----------------------------+ _____________________________________________________________ Seattle Perl Users Group Mailing List POST TO: spug-list at pm.org SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list MEETINGS: 3rd Tuesdays WEB PAGE: http://seattleperl.org/ --------------------------------- Sponsored Link Mortgage rates near 39yr lows. $310,000 Mortgage for $999/mo - Calculate new house payment -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/spug-list/attachments/20061116/b771a72b/attachment.html From cmeyer at helvella.org Thu Nov 16 15:37:04 2006 From: cmeyer at helvella.org (Colin Meyer) Date: Thu, 16 Nov 2006 15:37:04 -0800 Subject: SPUG: line breaks in format fields In-Reply-To: <20061116224520.GA19442@the-summit.net> References: <20061116224520.GA19442@the-summit.net> Message-ID: <20061116233704.GB28532@funpox.helvella.org> On Thu, Nov 16, 2006 at 02:45:20PM -0800, Ryan Allen wrote: > Does anybody know how to get "\n" in a format field to be preserved in > the output? For example, suppose I have this code: Try the handy Text::Reform module. It's smarter that Perl's builtin formats. There's also a super-simple Text::Autoformat wrapper to T::Reform. -Colin. #!/usr/bin/perl use Text::Reform; my $bigTextField = " I am a dynamic figure, often seen scaling walls and crushing ice. I have been known to remodel train stations on my lunch breaks, making them more efficient in the area of heat retention. I translate ethnic slurs for Cuban refugees, I write award-winning operas, I manage time efficiently. Occasionally, I tread water for three days in a row. I woo women with my sensuous and godlike trombone playing, I can pilot bicycles up severe inclines with unflagging speed, and I cook Thirty-Minute Brownies in twenty minutes. I am an expert in stucco, a veteran in love, and an outlaw in Peru. Using only a hoe and a large glass of water, I once single-handedly defended a small village in the Amazon Basin from a horde of ferocious army ants. I playbluegrass cello, I was scouted by the Mets, I am the subject of numerous documentaries. When I'm bored, I build large suspension bridges in my yard. I enjoy urban hang gliding. On Wednesdays, after school, I repair electrical appliances free of charge. "; my $format = '| [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ |'; my $border = '+--------------------------------------------------------------------+'; print $border, form( $format, $bigTextField ), $border, "\n"; From Eric.D.Peterson at alltel.com Thu Nov 16 15:56:30 2006 From: Eric.D.Peterson at alltel.com (Eric.D.Peterson at alltel.com) Date: Thu, 16 Nov 2006 17:56:30 -0600 Subject: SPUG: Slice of HashOfHash Message-ID: <8476CE21F2E6E543851495D6AB09F2A401F3ADBF@scarlitnt642.alltel.com> Thanks for all your ideas, it has pointed me into the right direction. Here's essentially what I got working. Still fine-tuning it. The last note I saw on this list was about the excessive calls in the foreach below. Since I'm not working with a huge amount of data (otherwise) I'd run out of memory), I'm not to concerned. Just so I get the proper data in a timely manner. And so far it is (I think), I'm still validating output to input. I agree that I need to better name my objects and hash names. I'll get there. :) # ---------- ---------- ---------- # loop through different hash has # that has names to look up in big HoH # ---------- ---------- ---------- for my $name ( sort keys %names ) { $name = lc ( trim ( $name ) ); print "\n\t\t$name \n"; # ---------- ---------- ---------- # Get a subset of all our data based on the name # ---------- ---------- ---------- %subHoH = (); # start empty while ( my ( $key, $obj ) = each %HoH ) { $subHoH{$key} = $obj if ( $obj->{'name '} && $obj->{'name '} eq $name ); } print Dumper ( \%subHoH ) if DEBUG2; # ---------- ---------- ---------- # print out sorted by level and id for only this name # ---------- ---------- ---------- foreach my $me ( sort { $subHoH{$a}->{'level'} <=> $subHoH{$b}->{'level'} || $subHoH{$a}->{'id'} <=> $subHoH{$b}->{'id'} } keys %subHoH ) { if ( $subHoH{$me}->{'level'} == 0 ) { # ---------- ---------- ---------- # recursive call, to walk through the subHoH and # print parent information based on this starting ID # ---------- ---------- ---------- &print_parent ( $subHoH{$me}->{'id'} ) if $subHoH{$me}->{'id'} > 0; } } } } %subHoH = (); # clean up after all done ****************************************************************************************** The information contained in this message, including attachments, may contain privileged or confidential information that is intended to be delivered only to the person identified above. If you are not the intended recipient, or the person responsible for delivering this message to the intended recipient, Alltel requests that you immediately notify the sender and asks that you do not read the message or its attachments, and that you delete them without copying or sending them to anyone else. From dleonard at dleonard.net Fri Nov 17 13:10:09 2006 From: dleonard at dleonard.net (dleonard at dleonard.net) Date: Fri, 17 Nov 2006 13:10:09 -0800 (PST) Subject: SPUG: line breaks in format fields In-Reply-To: <20061116224520.GA19442@the-summit.net> Message-ID: Use a here-doc my $bigTextField = < On Thu, 16 Nov 2006, Ryan Allen wrote: > Does anybody know how to get "\n" in a format field to be preserved in > the output? For example, suppose I have this code: > > #!/usr/bin/perl > > my $bigTextField = " > I am a dynamic figure, often seen scaling walls and crushing ice. I have been known to remodel train stations on my lunch breaks, making them more efficient in the area of heat retention. I translate ethnic slurs for Cuban refugees, I write award-winning operas, I manage time efficiently. Occasionally, I tread water for three days in a row. > > I woo women with my sensuous and godlike trombone playing, I can pilot bicycles up severe inclines with unflagging speed, and I cook Thirty-Minute Brownies in twenty minutes. I am an expert in stucco, a veteran in love, and an outlaw in Peru. > > Using only a hoe and a large glass of water, I once single-handedly defended a small village in the Amazon Basin from a horde of ferocious army ants. I play bluegrass cello, I was scouted by the Mets, I am the subject of numerous documentaries. When I'm bored, I build large suspension bridges in my yard. I enjoy urban hang gliding. On Wednesdays, after school, I repair electrical appliances free of charge. > "; > > format STDOUT = > +--------------------------------------------------------------------+ > | ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ~~ | > $bigTextField > +--------------------------------------------------------------------+ > . > > write; > > > What I end up with is: > +--------------------------------------------------------------------+ > | I am a dynamic figure, often seen scaling walls and | > | crushing ice. I have been known to remodel train stations | > | on my lunch breaks, making them more efficient in the area | > | of heat retention. I translate ethnic slurs for Cuban | > | refugees, I write award-winning operas, I manage time | > | efficiently. Occasionally, I tread water for three days in | > | a row. I woo women with my sensuous and godlike trombone | > | playing, I can pilot bicycles up severe inclines with | > | unflagging speed, and I cook Thirty-Minute Brownies in | > | twenty minutes. I am an expert in stucco, a veteran in love, | > | and an outlaw in Peru. Using only a hoe and a large glass | > | of water, I once single-handedly defended a small village in | > | the Amazon Basin from a horde of ferocious army ants. I | > | play bluegrass cello, I was scouted by the Mets, I am the | > | subject of numerous documentaries. When I'm bored, I build | > | large suspension bridges in my yard. I enjoy urban hang | > | gliding. On Wednesdays, after school, I repair electrical | > | appliances free of charge. | > +--------------------------------------------------------------------+ > > But what I want is: > +--------------------------------------------------------------------+ > | I am a dynamic figure, often seen scaling walls and | > | crushing ice. I have been known to remodel train stations | > | on my lunch breaks, making them more efficient in the area | > | of heat retention. I translate ethnic slurs for Cuban | > | refugees, I write award-winning operas, I manage time | > | efficiently. Occasionally, I tread water for three days in | > | a row. | > | | > | I woo women with my sensuous and godlike trombone | > | playing, I can pilot bicycles up severe inclines with | > | unflagging speed, and I cook Thirty-Minute Brownies in | > | twenty minutes. I am an expert in stucco, a veteran in love, | > | and an outlaw in Peru. | > | | > | Using only a hoe and a large glass | > | of water, I once single-handedly defended a small village in | > | the Amazon Basin from a horde of ferocious army ants. I | > | play bluegrass cello, I was scouted by the Mets, I am the | > | subject of numerous documentaries. When I'm bored, I build | > | large suspension bridges in my yard. I enjoy urban hang | > | gliding. On Wednesdays, after school, I repair electrical | > | appliances free of charge. | > +--------------------------------------------------------------------+ > > Is there a "trick"? > > Thanks! > -Ryan > > > > -- > > +-----------------------------+ > | ryan at the-summit.net | > | http://www.the-summit.net | > +-----------------------------+ > _____________________________________________________________ > Seattle Perl Users Group Mailing List > POST TO: spug-list at pm.org > SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list > MEETINGS: 3rd Tuesdays > WEB PAGE: http://seattleperl.org/ > From ryan at the-summit.net Fri Nov 17 14:02:17 2006 From: ryan at the-summit.net (Ryan Allen) Date: Fri, 17 Nov 2006 14:02:17 -0800 Subject: SPUG: line breaks in format fields Message-ID: <20061117220217.GA24980@the-summit.net> Nope, doesn't change a thing. The other solutions posted here do work, BTW. Thanks to all! -Ryan * dleonard at dleonard.net wrote on [11-17-06y 13:15]: > Use a here-doc > > my $bigTextField = < I am a dynamic figure, often seen scaling walls and crushing ice. I have been known to remodel train stations on my lunch breaks, making them more efficient in the area of heat retention. I translate ethnic slurs for Cuban refugees, I write award-winning operas, I manage time efficiently. Occasionally, I tread water for three days in a row. > > I woo women with my sensuous and godlike trombone playing, I can pilot bicycles up severe inclines with unflagging speed, and I cook Thirty-Minute Brownies in twenty minutes. I am an expert in stucco, a veteran in love, and an outlaw in Peru. > > Using only a hoe and a large glass of water, I once single-handedly defended a small village in the Amazon Basin from a horde of ferocious army ants. I play bluegrass cello, I was scouted by the Mets, I am the subject of numerous documentaries. When I'm bored, I build large suspension bridges in my yard. I enjoy urban hang gliding. On Wednesdays, after school, I repair electrical appliances free of charge. > END > > -- > > > > anything done. --Linus Torvalds> > -- +-----------------------------+ | ryan at the-summit.net | | http://www.the-summit.net | +-----------------------------+ From sthoenna at efn.org Fri Nov 17 14:38:58 2006 From: sthoenna at efn.org (Yitzchak Scott-Thoennes) Date: Fri, 17 Nov 2006 14:38:58 -0800 (PST) Subject: SPUG: Slice of HashOfHash In-Reply-To: References: <8476CE21F2E6E543851495D6AB09F2A401F3ADB7@scarlitnt642.alltel.com> <455BB020.6030204@telus.net> <1d9a3f400611151632o2a03789bi1fc32bddf39d390d@mail.gmail.com> <455C4B31.9060707@perltraining.com.au> Message-ID: <44889.38.112.225.178.1163803138.squirrel@38.112.225.178> Ivan Heffner wrote: > Use Perl's short-circuiting logical '||' > to make a single method call (or set of method calls): > > foreach my $family ( $cartoon->families() ) { > if ( ( $cartoon->$family->husband() || '' ) eq 'fred') { > print "yes\n"; > } > } Or even: ( $cartoon->$family->husband() // '' ) eq 'fred' From paul at goracke.org Fri Nov 17 14:48:58 2006 From: paul at goracke.org (Paul Goracke) Date: Fri, 17 Nov 2006 14:48:58 -0800 Subject: SPUG: Slice of HashOfHash In-Reply-To: References: <8476CE21F2E6E543851495D6AB09F2A401F3ADB7@scarlitnt642.alltel.com> <455BB020.6030204@telus.net> <1d9a3f400611151632o2a03789bi1fc32bddf39d390d@mail.gmail.com> <455C4B31.9060707@perltraining.com.au> Message-ID: <455E3C5A.2010802@goracke.org> Ivan Heffner wrote: > This is all fine in a simple case, but know that a hash look-up, while > relatively cheap, is not free. Further, taking this example and > abstracting it into an object-based interface, it become relatively > expensive and incurs useless overhead. > > foreach my $family ( $cartoon->families() ) { > if ($cartoon->$family->husband() && $cartoon->$family->husband() > eq 'fred') { > print "yes\n"; > } > } I?m confused: if this is expensive, shouldn't your tests be $family->husband() instead of $cartoon->$family->husband()? $cartoon->families() _does_ return a list of Family objects, yes? pg From jarich at perltraining.com.au Fri Nov 17 16:55:21 2006 From: jarich at perltraining.com.au (Jacinta Richardson) Date: Sat, 18 Nov 2006 11:55:21 +1100 Subject: SPUG: Slice of HashOfHash In-Reply-To: <8476CE21F2E6E543851495D6AB09F2A401F3ADBF@scarlitnt642.alltel.com> References: <8476CE21F2E6E543851495D6AB09F2A401F3ADBF@scarlitnt642.alltel.com> Message-ID: <455E59F9.8010001@perltraining.com.au> > # ---------- ---------- ---------- > # loop through different hash has > # that has names to look up in big HoH > # ---------- ---------- ---------- > for my $name ( sort keys %names ) > { > $name = lc ( trim ( $name ) ); > print "\n\t\t$name \n"; > > # ---------- ---------- ---------- > # Get a subset of all our data based on the name > # ---------- ---------- ---------- > %subHoH = (); # start empty You can achieve the same effect (especially since you "clean up subHoH" at the end of this loop by writing: my %subHoH; here. It means that Perl will take care of clean-up and all the rest for you. :) > while ( my ( $key, $obj ) = each %HoH ) > { > $subHoH{$key} = $obj if ( $obj->{'name '} && > $obj->{'name '} eq $name ); > } > print Dumper ( \%subHoH ) if DEBUG2; > > # ---------- ---------- ---------- > # print out sorted by level and id for only this name > # ---------- ---------- ---------- > foreach my $me ( sort { $subHoH{$a}->{'level'} <=> > $subHoH{$b}->{'level'} || > $subHoH{$a}->{'id'} <=> > $subHoH{$b}->{'id'} > } keys %subHoH ) > { > if ( $subHoH{$me}->{'level'} == 0 ) > { > # ---------- ---------- ---------- > # recursive call, to walk through the subHoH and > # print parent information based on this starting ID > # ---------- ---------- ---------- > &print_parent ( $subHoH{$me}->{'id'} ) if > $subHoH{$me}->{'id'} > 0; Since Perl 5 came out, the need for prepending subroutine names with &s has gone. Well except for some very few cases which hopefully you won't encounter. Thus, this can be written: print_parent( ... ); quite safely. Otherwise, looks good. All the best, J From jarich at perltraining.com.au Fri Nov 17 17:03:13 2006 From: jarich at perltraining.com.au (Jacinta Richardson) Date: Sat, 18 Nov 2006 12:03:13 +1100 Subject: SPUG: Slice of HashOfHash In-Reply-To: <8476CE21F2E6E543851495D6AB09F2A401F3ADBF@scarlitnt642.alltel.com> References: <8476CE21F2E6E543851495D6AB09F2A401F3ADBF@scarlitnt642.alltel.com> Message-ID: <455E5BD1.3010901@perltraining.com.au> Forgot something! > # ---------- ---------- ---------- > # loop through different hash has > # that has names to look up in big HoH > # ---------- ---------- ---------- > for my $name ( sort keys %names ) > { > $name = lc ( trim ( $name ) ); > print "\n\t\t$name \n"; > > # ---------- ---------- ---------- > # Get a subset of all our data based on the name > # ---------- ---------- ---------- > %subHoH = (); # start empty > while ( my ( $key, $obj ) = each %HoH ) > { > $subHoH{$key} = $obj if ( $obj->{'name '} && > $obj->{'name '} eq $name ); > } Here you build a hash. Since you then turn that into a list of keys and treat it like an array maybe it would be better just to build a list anyway: my @subAoH; while( my $key, $obj ) = each %HoH ) { push @subAoH = $obj if ... } > print Dumper ( \%subHoH ) if DEBUG2; > > # ---------- ---------- ---------- > # print out sorted by level and id for only this name > # ---------- ---------- ---------- > foreach my $me ( sort { $subHoH{$a}->{'level'} <=> > $subHoH{$b}->{'level'} || > $subHoH{$a}->{'id'} <=> > $subHoH{$b}->{'id'} > } keys %subHoH ) Now we don't need to get the keys out, so this becomes: foreach my $me ( sort { $a->{level} <=> $b->{level} || $a->{id } <=> $b->{id } } @subAoH ) { if( $me->{level} == 0 ) { print_parent( $me->{id} ) if $me->{id} > 0; } } It helps simplify the code. :) (Untested, please verify.) All the best, J From jarich at perltraining.com.au Fri Nov 17 16:49:42 2006 From: jarich at perltraining.com.au (Jacinta Richardson) Date: Sat, 18 Nov 2006 11:49:42 +1100 Subject: SPUG: Slice of HashOfHash In-Reply-To: References: <8476CE21F2E6E543851495D6AB09F2A401F3ADB7@scarlitnt642.alltel.com> <455BB020.6030204@telus.net> <1d9a3f400611151632o2a03789bi1fc32bddf39d390d@mail.gmail.com> <455C4B31.9060707@perltraining.com.au> Message-ID: <455E58A6.907@perltraining.com.au> Ivan Heffner wrote: > This is all fine in a simple case, but know that a hash look-up, while > relatively cheap, is not free. Further, taking this example and > abstracting it into an object-based interface, it become relatively > expensive and incurs useless overhead. ... > This now does a method call to get the family, then another to get the > husband to check if it is "true" then does it all again to check > equality. In a big app, these calls get expensive. But there's a > short-cut method to do this. Use Perl's short-circuiting logical '||' > to make a single method call (or set of method calls): > > foreach my $family ( $cartoon->families() ) { > if ( ( $cartoon->$family->husband() || '' ) eq 'fred') { > print "yes\n"; > } > } > Or alternately (because there's more than one way to do it: foreach my $family ($cartoon->families()) { if($family->is_husband('fred')) { print "yes\n"; } } Depending on how the classes are encoded, and whether checking the husband's name is going to be a regular enough thing to make it work wrapping into a sub. I do agree that using || helps, though. Excellent point! J From charles.e.derykus at boeing.com Sun Nov 19 15:37:49 2006 From: charles.e.derykus at boeing.com (DeRykus, Charles E) Date: Sun, 19 Nov 2006 15:37:49 -0800 Subject: SPUG: Slice of HashOfHash In-Reply-To: <44889.38.112.225.178.1163803138.squirrel@38.112.225.178> Message-ID: >>Ivan Heffner wrote: >> Use Perl's short-circuiting logical '||' >> to make a single method call (or set of method calls): >> >> foreach my $family ( $cartoon->families() ) { >> if ( ( $cartoon->$family->husband() || '' ) eq 'fred') { >> print "yes\n"; >> } >> } >Or even: > ( $cartoon->$family->husband() // '' ) eq 'fred' Did you perhaps mean the proposed ?? (hook-hook operator) rather than // ... ? -- Charles DeRykus P.S. for anyone wondering what 'hook-hook' is all about: http://www.perl.com/tchrist/defop/defconfaq.html From jarich at perltraining.com.au Mon Nov 20 05:36:15 2006 From: jarich at perltraining.com.au (Jacinta Richardson) Date: Tue, 21 Nov 2006 00:36:15 +1100 Subject: SPUG: Slice of HashOfHash In-Reply-To: References: Message-ID: <4561AF4F.4070502@perltraining.com.au> DeRykus, Charles E wrote: > > >>> Ivan Heffner wrote: >>> Use Perl's short-circuiting logical '||' >>> to make a single method call (or set of method calls): >>> >>> foreach my $family ( $cartoon->families() ) { >>> if ( ( $cartoon->$family->husband() || '' ) eq 'fred') { >>> print "yes\n"; >>> } >>> } > >> Or even: >> ( $cartoon->$family->husband() // '' ) eq 'fred' > > Did you perhaps mean the proposed ?? (hook-hook operator) > rather than // ... ? I suspect he means dor (//): defined or. In 5.10 you'll be able to write: $a //= 0; which will be the same as writing: $a = ( defined $a ? $a : 0); I don't believe this is available in the 5.8 branch, but it's there for some of the 5.9 bleedperls. The English version of this will be "dor" (and possibly "err" as well) and like "or" will have a lower precedence than //. Of course, we need to wait until 5.10 first and some of this will require "use feature qw(...)"; What's "??" ? J From charles.e.derykus at boeing.com Mon Nov 20 06:22:36 2006 From: charles.e.derykus at boeing.com (DeRykus, Charles E) Date: Mon, 20 Nov 2006 06:22:36 -0800 Subject: SPUG: Slice of HashOfHash In-Reply-To: <4561AF4F.4070502@perltraining.com.au> Message-ID: >> >> Did you perhaps mean the proposed ?? (hook-hook operator) rather than >> // ... ? >I suspect he means dor (//): defined or. In 5.10 you'll be able to write: > $a //= 0; >which will be the same as writing: > $a = ( defined $a ? $a : 0); >I don't believe this is available in the 5.8 branch, but it's there for some of the 5.9 >bleedperls. The English version of this will be "dor" (and possibly "err" as well) and >like "or" will have a lower precedence than //. >Of course, we need to wait until 5.10 first and some of this will require "use feature > qw(...)"; > What's "??" ? '??' = '//' (hook-hook was the "dor" symbol for many moons.. but evidently got a final hook) -- Charles DeRykus _____________________________________________________________ Seattle Perl Users Group Mailing List POST TO: spug-list at pm.org SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list MEETINGS: 3rd Tuesdays WEB PAGE: http://seattleperl.org/ From twists at gmail.com Mon Nov 20 08:52:27 2006 From: twists at gmail.com (Joshua ben Jore) Date: Mon, 20 Nov 2006 08:52:27 -0800 Subject: SPUG: Slice of HashOfHash In-Reply-To: <4561AF4F.4070502@perltraining.com.au> References: <4561AF4F.4070502@perltraining.com.au> Message-ID: On 11/20/06, Jacinta Richardson wrote: > DeRykus, Charles E wrote: > I suspect he means dor (//): defined or. In 5.10 you'll be able to write: > > $a //= 0; > > which will be the same as writing: > > $a = ( defined $a ? $a : 0); > > I don't believe this is available in the 5.8 branch, but it's there for some of > the 5.9 bleedperls. The English version of this will be "dor" (and possibly > "err" as well) and like "or" will have a lower precedence than //. H.Merijn Brand has patches on CPAN against earlier perls to add the // operator. See the dor patches in his CPAN directory: http://cpan-sj.viaverio.com/authors/id/H/HM/HMBRAND/. It covers all of 5.8. Josh From sthoenna at efn.org Mon Nov 20 13:25:40 2006 From: sthoenna at efn.org (Yitzchak Scott-Thoennes) Date: Mon, 20 Nov 2006 13:25:40 -0800 (PST) Subject: SPUG: Slice of HashOfHash In-Reply-To: References: <44889.38.112.225.178.1163803138.squirrel@38.112.225.178> Message-ID: <45889.38.112.225.178.1164057940.squirrel@38.112.225.178> Charles E DeRykus wrote: > Did you perhaps mean the proposed ?? (hook-hook operator) > rather than // ... ? ?? is dead, long live //. // (pronouced defined-or, or dor, since it's no longer composed of hooks) will be in perl 5.10, and is available in 5.8 if you apply the appropriate patch from http://search.cpan.org/CPAN/authors/id/H/HM/HMBRAND/. > P.S. > for anyone wondering what 'hook-hook' is all about: > http://www.perl.com/tchrist/defop/defconfaq.html That document is a real slick piece of work; you kind of lose track of the strawmen after a while. I especially like the link to the defprofaq at the bottom that serves the page up with an incorrect MIME type. From cmeyer at helvella.org Mon Nov 20 16:34:09 2006 From: cmeyer at helvella.org (Colin Meyer) Date: Mon, 20 Nov 2006 16:34:09 -0800 Subject: SPUG: Meeting Announcement -- 21 November 2006 Message-ID: <20061121003409.GE30506@funpox.helvella.org> November 2006 Seattle Perl Users Group (SPUG) Meeting ==================================================== Topic: Current Projects of Spuggers Meeting Date: Tuesday, 21 November 2006 Meeting Time: 6:30 - 8:30 p.m. Location: Whitepages.com offices, downtown Seattle Cost: Admission is free and open to the public Info: http://seattleperl.org/ ==================================================== Please join us Tuesday evening on 17 October 2006 at the regular monthly meeting of the Seattle Perl Users Group. This month we'll have an informal get together, to discuss our current projects and perhaps have a hacking session. If there is interest, Colin has a talk on some Perl6 features that can be presented. Thank you to our hosts at Whitepages.com for giving us a great place to hold our meetings and presentations, to the SPUG-Workers list for making speaker arrangements, to all the SPUG members that show up at meetings or participate on the list to make the group worthwhile in the first place, and all the JAPHs out there for just being. Meeting Location ================ Whitepages.com is located on the 16th floor of the Rainier Square Tower (1301 5th Avenue, Seattle) which is across from the 5th Avenue Theater. See the directions[1] for a quick primer on how to reach us from various locations across Puget Sound. There are plenty of locations to park in the area, including on the street. If you're looking for off-street parking, you can park in the Rainier Square garage which has an entrance on Union St. After 6PM, the building management restricts access to most floors. Our host is trying to take care of this, but if unsuccessful, they will station someone on the 1st floor near the elevator bank and 5th Avenue entrance to let people in. Worst case scenario, give our host a call on his cell phone[2] and he'll run down to let you in. Our hosts are providing a generous assortment of free sodas, fruit drinks, teas, and coffee, and also have some snacks. You definitely won't dehydrate here. We look forward to seeing you! [1] - http://www.whitepagesinc.com/locations/ [2] - 206 354 7789 From MichaelRWolf at att.net Mon Nov 20 16:50:54 2006 From: MichaelRWolf at att.net (Michael R. Wolf) Date: Mon, 20 Nov 2006 16:50:54 -0800 Subject: SPUG: Meeting Announcement -- 21 November 2006 In-Reply-To: <20061121003409.GE30506@funpox.helvella.org> Message-ID: <001001c70d07$207e0390$0500a8c0@mlaptop> I bent my 5-week, cross-country training schedule to attended the Chicago Hackathon weekend earlier this month where I worked on Perl::Critic. (It's great to be home, and to attend local meetings in person!!!) I can give an ad-hoc status report of the hackathon and the package tomorrow night. I'm also interested in having a Northwest Hackathon, and have started talking it up. It seems that Ballard (and its outlying suburbs of Seattle, WA, Portland, OR, and Vancouver, BC) have become hotbeds of Open Source development, notably the Perl-ish variety. If you're interested in helping to make a local hack-a-thon happen, show up tomorrow for an informal kick-off. I'll post more details as the Northwest Hackathon comes to life. Enjoy, play, learn, play, hack, Michael P.S. You can learn more about the hackathon at the static page and the Wiki: Chicago Perl Hackathon: Nov 10-12, 2006, Crystal Lake, IL http://hackathon.info/ Hackathon Chicago, Nov 10-12, 2006 / Hackathon Chicago, Nov 10-12, 2006 http://rakudo.org/hackathon-chicago/index.cgi -- Michael R. Wolf All mammals learn by playing! MichaelRWolf at att.net From cmeyer at helvella.org Tue Nov 21 12:05:57 2006 From: cmeyer at helvella.org (Colin Meyer) Date: Tue, 21 Nov 2006 12:05:57 -0800 Subject: SPUG: Meeting Announcement -- 21 November 2006 In-Reply-To: <20061121003409.GE30506@funpox.helvella.org> References: <20061121003409.GE30506@funpox.helvella.org> Message-ID: <20061121200557.GM30506@funpox.helvella.org> On Mon, Nov 20, 2006 at 04:34:09PM -0800, Colin Meyer wrote: > > [1] - http://www.whitepagesinc.com/locations/ Make that: http://www.whitepagesinc.com/locations -Colin. From MichaelRWolf at att.net Tue Nov 21 17:28:02 2006 From: MichaelRWolf at att.net (Michael R. Wolf) Date: Tue, 21 Nov 2006 17:28:02 -0800 Subject: SPUG: NW Hackathon Message-ID: <002501c70dd5$7515b320$0500a8c0@mlaptop> I made a plan to attend. Life happened. Ergo... I'm not going to make it to tonight's meeting. I'll post NW Hackathon information at a later date. -- Michael R. Wolf All mammals learn by playing! MichaelRWolf at att.net > -----Original Message----- > From: Michael R. Wolf [mailto:MichaelRWolf at att.net] > Sent: Monday, November 20, 2006 4:51 PM > To: 'spug-list at mail.pm.org' > Subject: RE: SPUG: Meeting Announcement -- 21 November 2006 > > I bent my 5-week, cross-country training schedule to attended the > Chicago Hackathon weekend earlier this month where I worked on Perl::Critic. > (It's great to be home, and to attend local meetings in person!!!) > > I can give an ad-hoc status report of the hackathon and the package > tomorrow night. From jobs-noreply at seattleperl.org Wed Nov 22 09:57:30 2006 From: jobs-noreply at seattleperl.org (SPUG Jobs) Date: Wed, 22 Nov 2006 09:57:30 -0800 (PST) Subject: SPUG: JOB: mod_perl & OO Perl, ecommerce Message-ID: Do you have experience with Mod_Perl and OO Perl? Our client has an opening for a permanent position with an ecommerce company in DT Seattle. They are looking to pay between $75k-$85k (W-2), DOE. They have outstanding benefits including medical dental 401k and stock options. If you are interested in learning more you can reach me at jakev at lincolnbay.com Jake Vallejo Lincoln Bay Co. 206.438.5706 1000 2nd Ave Suite 1900 Seattle, WA 98104 jakev at lincolnbay.com www.lincolnbay.com From offby1 at blarg.net Wed Nov 22 11:55:25 2006 From: offby1 at blarg.net (Eric Hanchrow) Date: Wed, 22 Nov 2006 11:55:25 -0800 Subject: SPUG: Last night's meeting: perl6-on-parrot Message-ID: <874psr45oy.fsf@offby1.atm01.sea.blarg.net> Someone (I don't know their name) suggested that I check out perl6 on Parrot in order to get better performance than pugs. I see https://svn.perl.org/parrot/tags/RELEASE_0_4_7/languages/perl6; is that what you had in mind? It looks _very_ incomplete. -- A hacker would consider being asked to write add x to y giving z instead of z = x+y as something between an insult to his intelligence and a sin against God. -- Paul Graham (http://paulgraham.com/popular.html) From offby1 at blarg.net Thu Nov 23 23:02:43 2006 From: offby1 at blarg.net (Eric Hanchrow) Date: Thu, 23 Nov 2006 23:02:43 -0800 Subject: SPUG: audreyt video -- can it be CC licensed? Message-ID: <877ixl2up8.fsf@offby1.atm01.sea.blarg.net> She'd like a copy. [10:54 PM] audreyt: saw your talk at Amazon from last month. Enthralling [10:55 PM] video? or you were there? video bootlegged :-) [10:56 PM] oooh. want! upload it somewhere? I hear video uploading sites are plenty these days [10:57 PM] I got the impression that it wasn't supposed to be broadcast, so ... I certainly would like it to be broadcast... offby1: maybe ask @amazon.com source to see if I can make it available under CC license? There you have it. -- [Dijkstra's] great strength is that he is uncompromising. It would make him physically ill to think of programming in C++. -- Donald E. Knuth From sthoenna at efn.org Tue Nov 28 10:46:24 2006 From: sthoenna at efn.org (Yitzchak Scott-Thoennes) Date: Tue, 28 Nov 2006 10:46:24 -0800 Subject: SPUG: Slice of HashOfHash In-Reply-To: <4561AF4F.4070502@perltraining.com.au> References: <4561AF4F.4070502@perltraining.com.au> Message-ID: <20061128184624.GA3972@efn.org> On Tue, Nov 21, 2006 at 12:36:15AM +1100, Jacinta Richardson wrote: > I suspect he means dor (//): defined or. In 5.10 you'll be able to write: > > $a //= 0; > > which will be the same as writing: > > $a = ( defined $a ? $a : 0); Make that: defined $a ? $a : ($a = 0); From krahnj at telus.net Tue Nov 28 11:00:02 2006 From: krahnj at telus.net (John W. Krahn) Date: Tue, 28 Nov 2006 11:00:02 -0800 Subject: SPUG: Slice of HashOfHash In-Reply-To: <20061128184624.GA3972@efn.org> References: <4561AF4F.4070502@perltraining.com.au> <20061128184624.GA3972@efn.org> Message-ID: <456C8732.2010908@telus.net> Yitzchak Scott-Thoennes wrote: > On Tue, Nov 21, 2006 at 12:36:15AM +1100, Jacinta Richardson wrote: >>I suspect he means dor (//): defined or. In 5.10 you'll be able to write: >> >> $a //= 0; >> >>which will be the same as writing: >> >> $a = ( defined $a ? $a : 0); > > Make that: > > defined $a ? $a : ($a = 0); Really? You will get a "void context" warning doing that. John -- Perl isn't a toolbox, but a small machine shop where you can special-order certain sorts of tools at low cost and in short order. -- Larry Wall