From james.oden at gmail.com Mon Mar 12 08:41:58 2007 From: james.oden at gmail.com (James Olin Oden) Date: Mon, 12 Mar 2007 11:41:58 -0400 Subject: [Raleigh-talk] Integrating latest threads::shared(3pm) into older perl 5.8.5 Message-ID: So far I've got it building (replaced ext/threads/shared tree, and updated global MANIFEST), and it builds, but when I run the tests I get: perl: symbol lookup error: ../lib/auto/threads/shared/shared.so: undefined symbol: SvREFCNT_inc_void I did some research and it turns out this internal perl API symbol was introduced in perl 5.9.x. Looking at the source for threads::shared version 1.07 (which is what I'm using) there is a ppport.h file that has a redefinition for SvREFCNT_inc_void() if it does not exist. If I build this module outside of the perl sources, it actually uses this redefinition and seems to work fine(otherwise my script I was testing would not work...the goal here was to chase down a memory leak in a script of mine that turned out to be in threads::shared). When I try to build it from the perl sources it does not ssem to use the ppport.h file. So my question is simply what am I doing wrong? More specifically theough what do I need to tweak so the ppport.h file will get used? I know of course I can just patch the stinken shared.xs file to have the redefinition directly inline, but I'd like to avoid that. Thanks...james From awmyhr at gmail.com Tue Mar 20 11:02:26 2007 From: awmyhr at gmail.com (Andy Myhr) Date: Tue, 20 Mar 2007 14:02:26 -0400 Subject: [Raleigh-talk] Please assist w/regex Message-ID: Hello all, I am having an issue with regular expressions in Perl. I have the following: $name = "Sun (TM) Enterprise 250 (2 X UltraSPARC-II 296MHz)"; What I want is: $name = "Sun Enterprise 250"; But if I use this: $hwname =~ s/ \(\w+\)//g; It only removes the "(TM)" portion of the string. Everything else I've tried either does nothing or removes from first "(" to last ")". Please note, I'm needing a general solution, as $name could contain anything, including no "(...)" at all (in which case I'd want to leave it untouched). ThanX! a.m. From james.oden at gmail.com Tue Mar 20 11:07:58 2007 From: james.oden at gmail.com (James Olin Oden) Date: Tue, 20 Mar 2007 14:07:58 -0400 Subject: [Raleigh-talk] Please assist w/regex In-Reply-To: References: Message-ID: On 3/20/07, Andy Myhr wrote: > Hello all, I am having an issue with regular expressions in Perl. I > have the following: > > $name = "Sun (TM) Enterprise 250 (2 X UltraSPARC-II 296MHz)"; > > What I want is: > > $name = "Sun Enterprise 250"; > > But if I use this: > > $hwname =~ s/ \(\w+\)//g; > Try: $name =~ s/ \([^)]+?\)//g; Two points...the string "(2 X UltraSPARC-II 296MHz)" has numbers and spaces both of which are not word characters, and you definately need to put the question mark after the plus so your regular expression is no longer greedy, otherwise you'd match: (TM) Enterprise 250 (2 X UltraSPARC-II 296MHz) Cheers...james P.S. Keep these easy questions comming it will distract me from perl memory leaks and other things that are all around painful. From devin at nacredata.com Tue Mar 20 06:10:43 2007 From: devin at nacredata.com (devin at nacredata.com) Date: Tue, 20 Mar 2007 13:10:43 +0000 Subject: [Raleigh-talk] Please assist w/regex Message-ID: <1174414243246.devin@nacredata.com> $name =~ s/ \([^\)]+\)//g; -- devin --- "James Olin Oden" wrote: > On 3/20/07, Andy Myhr wrote: > > Hello all, I am having an issue with regular expressions in Perl. I > > have the following: > > > > $name = "Sun (TM) Enterprise 250 (2 X UltraSPARC-II 296MHz)"; > > > > What I want is: > > > > $name = "Sun Enterprise 250"; > > > > But if I use this: > > > > $hwname =~ s/ \(\w+\)//g; > > > Try: > > $name =~ s/ \([^)]+?\)//g; > > Two points...the string "(2 X UltraSPARC-II 296MHz)" has numbers and > spaces both of which are not word characters, and you definately need > to put the question mark after the plus so your regular expression is > no longer greedy, otherwise you'd match: > > (TM) Enterprise 250 (2 X UltraSPARC-II 296MHz) > > Cheers...james > > P.S. Keep these easy questions comming it will distract me from perl > memory leaks and other things that are all around painful. > _______________________________________________ > Raleigh-talk mailing list > Raleigh-talk at pm.org > http://mail.pm.org/mailman/listinfo/raleigh-talk > From awmyhr at gmail.com Tue Mar 20 11:16:16 2007 From: awmyhr at gmail.com (Andy Myhr) Date: Tue, 20 Mar 2007 14:16:16 -0400 Subject: [Raleigh-talk] Please assist w/regex In-Reply-To: References: Message-ID: <86572845-B9D5-4C8F-B549-0BC50ED33F8C@gmail.com> Wow, that was fast, thank you much (and devin also, whose answer came in just as I was implementing yours)... I'll see what I can do about more "EZ" questions ;) On Mar 20, 2007, at 14:07, James Olin Oden wrote: > On 3/20/07, Andy Myhr wrote: >> Hello all, I am having an issue with regular expressions in Perl. I >> have the following: >> >> $name = "Sun (TM) Enterprise 250 (2 X UltraSPARC-II 296MHz)"; >> >> What I want is: >> >> $name = "Sun Enterprise 250"; >> >> But if I use this: >> >> $hwname =~ s/ \(\w+\)//g; >> > Try: > > $name =~ s/ \([^)]+?\)//g; > > Two points...the string "(2 X UltraSPARC-II 296MHz)" has numbers and > spaces both of which are not word characters, and you definately need > to put the question mark after the plus so your regular expression is > no longer greedy, otherwise you'd match: > > (TM) Enterprise 250 (2 X UltraSPARC-II 296MHz) > > Cheers...james > > P.S. Keep these easy questions comming it will distract me from perl > memory leaks and other things that are all around painful. From james.oden at gmail.com Tue Mar 20 13:40:10 2007 From: james.oden at gmail.com (James Olin Oden) Date: Tue, 20 Mar 2007 16:40:10 -0400 Subject: [Raleigh-talk] Debuging memory leaks... Message-ID: Hi All, In general how do you guys debug memory leaks in your perl scripts? Do you have any tried and true methods or is there some killer tool that makes this easy? Thanks...james